python - Class has no atribute 'urls' - Django models.ImageField() can't migrate -
i try add imagefield error.
code working with:
#models.py django.db import models django.contrib.auth.models import user django.db.models.signals import post_save django.core.exceptions import validationerror import datetime class profile(models.model): user = models.onetoonefield(user, on_delete=models.cascade, primary_key=true) verified = models.booleanfield(default=false) status = models.charfield(max_length=200, null=true, blank=true) country = models.charfield(max_length=100, null=true, blank=true) province = models.charfield(max_length=100, null=true, blank=true) city = models.charfield(max_length=100, null=true, blank=true) date_of_birth = models.datefield(null=true, blank=true) class profileimages(models.model): profile = models.foreignkey(profile, related_name='images') image = models.imagefield() #admin.py django.contrib import admin .models import * class profileimagesinline(admin.tabularinline): model = profileimages = 3 class profileadmin(admin.modeladmin): inlines = [ profileimagesinline, ] admin.site.register(profile, profileimages)
this throws: 'attribute error' profileimages has no attrbute 'urls'. don't know why. ideas?
the second parameter admin.site.register
modeladmin class. passing model there instead.
admin.site.register(profile, profileadmin)
Comments
Post a Comment