ekatsah / proj402

Source code of cerkinfo's courses plateform
cours.cerkinfo.be
8 stars 6 forks source link

Impossible to add an admin in cli (due to ACL) #101

Open C4ptainCrunch opened 12 years ago

C4ptainCrunch commented 12 years ago

On a (fresh) local install

$ ./manage.py shell
Python 2.7.1 (r271:86832, Jun 25 2011, 05:09:01) 
[GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>> from django.contrib.auth.models import User
>>> u = User.objects.get(pk=1)
>>> from users.models import PERM_LIST, Permission
>>> for p in PERM_LIST: Permission.objects.create(name=p, user=u)
... 
Traceback (most recent call last):
  File "<console>", line 1, in <module>
  File "/Users/nikitamarchant/Code/proj402/ve/lib/python2.7/site-packages/django/db/models/manager.py", line 137, in create
    return self.get_query_set().create(**kwargs)
  File "/Users/nikitamarchant/Code/proj402/ve/lib/python2.7/site-packages/django/db/models/query.py", line 377, in create
    obj.save(force_insert=True, using=self.db)
  File "/Users/nikitamarchant/Code/proj402/ve/lib/python2.7/site-packages/django/db/models/base.py", line 463, in save
    self.save_base(using=using, force_insert=force_insert, force_update=force_update)
  File "/Users/nikitamarchant/Code/proj402/ve/lib/python2.7/site-packages/django/db/models/base.py", line 551, in save_base
    result = manager._insert([self], fields=fields, return_id=update_pk, using=using, raw=raw)
  File "/Users/nikitamarchant/Code/proj402/ve/lib/python2.7/site-packages/django/db/models/manager.py", line 203, in _insert
    return insert_query(self.model, objs, fields, **kwargs)
  File "/Users/nikitamarchant/Code/proj402/ve/lib/python2.7/site-packages/django/db/models/query.py", line 1576, in insert_query
    return query.get_compiler(using=using).execute_sql(return_id)
  File "/Users/nikitamarchant/Code/proj402/ve/lib/python2.7/site-packages/django/db/models/sql/compiler.py", line 910, in execute_sql
    cursor.execute(sql, params)
  File "/Users/nikitamarchant/Code/proj402/ve/lib/python2.7/site-packages/django/db/backends/util.py", line 40, in execute
    return self.cursor.execute(sql, params)
  File "/Users/nikitamarchant/Code/proj402/ve/lib/python2.7/site-packages/django/db/backends/sqlite3/base.py", line 337, in execute
    return Database.Cursor.execute(self, query, params)
IntegrityError: users_permission.object_id may not be NULL
>>>