#22679 closed Bug (fixed)
makemigrations generates invalid code for default_permissions = ()
| Reported by: | Owned by: | mardini | |
|---|---|---|---|
| Component: | Migrations | Version: | dev |
| Severity: | Release blocker | Keywords: | makemigrations, default_permissions |
| Cc: | Triage Stage: | Accepted | |
| Has patch: | yes | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description
This actually happens in Django 1.7b4.
When I define a Model with meta info like this:
class Foo(models.Model):
# ...
class Meta:
default_permissions = ()
The ./manage.py makemigrations command generates a migration file like this:
options={
# ...
'default_permissions': (,),
}
...which causes SynaxError on migration.
Change History (4)
comment:1 by , 11 years ago
| Has patch: | set |
|---|---|
| Owner: | changed from to |
| Status: | new → assigned |
| Triage Stage: | Unreviewed → Accepted |
| Type: | Uncategorized → Bug |
| Version: | 1.7-beta-2 → master |
comment:2 by , 11 years ago
| Resolution: | → fixed |
|---|---|
| Status: | assigned → closed |
comment:4 by , 11 years ago
Replying to Baptiste Mispelon <bmispelon@…>:
Hi. I found something wrong in that commit:
# From tests/migrations/test_writer.py:134
one_item_tuple = ('a')
This is wrong. It should be one_item_tuple = ('a',)
Note:
See TracTickets
for help on using tickets.
I could reproduce the bug. The generated migration had a syntax error.
PR with regression test: https://github.com/django/django/pull/2700
Thanks.