django_reverse_admin
django_reverse_admin copied to clipboard
How to respect both the 'fields' and the 'admin_class' attributes?
Hello,
If I write:
inline_type = 'tabular'
person_field_list = ('id', 'first_name', 'inix', 'last_name',
'birthday', 'zip_code', 'street', 'house_number', 'house_suffix',
'place', 'email', 'email_2', 'phone_number', 'phone_number_2')
inline_reverse = [{'field_name': 'old_person',
'fields': person_field_list,
'admin_class': PersonInline},
('new_person', {'fields': person_field_list,
'admin_class': PersonInline})
]
Then for old_person it ignores the field list and shows all the fields. But for new_person it does show the correct fields but it ignores the admin_class (i think) because it is still showing the delete checkbox.
Am I missing something?
Context:
class PotentialPersonDuplicate(models.Model):
old_person = models.ForeignKey(Person, related_name='possible_newer_duplicates', on_delete=models.CASCADE)
new_person = models.ForeignKey(Person, related_name='possible_older_duplicates', on_delete=models.CASCADE)
class PersonInline(admin.TabularInline):
model = Person
def has_delete_permission(self, request, obj=None):
return False