Hi All,

I'm just starting out with django. I want to get familiar with it to
do some inhouse development for myself. I'm following along the
tutorial, but using my own data and examples - i'm trying to create a
very simple request-ticket system. I have got up to the admin
interface part of the tutorial, and i tried to use the admin interface
to add a ticket, but i got the following error:

Environment:

Request Method: POST
Request URL: http://localhost:8000/admin/trak/ticket/add/
Django Version: 0.97-pre-SVN-unknown
Python Version: 2.5.1
Installed Applications:
   ['django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.sites',
 'mysite.trak',
 'django.contrib.admin']
Installed Middleware:
   ('django.middleware.common.CommonMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.middleware.doc.XViewMiddleware')


Traceback:
File "/usr/lib/python2.5/site-packages/django/core/handlers/base.py"
in get_response
  82.                 response = callback(request, *callback_args,
**callback_kwargs)
File "/usr/lib/python2.5/site-packages/django/contrib/admin/views/
decorators.py" in _checklogin
  56.             return view_func(request, *args, **kwargs)
File "/usr/lib/python2.5/site-packages/django/views/decorators/
cache.py" in _wrapped_view_func
  39.         response = view_func(request, *args, **kwargs)
File "/usr/lib/python2.5/site-packages/django/contrib/admin/views/
main.py" in add_stage
  266.             LogEntry.objects.log_action(request.user.id,
ContentType.objects.get_for_model(model).id, pk_value,
force_unicode(new_object), ADDITION)
File "/usr/lib/python2.5/site-packages/django/utils/encoding.py" in
force_unicode
  51.                 s = unicode(s)

Exception Type: TypeError at /admin/trak/ticket/add/
Exception Value: coercing to Unicode: need string or buffer, int found



Here is a copy of my models.py file:

from django.db import models
import datetime

# Create your models here.
class Status(models.Model):
    class Admin:
        pass
    name = models.CharField(max_length=100)
    def __unicode__(self):
        return self.name


class Submitter(models.Model):
    class Admin:
        pass
    name = models.CharField(max_length=200)
    email = models.EmailField()
    def __unicode__(self):
        return self.name

class Ticket(models.Model):
    class Admin:
        pass
    def __unicode__(self):
        return self.ticket_numb
    def was_submitted_today(self):
        return self.create_date.date() == datetime.date.today()
    summary = models.TextField()
    date_created = models.DateTimeField('date created')
    status = models.ForeignKey(Status)
    ticket_text = models.TextField()
    submitter_name = models.ForeignKey(Submitter)
    ticket_numb = models.IntegerField().

As soon as I fill in the form to add a  ticket and click the save
button, i get a django error. The funny thing is that it gets added to
the database:

mysql> select * from trak_ticket;
+----+---------+---------------------+-----------+-------------
+-------------------+-------------+
| id | summary | date_created        | status_id | ticket_text |
submitter_name_id | ticket_numb |
+----+---------+---------------------+-----------+-------------
+-------------------+-------------+
|  5 | asdf    | 2007-12-11 14:19:05 |         1 | asdf
|                 1 |           1 |
+----+---------+---------------------+-----------+-------------
+-------------------+-------------+

Whats up with it?

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to