KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I'm trying to create an admin user as part of my tests.py to check on persmissions. UPDATE: The tests.py is standard format that subclasses TestCase and the code below is called in the setUp() function. I can create a normal user but not an admin user. If I try this: self.adminuser = User.objects.create_user('admin', 'admin@test.com', 'pass') self.adminuser.save() self.adminuser.is_staff = True self.adminuser.save() OR self.adminuser = User.objects.create_superuser('admin', 'admin@test.com', 'pass') self.adminuser.save() I get: Warning: Data truncated for column 'name' at row 1 If I remove the is_staff line all is well (except I can't do my test!) Do I have to load admin users as fixtures? UserProfile is defined as follows: class UserProfile(models.Model): user = models.ForeignKey(User, unique=True) organisation = models.ForeignKey(Organisation, null=True, blank=True) telephone = models.CharField(max_length=20, null=True, blank=True) and full error traceback is: Traceback (most recent call last): File "/usr/lib/python2.4/site-packages/Django-1.1.1-py2.4.egg/django/test/testcases.py", line 242, in __call__ self._pre_setup() File "/usr/lib/python2.4/site-packages/Django-1.1.1-py2.4.egg/django/test/testcases.py", line 217, in _pre_setup self._fixture_setup() File "/usr/lib/python2.4/site-packages/Django-1.1.1-py2.4.egg/django/test/testcases.py", line 440, in _fixture_setup return super(TestCase, self)._fixture_setup() File "/usr/lib/python2.4/site-packages/Django-1.1.1-py2.4.egg/django/test/testcases.py", line 222, in _fixture_setup call_command('flush', verbosity=0, interactive=False) File "/usr/lib/python2.4/site-packages/Django-1.1.1-py2.4.egg/django/core/management/__init__.py", line 166, in call_
Tags (comma-separated)
Save Edits
Cancel