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!" >-----Original Message----- >From: django-users@googlegroups.com >[mailto:django-users@googlegroups.com] On Behalf Of Anurag Baidyanath >Sent: Wednesday, June 11, 2014 10:06 PM >To: django-users@googlegroups.com >Subject: implementing a ticket submission system > >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. > > > >-- >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+unsubscr...@googlegroups.com. >To post to this group, send email to django-users@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. -- 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+unsubscr...@googlegroups.com. To post to this group, send email to django-users@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/00bf01cf85a0%246db7d720%2449278560%24%40JetBrains.com. For more options, visit https://groups.google.com/d/optout.