inchidi
iNcAeLuM
ok all explain it again. i added in my models.py a line: slug = models.SlugField(null=True) then i execute: python manage.py makemigrations and i got that error
iNcAeLuM
later i solved it manually
iNcAeLuM
but in fiurst place i got that error
iNcAeLuM
not get that error cuz y modify my db
Ajmal
but still dont know why i got that error
I get that error when I try to add a new filed to already created and DB migrated models. Some times if there are many apps in one project manage.py migrate --run-syncdb appname Only work, I'm also not aware about why this happening
inchidi
not get that error cuz y modify my db
okay if you like short answer without any in deep explanation, the answer is you get that error because your migration files doesnt match with your current (that time) db structure
inchidi
thanks for the info ill try to figureout what have changed in my db
just want to tell you that from what you said i know that you didnt understand what happened yet. coz actually thing you should check is your migration files (or and compare it with your db) instead checking your db
inchidi
Yes
thats not what its for, use django generic views instead
Wisdom
please how can i capture fingerprints in django?
Ярик
guys, can someone tell me how to change admin panel font size? im using django-jet lib to beautify admin
Ярик
yeah, like a <body> tag font-size
Mirco
Write your own css and override it Or you need to find which rule uses Django but you should to check official source code
Ярик
i'll try
Anonymous
How to create question answer forum in Django like stack overflow
Anonymous
Any idea
Anonymous
If you guys can share any course or something
Anonymous
It would be a great help
Anonymous
I am using Q to perform an or query. Example Q(field=b) and so on, will the filtered results be in the same order as of Q
Sulistyo
Hello
Sulistyo
i have a problem to render data from tabel.. using django-datatabel-view
Sulistyo
i have table Collection and CollectionTitle.. i want to render data from field Hasilujian using models Collection.. how i do that? thanks
Sulistyo
sorry bad english
Turtle_In_Hurry
def validate_unique(self, exclude=None): if not self.is_deleted and Department.objects.exclude(pk=self.pk).filter(location=self.location, name=self.name).exists(): raise ValidationError('Some error message about uniqueness required') super(Department, self).validate_unique(exclude=exclude) i'm overriding this method to ignore is_deleted=True can anyone tell me what Department.objects.exclude(pk=self.pk) does
Sander
How to make sure every thread in Django uses the same instance of the database instead of creating a new connection to the database every time a thread is spawned?
GNU/Matt
it inherits all of the attributes of the main thread, variables included
GNU/Matt
So if the connection variable (whether it's the standard SQLite3 or other) is present in the main thread, it will be accessible also in the other threads
GNU/Matt
But be careful with that as changing a variable value affects all of the threads. Otherwise you need another process with multiprocessing module
GNU/Matt
it inherits all of the attributes of the main thread, variables included
of course, you got to have a function to pass the connection variable to, and also have to specify it in the args parameter as an iterable object (a tuple)
Sander
I think that threads automatically does
Their documentation states that a new connection is created for each thread
Sander
I'm using gevent to create the threads
Sander
Problem is that checking for existing items always returns false
Naveen
why don't u make a recipient list before sending email instead and then pass it to send_mail ?
I tried to do same thing but same error occurred ... saying Newsletter (model) is not iterable
GNU/Matt
do you connect to the database on each thread with like conn = db.connect()
GNU/Matt
Or do you pass the conn variable to a function?
GNU/Matt
GNU/Matt
like import threading def funcname(): print("foo") thread1 = threading.Thread( target=funcname, args=(var1,), name="foo") thread1.start()
GNU/Matt
If you want you can also start many threads contemporary, instantiating as many Thread objects as you want. You can also start a thread and wait for it to finish working and then start another one with *.join()
Sander
GNU/Matt
No, I'm just creating objects using the ORM
Well, pass the connection variable to the function then Otherwhise it's obvious it will instantiate a new connection
GNU/Matt
I don't have a connection variable
Oh Why do you need a single connection instance?
GNU/Matt
I mean, does it malform or either corrupt the database/the result?
GNU/Matt
I don't have a connection variable
Then just make a query (?)
GNU/Matt
Are you working on an SQL based db?
Sander
Because I perform multiple writes in the database in which some could contain the same values. In that case I want them to be filtered out (which I of course do using .exists())
GNU/Matt
What database
Sander
I mean, does it malform or either corrupt the database/the result?
Yes, I get duplicates even though I use the if checks
Sander
What database
SQL database (MySQL)
GNU/Matt
SQL database (MySQL)
Well, you might switch to SQLite3
Mirco
I tried to do same thing but same error occurred ... saying Newsletter (model) is not iterable
Yep but it's not due to Django , you have to think that you're open a connection for every loop Instead you could open one , much better
GNU/Matt
for instance when you have a socket connection, you can assign that object to a variable and use it whenever and wherever you want. Can't you do the same with the mysql connection object?
GNU/Matt
so if i have sock = socket.socket() i can do sock.bind(). Don't you have like db = sql.connect(":server:")?
GNU/Matt
Maybe showing the code could help us help you
Sander
Jeez, do you use elif?
I perform the following check for example if(not Standing.objects.filter(league=league, round=round).exists()):
GNU/Matt
exists returns a bool value already
GNU/Matt
so that would be equal to if True
Sander
you can remove the not
It's just an if, no elif or else that's why I use the not
Sander
Anyways that's not related to the issue, how could SQLite fix this?
GNU/Matt
so you can pass it to a variable
GNU/Matt
Why ?
Because It's weird