13👍
There doesn’t seem to be a class named ImagePerson
in that file which is what you are setting the through
(the through table) to be in the M2M on Person
.
3👍
Indentation problem on your Crew class?
Your str method here seems to be defined on the Meta:
class Crew(models.Model):
name = models.CharField(max_length=256)
members = models.ManyToManyField(
'Profile',
through='MovieCrew',
through_fields=('crew', 'profile'),
)
class Meta:
db_table = 'Crew'
def __str__(self):
return '{0}: {1}'.format(self.__class__.__name__, self.name)
def __repr__(self):
return self.__str__()
Is that really what you’re after?
- Django session key changing upon authentication
- Creating a Gin Index with Trigram (gin_trgm_ops) in Django model
- Django collectstatic no such file or directory
2👍
make sure you did python manage.py makemigrations
and python manage.py migrate
if you already did it then check
in serializers.py
class Meta:
model = 'bla bla'
fields = '__all__'
I got this error when i wrote model name in string ('')
if you did same mistake then check and remove ''
1👍
For some people getting this error, don’t forget to add a newly created app into Django’s INSTALLED_APPS
for your ManyToMany
‘s through=
intermediary model to be recognized.
- Docker error with pipenv on django app: Warning: –system is intended to be used for pre-existing Pipfile
- Django rest auth email instead of username
- How do you rollback during Django shell session after causing DatabaseError?
0👍
If you get this error when registering your model in the admin.py then it is because of the follow:
admin.site.register('Post')
and replace it with
admin.site.register(Post)
TLDR: get rid of the the quotations in the model name
- Django Generic Views: When to use ListView vs. DetailView
- Problem launching docker-compose : python modules not installed
- "Returning to that page might cause any action you took to be repeated" – Django
- Django Rest Framework – Getting a model instance after serialization
- Foreign Key to User model