I'm having some problems here with django admin site and inlines. I've been googling for solution for two days now but nothing.
I have two models:
class Measurement(models.Model):
user = models.ForeignKey(User)
date = models.DateTimeField(auto_now_add=True)
# etc
class Media(models.Model):
measurement = models.ForeignKey(Measurement)
link = models.CharField(max_length=255, blank=True)
description = models.TextField(blank=True)
# etc
And configuration for admin site:
class MediaInline(admin.StackedInline):
model = Media
extra = 0
class MeasurementAdmin(admin.ModelAdmin):
inlines = [MediaInline,]
admin.site.register(Media)
admin.site.register(Measurement, MeasurementAdmin)
The strange thing is: admin site shows inlines for some Measurement objects and doesn't for some others. Whole formset is invisible (it's not there) even if related records are visible in database. Also, ValidationError: [u'ManagementForm data is missing or has been tampered with']
exception is raised for these objects. Have anyone dealed with this?
In 90% cases i've seen this was due to error in __unicode__
method, which django use on inline template.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With