Add link between CorpContact and Section, export according to that link
This commit is contained in:
parent
2c5bb00c8d
commit
d45742d88f
6 changed files with 65 additions and 22 deletions
|
|
@ -41,15 +41,29 @@ class CorpContactAdmin(admin.ModelAdmin):
|
|||
list_display = ('__str__', 'corporation', 'role')
|
||||
ordering = ('last_name', 'first_name')
|
||||
search_fields = ('last_name', 'first_name', 'role')
|
||||
fields = (('corporation', 'is_main', 'always_cc'),
|
||||
fields = (('corporation',), ('sections', 'is_main', 'always_cc'),
|
||||
('title', 'last_name', 'first_name'),
|
||||
'role', ('tel', 'email'))
|
||||
formfield_overrides = {
|
||||
models.ManyToManyField: {'widget': forms.CheckboxSelectMultiple},
|
||||
}
|
||||
|
||||
def get_form(self, *args, **kwargs):
|
||||
form = super().get_form(*args, **kwargs)
|
||||
form.base_fields['sections'].widget.can_add_related = False
|
||||
return form
|
||||
|
||||
|
||||
class ContactInline(admin.StackedInline):
|
||||
model = CorpContact
|
||||
fields = (('is_main', 'always_cc'), ('title', 'last_name', 'first_name'),
|
||||
fields = (('sections', 'is_main', 'always_cc'),
|
||||
('title', 'last_name', 'first_name'),
|
||||
('role', 'tel', 'email'))
|
||||
extra = 1
|
||||
formfield_overrides = {
|
||||
models.ManyToManyField: {'widget': forms.CheckboxSelectMultiple},
|
||||
}
|
||||
|
||||
|
||||
class CorporationAdmin(admin.ModelAdmin):
|
||||
list_display = ('name', 'short_name', 'pcode', 'city')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue