Mendel
Mendel
Paste error in
Mendel
Save, post link here
Sultan
Ok thx
Sultan
And sorry again
Sultan
https://del.dog/ciloyajede
inchidi
https://del.dog/ciloyajede
did you change your database manually (without migration) or mix migration files?
Sultan
mix migrtion files
Anonymous
hi every one i have to give the user some ModelMultipleChoiceField() field but the thing i am using this to get the choices queryset=User.objects.all() and i but this in the form and in my template i do {{form}} but the problem is i got this error after i fill all the fields in the form !! "Cannot assign "<QuerySet [<User: test01>]>": "project.owner_name" must be a "User" instance."
Anonymous
https://del.dog/axijahuhiw.py
George
https://del.dog/axijahuhiw.py
You got an empty filter
Anonymous
i used filter but it dose not fix the problem i will try agin
George
You cant put a filter without criteria
George
Just try to run it in shell
George
Also, its not ok to use all() if you override the query, use none()
George
Also you may be mixing Form and ModelForm
George
In ModelForm you dont init manually the fields
George
Use Form i guess
Anonymous
thanks @hyunlee1o
George
Uwu
inchidi
mix migrtion files
most simple way is delete all migration file and your db, then makemigrations and migrate
inchidi
nope
George
hmmm
George
i sometimes deleted a wrong migration file but deleting all :)
George
im just cautious
inchidi
inconsistent migration files are what break migration
George
yeah, tru
inchidi
i sometimes deleted a wrong migration file but deleting all :)
if you delete your db also then created table after next migrate should be fine
George
one thing i always thought is how to regen a col i deleted in database MANUALLY
Komang
Roleback first your migrate file and makemigration again
George
hmmm
inchidi
one thing i always thought is how to regen a col i deleted in database MANUALLY
i wont recommend you to generate manually columns django auto generate, since django take care column relationship, type, etc
inchidi
i think dump data, delete table and rerun migration best solution when your table and migration files not sync'ed
inchidi
if you already fix your migration files
inchidi
or manually find one by one wheres the mistake (usually the migration file start with duplicate number)
inchidi
then your next migrate will be fine
George
George
thanks
George
also dumping a table better through shell or using the GUI?
George
*may be a noob question*
inchidi
also dumping a table better through shell or using the GUI?
i think am always using pycharm db thingy feature when deleting column or table
George
i'll look if there is something for my txt editor
inchidi
i'll look if there is something for my txt editor
for external gui app i think dbeaver pretty nice
George
but the gui is too much eclipse like and a bit buggy
inchidi
yeah true, and its another app, delete via shell probably faster for almost any case
George
and some windows just fucking break
Sultan
the error in this file https://del.dog/iyiwotefaf.py
Sultan
Take a look please
George
Take a look please
what do i have to look at?
Sultan
Help me to find the error
George
Sultan
If you can help me read it, it is only 51 lines
George
also i normally don't make myself the migration files so i cant see the problem
Sultan
thx bro
George
:/
George
did you write it manually ?
inchidi
the error in this file https://del.dog/iyiwotefaf.py
so, its custom migration file. the error pretty clear ContentType matching query does not exist. on line 14
inchidi
Thx
you should not put those things there tho. use fixture instead
Sultan
👍🏻
inchidi
fixture?
read more about django fixture here
inchidi
not always json tho
George
yes, its nice, also you can save a table in a fixture
inchidi
but tbh i hate manage py dumpdata for backup or work with many data. it give unsorted data so sometimes relationship breaks
inchidi
but maybe its just me that dont know how to really use it. maybe someone here know how to avoid that
Krunal
Can someone help me to learn Django?
George
Can someone help me to learn Django?
follow the official tutorial in the django website
m
but maybe its just me that dont know how to really use it. maybe someone here know how to avoid that
As far as i understand it's designed to be used when you move to a new type of database