Re: Nullable vs empty strings

2018-05-03 Thread George Lubaretsi
Short answer: because you'll know when you need it. And unless that's the case - there's no good reason to do it. Long answer: Because there's really no reason to do it except for when you have unique constraint on that column. It's just a convention. When you have a `CharField`, you expect retur

Re: I am following the official Django documentation and trying to make the polls app. But when I run the command python manage.py makemigrations polls I get the console error.

2018-04-30 Thread George Lubaretsi
Looks like you have a typo somewhere. Exception says that it can't find a module `polss` while it should be `polls`. Check your settings and imports On Mon, Apr 30, 2018 at 11:29 PM Avitab Ayan Sarmah wrote: > The code I am using for the models is: > > from django.db import models > > class Que

Re: Broken?

2018-04-29 Thread George Lubaretsi
File "/raid3/build/comprosloco/oil/models.py", line 172, in __str__ self.accepted What is inside this __str__ method? `self.accepted` field name sounds like it could be a date. Return type of __str__ must be a string. -- You received this message because you are subscribed to the Google G

updating model breaks admin

2018-04-29 Thread George Lubaretsi
If the data is not important, try to delete migration files from `migrations` package, drop the database tables and reference M2M relationship using strings: tags = models.ManyToManyField('Tag') Or if the Tag model is in another app: tags = models.ManyToManyField('app_name.Tag') Then run `make

Re: updating model breaks admin

2018-04-29 Thread George Lubaretsi
If the data is not important, try to delete migration files from `migrations` package, drop the database tables and reference M2M relationship using strings like so: tags = models.ManyToManyField(`Tag`) Or if the Tag model is in another app, like so: tags = models.ManyToManyField(`app_name.Tag`)

Re: model permission assignment via groups requires further config at model level?

2018-04-29 Thread George Lubaretsi
Django permissions are only enforced in Admin interface by default. You have to enforce them in your views by using `has_perm` method of `user` instance - `user.has_perm('.')` Here's the documentation for permissions - https://docs.djangoproject.com/en/dev/topics/auth/default/#permissions-and-

Beginning Django.

2018-04-29 Thread George Lubaretsi
Changes in 2.0 that are backwards incompatible are mostly low-level things. As a beginner, you won't have to deal with them for some time. So you can grab any book that is relevant for 1.11 and you'll be fine. I would actually advise to start your training project using Django 1.11 instead of 2