Django admin.py missing field error
        Posted  
        
            by 
                user782400
            
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by user782400
        
        
        
        Published on 2014-08-25T16:16:31Z
        Indexed on 
            2014/08/25
            16:19 UTC
        
        
        Read the original article
        Hit count: 436
        
When I include 'caption', I get an error saying EntryAdmin.fieldsets[1][1]['fields']' refers to field 'caption' that is missing from the form
In the admin.py; I have imported the classes from joe.models import Entry,Image
Is that because my class from models.py is not getting imported properly ?
Need help in resolving this issue.
Thanks.
models.py
class Image(models.Model):
    image = models.ImageField(upload_to='joe')
    caption = models.CharField(max_length=200)
    imageSrc = models.URLField(max_length=200)
    user = models.CharField(max_length=20)
class Entry(models.Model):
    image = models.ForeignKey(Image)
    mimeType = models.CharField(max_length=20)
    name = models.CharField(max_length=200)
    password = models.URLField(max_length=50)
admin.py
class EntryAdmin(admin.ModelAdmin):
    fieldsets = [
      ('File info', {'fields': ['name','password']}),
      ('Upload image', {'fields': ['image','caption']})]
    list_display = ('name', 'mimeType', 'password') 
admin.site.register(Entry, EntryAdmin)
admin.site.register(Image)
        © Stack Overflow or respective owner