Esempio n. 1
0
                                       approved_date=datetime.now())
        self.message_user(
            request, 'approved %d protocol%s' %
            (rows_updated, 's' if rows_updated > 1 else ''))

    approve_protocol.label = 'Approve'
    approve_protocol.short_description = 'Approve and publish this protocol'

    def save_model(self, request, obj, form, change):
        obj.citation_type = 'PROTOCOL'

        obj.update_date = obj.approved_date
        if not obj.pk:
            obj.insert_person_name = request.user.username
            obj.insert_date = obj.update_date

        # Save to the staging table
        super(ProtocolSourceCitationAdmin,
              self).save_model(request, obj, form, change)

    def has_delete_permission(self, request, *args, **kwargs):
        return False


method_admin.register(models.MethodOnline, MethodOnlineAdmin)
method_admin.register(models.MethodStg, MethodStgAdmin)
method_admin.register(models.Method, MethodAdmin)
method_admin.register(models.ProtocolSourceCitationStgRef,
                      ProtocolSourceCitationAdmin)
method_admin.register(models.SourceCitationRef, SourceCitationAdmin)
Esempio n. 2
0
        obj.approved = 'Y'
        obj.approved_date = datetime.now()

        obj.update_date = obj.approved_date
        if not obj.pk:
            obj.insert_person_name = request.user.username
            obj.insert_date = obj.update_date

        # Save to the staging table
        super(ClassicSourceCitationAdmin,
              self).save_model(request, obj, form, change)

        # Save a copy to the live table
        values = model_to_dict(obj)
        source_citation_id = values.pop('source_citation_id')
        values['item_type_id'] = values.pop('item_type')
        values.pop('owner_editable')
        values.pop('ready_for_review')
        models.SourceCitationRef.objects.update_or_create(
            source_citation_id=source_citation_id, defaults=values)


method_admin.register(models.AccuracyUnitsDom, AccuracyUnitsDomAdmin)
method_admin.register(models.AnalyteRef, AnalyteRefAdmin)
method_admin.register(models.DlRef, DlRefAdmin)
method_admin.register(models.DlUnitsDom, DlUnitsDomAdmin)
method_admin.register(models.InstrumentationRef, InstrumentationRefAdmin)
method_admin.register(models.MethodSourceRef, MethodSourceRefAdmin)
method_admin.register(models.ClassicSourceCitationStgRef,
                      ClassicSourceCitationAdmin)