Defined the this model:
class ModifyGroup(models.Model):
user = models.ForeignKey(User, verbose_name='User',
related_name='group_mod_request', null=True, blank=True) #account to
be modified
date = models.DateField('Request Date', auto_now_add=True)
group_from = models.CharField('From Group(s)', max_length=100,
null=True, blank=True)#new group(s), delminter: ;
group_to = models.CharField('To Group(s)', max_length=100,
null=True, blank=True)#new group(s), delminter: ;
URL_key = models.CharField(max_length=100) #required
# choices for the field attribute status
STATUS_CHOICES =(
#('value stored', 'human readable')
('ACCEPT', 'ACCEPT'),
('REJECT', 'REJECT'),
('PENDING', 'PENDING'),
)# choices for the field attribute status
status = models.CharField('Status', max_length=10,
default='PENDING', choices=STATUS_CHOICES) #required
by_user = models.ForeignKey(User, verbose_name='By',
related_name='group_mod_request_by', null=True, blank=True) # user
requesting modification
web_account_admin = models.ForeignKey(User, verbose_name='Web
Account Administrator', related_name='group_mod_approved_by',
null=True, blank=True) # user accepted/rejected
slug = models.SlugField(null=True, blank=True, editable=False)
#required
When the data table (sqlite) is empty, I can save an instance of this
object with no errors.
However, once there is an existing instance of the object in the data
table, saving another
instance of this object results in the following error:
TypeError at /ci/userManagement/modify_request/
expected string or buffer
Request Method: POST
Request URL: http://127.0.0.1:8000/ci/userManagement/modify_request/
Exception Type: TypeError
Exception Value:
expected string or buffer
Exception Location: C:\python26\lib\re.py in findall, line 175
Python Executable: C:\python26\python.exe
Python Version: 2.6.0
Python Path: ['H:\\ci', 'C:\\python26\\lib\\site-packages\
\setuptools-0.6c9-py2.6.egg', 'C:\\python26\\lib\\site-packages\
\html5lib-0.11.1-py2.6.egg', 'C:\\python26\\lib\\site-packages\
\minimock-1.0.1dev-py2.6.egg', 'C:\\python26\\lib\\site-packages\
\pupynere-1.0.10-py2.6.egg', 'C:\\python26\\python26.zip', 'C:\
\python26\\DLLs', 'C:\\python26\\lib', 'C:\\python26\\lib\\plat-win',
'C:\\python26\\lib\\lib-tk', 'C:\\python26', 'C:\\python26\\lib\\site-
packages', 'C:\\python26\\lib\\site-packages\\PIL', 'C:\\python26\\lib\
\site-packages\\win32', 'C:\\python26\\lib\\site-packages\\win32\
\lib', 'C:\\python26\\lib\\site-packages\\Pythonwin']
Server time: Wed, 17 Jun 2009 13:35:15 -0500
Does anyone have any idea as to why ? (Complete trace follows)
Environment:
Request Method: POST
Request URL: http://127.0.0.1:8000/ci/userManagement/modify_request/
Django Version: 1.0.1 final
Python Version: 2.6.0
Installed Applications:
['django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'ci.dataManagement',
'ci.instructions',
'ci.contacts',
'ci.locations',
'ci.ships',
'django.contrib.admin',
'ci.main',
'ci.security']
Installed Middleware:
('django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware')
Traceback:
File "C:\python26\lib\site-packages\django\core\handlers\base.py" in
get_response
86. response = callback(request, *callback_args,
**callback_kwargs)
File "C:\python26\lib\site-packages\django\contrib\auth\decorators.py"
in __call__
67. return self.view_func(request, *args, **kwargs)
File "H:\ci\..\ci\security\views.py" in modify_request
1007. obj.save()
File "C:\python26\lib\site-packages\django\db\models\base.py" in save
307. self.save_base(force_insert=force_insert,
force_update=force_update)
File "C:\python26\lib\site-packages\django\db\models\base.py" in
save_base
324. signals.pre_save.send(sender=self.__class__,
instance=self, raw=raw)
File "C:\python26\lib\site-packages\django\dispatch\dispatcher.py" in
send
148. response = receiver(signal=self, sender=sender,
**named)
File "H:\ci\..\ci\urls.py" in my_handler
148. if re.findall(r'\d+$', obj.slug):
File "C:\python26\lib\re.py" in findall
175. return _compile(pattern, flags).findall(string)
Exception Type: TypeError at /ci/userManagement/modify_request/
Exception Value: expected string or buffer
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---