AttributeError with deep Prefetch

2015-05-20 Thread Gagaro
Hello, I have an issue when trying to using prefetch_related in a queryset inside a queryset already doing a prefetch_related. I have the following code: items = OrderItem.objects.prefetch_related(Prefetch('results')) orders = Order.objects.prefetch_related(Prefetch('items', queryset=items))

Are data created by setUpTestData shared by all tests ?

2015-06-01 Thread Gagaro
Hi, I have an hard time understanding how I am supposed to use setUpTestData. The documentation isn't very clear about it (https://docs.djangoproject.com/en/1.8/topics/testing/tools/#django.test.TestCase.setUpTestData). "The class-level atomic block described above allows the creation of initi

Re: Are data created by setUpTestData shared by all tests ?

2015-06-01 Thread Gagaro
the object from the > database using Model.refresh_from_db() in test_2(). > > On Monday, June 1, 2015 at 5:20:03 AM UTC-4, Gagaro wrote: >> >> Hi, >> >> I have an hard time understanding how I am supposed to use setUpTestData. >> The documentation isn't v

Re: Are data created by setUpTestData shared by all tests ?

2015-06-01 Thread Gagaro
For information, I went from 30 seconds (with setUp) to 13 seconds with setUpTestData. Thanks to the persons who did this feature! On Monday, 1 June 2015 16:04:12 UTC+2, Gagaro wrote: > > Indeed, it was that obvious. > > class OrderBugTest(TestCase): > > @classmethod >

Re: Django with nginx - Waitingtime is more How to reduce

2015-06-01 Thread Gagaro
Hi, You can use the Django Debug Toolbar to see actual time taken by your queries/templates/... Depending on what is taking time for you, there may be several solutions. If you have issues with your queries, you should take a look

Re: can i use sqlite for big project?

2015-06-25 Thread Gagaro
Please refer to the Appropriate Uses For SQLite page: https://www.sqlite.org/whentouse.html On Thursday, 25 June 2015 16:08:32 UTC+2, Arindam sarkar wrote: > > i need to develop a job portal . is there any problem if i use sqlite ? > coz i am having problem to setup mysql or postgresql . plea

FieldDoesNotExist during custom migration

2016-06-08 Thread Gagaro
ter' > The error happens during the RemoveField (migrations.RemoveField(model_name ='Rendition', name='filter')). So, a couple questions: * Is there a better way to change a field type (with data migration)? * Why do I have this error, when my field is present? The m

Re: Django query returns nothing for legacy databse

2016-06-09 Thread Gagaro
Hi, You should select the database you want to use: Calls.objects.using('calls').all() See https://docs.djangoproject.com/en/1.9/topics/db/multi-db/#manually-selecting-a-database On Thursday, 9 June 2016 14:13:22 UTC+2, Galil wrote: > > Hello, > > I am using two databses for my Django app and

Re: FieldDoesNotExist during custom migration

2016-06-10 Thread Gagaro
ter'), migrations.DeleteModel('Filter'), migrations.RenameField(model_name='Rendition', old_name='filter2', new_name='filter'), migrations.AlterUniqueTogether('rendition', set([('image', 'filter', 

Reverse query name clashe with a M2M and through

2015-10-23 Thread Gagaro
Hello, I have a situation I don't really understand. I have the following models: class Wishlist(models.Model): wine = models.ForeignKey('Wine') user = models.ForeignKey('User') class Wine(models.Model): name = models.CharField(max_length=32) class User(models.Model): name = m

Re: Reverse query name clashe with a M2M and through

2015-10-23 Thread Gagaro
:40:42 UTC+2, Simon Charette wrote: > > Hi Gagaro, > > Intermediate models are just like other in this regard, they create a > related relation hence the reported clash. > > You should either add related_name='+' on your Wishlist related fields or > give th

Re: Reverse query name clashe with a M2M and through

2015-10-23 Thread Gagaro
On Friday, 23 October 2015 16:35:32 UTC+2, Tom Evans wrote: > > 'Wishlist.user' and 'User.wishlist' are the names of the fields being > discussed. The meaning might be clearer with some added words: > > The reverse query name for the field 'Wishlist.user' clashes with > the field 'User.wis

Re: Reverse query name clashe with a M2M and through

2015-10-23 Thread Gagaro
Indeed, that makes sense! As you said, the issue is that the error message is exactly the same than for a "normal" conflict. Thank you for looking it up. On Friday, 23 October 2015 16:40:46 UTC+2, Simon Charette wrote: > > Hi Gagaro, > > Upon further investigation it lo