django - Cannot get models thats referencing another model aas foriegn key -
what want userimages use particular foriegnkey i'm doing user.objects.get(pk=1).profile.friends.all().values_list('userimages')
but get. find strange uservideo model similar userimages , yet userimages cannot resolved.
fielderror: cannot resolve keyword 'userimages' field. choices are: about_me, display_image, friends, id, nick_name, owner, owner_id, user, user_id, uservideo
models
class userimages(models.model): owner = models.foreignkey('auth.user', related_name='userimages') user=models.foreignkey(profile,related_name="profile_owner") # highlighted = models.textfield(default=none,blank=true,null=true) image=models.imagefield() pub_date=models.datetimefield(default=now) class uservideo(models.model): owner = models.foreignkey('auth.user', related_name='uservideo') # highlighted = models.textfield(default=none,blank=true,null=true) user=models.foreignkey(profile) image=models.filefield() pub_date=models.datetimefield(default=now)
logic is: select images images object user has fk:
query = userimages.objects.filter(user=1).all()
Comments
Post a Comment