django tests - model instance not created

2019-05-09 Thread luca bocchi
I'm experiencing issues on creating fixtures for a particular model in a test class with Django and the DRF. I'm using model-mommy , but even creating a single instance just using the Django ORM for that model does not work: *from

Re: Error at OneToOneField in models while creating new models class

2018-09-26 Thread luca bocchi
seems that your app is not in settings.INSTALLED_APPS, add 'section' there and retry. L Il giorno lunedì 24 settembre 2018 13:22:48 UTC+2, Srinivas Gadi ha scritto: > > Thank you for the response, > 1. Deleted the migrations folder > 2. Removed the SQLite3 DB itself > 3. My dir structure. > >

Re: what's args parameter in reverse()

2018-09-26 Thread luca bocchi
args should be a list or a tuple, although is not specified clearly in the docs: https://docs.djangoproject.com/en/1.11/ref/urlresolvers/#reverse def test_post_update_view(self): response = self.client.post(reverse('post_edit',args=['1']),{ 'title':'Updated title',

Re: Make migration issue for a unique True filed.

2018-09-26 Thread luca bocchi
fields are not null by default, so you don't need: *null=False* that's why *makemigrations* doesn't detect changes in the *MyModel* model. L Il giorno mercoledì 26 settembre 2018 13:16:24 UTC+2, jisson varghese ha scritto: > > > I have model MyModel in app app1 > > class

Re: DEFAULT_FILE_STORAGE and tests

2018-09-25 Thread luca bocchi
Il giorno giovedì 20 settembre 2018 15:25:23 UTC+2, sandro dentella ha scritto: > > Hi, > > I have a storage that create some thumbnail and is declared in some > models' fields. It's created inheriting from DEFAULT_FILE_STORAGE and it > just works fine both in FileSystemStorage and in Aws.

Re: My django model joining wrong fields when there are multiple related fields with join

2018-09-25 Thread luca bocchi
Hi Sadaf, re the m2m rel: since your not adding additional fields on the intermediate model ProductShadowCategory, there's no need for that: class Category(SlugableModel): shadow_products = models.ManyToManyField("product_management.Product") the orm will automatically create an

Re: My django model joining wrong fields when there are multiple related fields with join

2018-09-25 Thread luca bocchi
Hi Sadaf, re the m2m rel: since your not adding additional fields on the intermediate model ProductShadowCategory, there's no need for that: class Category(SlugableModel): shadow_products = models.ManyToManyField("product_management.Product") the orm will automatically create an

Re: DEFAULT_FILE_STORAGE and tests

2018-09-25 Thread luca bocchi
already tried: class GeneraliDiscoverRunner(DiscoverRunner): def setup_test_environment(self, **kwargs): settings.DEFAULT_FILE_STORAGE = 'web.storage.TestStorage' super().setup_test_environment(**kwargs) ? although I'm not sure that settings can be changed at runtime by

Re: DEFAULT_FILE_STORAGE and tests

2018-09-25 Thread luca bocchi
Already tried with: class GeneraliDiscoverRunner(DiscoverRunner): def setup_test_environment(self, **kwargs): settings.DEFAULT_FILE_STORAGE = 'web.storage.TestStorage' super().setup_test_environment(**kwargs) ? otherwise, I'd say to run the test with a custom settings module