Django test command fail after changing models.py to a directory structure

2019-01-10 Thread Gonzalo Amadio
This is in Django 2.0 , python 3.6.5 I have an app called posts, and I changed models.py to a folder structure, i.e., create a directory models and move the file models.py insid. Also config __ init__.py file, as explained next. The project runs ok, but my test suite fails. In my settings, i

Re: db_index=True not working, and indexes in class Meta yes

2018-12-29 Thread Gonzalo Amadio
Yes, exactly. Django doc tells they do the same. And they do, but if you do not specify db_index=False in field, both indexes are created. Here is exaplanation : https://stackoverflow.com/questions/53966256/django-db-index-true-not-creating-index-but-class-meta-indexes-yes El domingo, 30 de di

db_index=True not working, and indexes in class Meta yes

2018-12-28 Thread Gonzalo Amadio
I have a model like this (simplified code): class Agreement(modes.Model): job = models.ForeignKey(...) class Meta: indexes = ( models.Index(fields=['job']), ) And when run migrations, the index is created. BUT, after doing this: clas

Re: Trouble raising forms.ValidationError in save() override in admin.py

2018-05-03 Thread Gonzalo Amadio
This is very old, but in the case someone red this. If you do it on the save method of the admin, you MUST save the model. So you should override admin's form. Check it here how to do it : http://itegram.com/2018/05/03/ add-extra-control-to-admin-save-method/