implementing a ticket submission system

34 views
Skip to first unread message

Anurag Baidyanath

unread,
Jun 11, 2014, 2:05:57 PM6/11/14
to django...@googlegroups.com
i am implementing a ticket submission system whose model.py file looks loke this:
class Ticket(models.Model):
    user_id=models.ForeignKey(User)
    category_id=models.ForeignKey(Category)
    subject=models.CharField(max_length=100)
    message=models.TextField(help_text="enter message")
    ticket_id=models.IntegerField(help_text="enter tid",unique=True)
    created_date_time=models.DateTimeField(auto_now_add=True)
    overdue_date_time=models.DateTimeField(auto_now_add=True)
    closed_date_time=models.DateTimeField(auto_now_add=True)
    status=models.IntegerField(help_text="enter status",default=0)
    reopened_date_time=models.DateTimeField(auto_now_add=True)
    topic_priority=models.IntegerField(help_text="enter priority",default=1)
    duration_for_reply=models.IntegerField(help_text="enter duration for reply",default=24)

i need to take the data submitted by the user(message and subject); and generate the ticket_id dynamically for each ticket. Then the data has to be saved into the database. please suggest an approach for this.

Ilya Kazakevich

unread,
Jun 11, 2014, 2:10:59 PM6/11/14
to django...@googlegroups.com
Hello,

Use Primary Key: https://docs.djangoproject.com/en/dev/topics/db/models/#automatic-primary-key-fields


Ilya Kazakevich,
JetBrains PyCharm (Best Python/Django IDE)
http://www.jetbrains.com/pycharm/
"Develop with pleasure!"
>--
>You received this message because you are subscribed to the Google Groups
>"Django users" group.
>To unsubscribe from this group and stop receiving emails from it, send an email
>to django-users...@googlegroups.com.
>To post to this group, send email to django...@googlegroups.com.
>Visit this group at http://groups.google.com/group/django-users.
>To view this discussion on the web visit
>https://groups.google.com/d/msgid/django-users/557b5a43-536b-4051-b80c-13f
>006a688dd%40googlegroups.com
><https://groups.google.com/d/msgid/django-users/557b5a43-536b-4051-b80c-1
>3f006a688dd%40googlegroups.com?utm_medium=email&utm_source=footer> .
>For more options, visit https://groups.google.com/d/optout.


Anurag Baidyanath

unread,
Jun 13, 2014, 7:22:28 AM6/13/14
to django...@googlegroups.com, ilya.ka...@jetbrains.com
Thanks!
it solved the problem
Reply all
Reply to author
Forward
0 new messages