Model backward inheritance in newforms admin
class Document(models.Model):
num = models.CharField(max_length=30)
class DocumentType(Document):
payment_type = models.IntegerField()
payment_date = models.DateField()
client = models.ForeignKey(Client)
class OtherDocument(Document):
first_field = models.CharField(max_length=111)
second_field = models.CharField(max_length=123)
class DocumentRow(models.Model)
document = models.ForeignKey(Document, related_name='rows')
kind = models.CharField(max_length=30)
date = models.DateField()
As you can see we have 2 kinds of documents - DocumentType and OtherDocument - every kind of document has same fields as "Document" and aditional fields. And every kind of document should hav rows.
It works perfectly in standard views but its problematic to implement in admin.
i tried
class DocumentRowAdmin(admin.TabularInline):
extra = 10
model = models.DocumentRow
class DocumentTypeAdmin(admin.ModelAdmin):
inlines = [DocumentRowAdmin, ]
admin.register(models.DocumentType, PrzesuniecieAdmin)
admin.register(models.OtherDocument, PrzesuniecieAdmin)
And this way it only raises an exception about relationship.
Maybe some "inline_for_parent" option or sth?
im trying to make it working myself but im stuck in BaseModelFormSet.get_queryset method
Change History
(5)
milestone: |
→ post-1.0
|
Triage Stage: |
Unreviewed → Design decision needed
|
Version: |
newforms-admin → SVN
|
Component: |
Uncategorized → Admin interface
|
Resolution: |
→ fixed
|
Status: |
new → closed
|
Milestone post-1.0 deleted