2013-08-08 4 views
0

두 명의 사용자 mh00h1 및 mh00h2가 있습니다. 나는 또한 내 models.py에 다음과 같은 정의 MODELA 있습니다Django, South 및 Guardian : Migrate

>>>> frhde = create modelA instance 
>>>> assign_perm('read', mh00h2, frhde) 

DoesNotExist: Permission matching query does not exist. Lookup parameters were {'codename': u'read', 'content_type': <ContentType: modelA>} 

내가 South 난 후 내 모델을 마이그레이션하지 않았다는 것을 깨달았다 : 쉘에서

class Meta: 
    permissions = (
     ('read','read'), 
     ('write','write'), 
    ) 

을, 나는 권한을 설정했다 class Meta ~ modelA을 추가하여 확인했습니다. read에서 read2으로 변경하면 South은 변경 사항을 감지하지 못합니다.

$ /manage.py schemamigration myapp --auto 

Running migrations for myapp: 
- Nothing to migrate. 
- Loading initial data for myapp. 
Installed 0 object(s) from 0 fixture(s) 
Running migrations for guardian: 
- Nothing to migrate. 
- Loading initial data for guardian. 
Installed 0 object(s) from 0 fixture(s) 

어떻게 올바르게 데이터베이스를 업데이트 schematicmigration를 얻을 수 있습니다, 또는 전체 데이터베이스를 다시 실행 필요로하지 않는이 할 수있는 더 좋은 방법은 무엇입니까?

감사합니다.

답변

1

./manage.py syncdb --all을 사용하거나 this post과 같은 신호를 만들 수 있습니다.

+1

[django-extensions] (http://django-extensions.readthedocs.org/en/latest/)의'update_permissions' 관리 명령을 사용할 수도 있습니다. – gregoltsov