Skip to content

Commit

Permalink
Merge pull request #388 from akvo/feature/387_fix_slow_org_admin
Browse files Browse the repository at this point in the history
[#387] Move InternalOrganisationID to its own admin form
  • Loading branch information
stellanl committed Nov 28, 2013
2 parents 0881742 + 48dc130 commit d61de75
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions akvo/rsr/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,12 +98,11 @@ class OrganisationLocationInline(admin.StackedInline):
formset = RSR_LocationFormFormSet


class InternalOrganisationIDInline(admin.TabularInline):
model = get_model('rsr', 'Organisation').internal_org_ids.through
extra = 1
fk_name = 'recording_org'
verbose_name = 'internal organisation ID'
verbose_name_plural = 'internal organisation IDs'
class InternalOrganisationIDAdmin(admin.ModelAdmin):
list_display = (u'identifier', u'recording_org', u'referenced_org',)
search_fields = (u'identifier', u'recording_org__name', u'referenced_org__name',)

admin.site.register(get_model('rsr', 'internalorganisationid'), InternalOrganisationIDAdmin)


class OrganisationAdminForm(forms.ModelForm):
Expand All @@ -124,7 +123,7 @@ class OrganisationAdmin(admin.ModelAdmin):
(_(u'About the organisation'), {'fields': ('description', 'notes',)}),
)
form = OrganisationAdminForm
inlines = (OrganisationLocationInline, InternalOrganisationIDInline)
inlines = (OrganisationLocationInline,)
exclude = ('internal_org_ids',)
readonly_fields = ('partner_types',)
list_display = ('name', 'long_name', 'website', 'language')
Expand Down

0 comments on commit d61de75

Please sign in to comment.