Changeset be7c915


Ignore:
Timestamp:
Dec 12, 2011, 3:40:10 AM (14 years ago)
Author:
Alex Dehnert <adehnert@…>
Branches:
master, space-access, stable, stage
Children:
1ffd96e
Parents:
4d6fe00
git-author:
Alex Dehnert <adehnert@…> (12/12/11 03:40:10)
git-committer:
Alex Dehnert <adehnert@…> (12/12/11 03:40:10)
Message:

Make the migrations work on a new install

Apparently ContentTypes? and permissions aren't created until after Django
finishes. This is fine if you installed early before we had migrations
using those. However, if you installed later, your ContentTypes? wouldn't
be created until too late. (Naive get_or_create doesn't work, because you end
up with ContentTypes? without a reasonable name.)

Location:
asadb/groups/migrations
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • asadb/groups/migrations/0006_add_group_perms.py

    r2dd6045 rbe7c915  
    1414    def forwards(self, orm):
    1515        "Write your forwards methods here."
     16        # Create the various contenttypes and permissions and stuff
     17        # Otherwise the we'll end with a group without a name
     18        # http://groups.google.com/group/south-users/browse_thread/thread/666994cabad1a185?pli=1
     19        db.send_pending_create_signals()
     20
    1621        # See http://stackoverflow.com/questions/1742021/adding-new-custom-permissions-in-django#answer-6149593
    1722        ct, created = orm['contenttypes.ContentType'].objects.get_or_create(model='group', app_label='groups') # model must be lowercase!
  • asadb/groups/migrations/0014_recognize_nge_perm.py

    r191ec87 rbe7c915  
    2424    def forwards(self, orm):
    2525        "Write your forwards methods here."
     26        # Create the various contenttypes and permissions and stuff
     27        # Otherwise the permission stuff will fail horribly
     28        # http://groups.google.com/group/south-users/browse_thread/thread/666994cabad1a185?pli=1
     29        db.send_pending_create_signals()
     30
    2631        util.migrations.migrate_perms_forwards(orm, self.new_perms, )
    2732        util.migrations.migrate_groups_forwards(orm, self.new_auth_groups, )
  • asadb/groups/migrations/0016_create_auth_groups.py

    r29a7eca rbe7c915  
    7474
    7575class Migration(DataMigration):
     76
     77    depends_on = (
     78        ("forms", "0001_initial", ),
     79    )
     80
    7681    def forwards(self, orm):
    7782        "Write your forwards methods here."
     83        db.send_pending_create_signals()
    7884        util.migrations.migrate_groups_forwards(orm, auth_groups, )
    7985        user_manager = django.contrib.auth.models.User.objects
Note: See TracChangeset for help on using the changeset viewer.