python - Create identical model in django -


i using django 1.10 mysql. willing have 2 tables in db same fields.

class ticket(models.model):     listing = models.foreignkey(listing)     ticketid = models.charfield(max_length=32)     dateofposting = models.datetimefield()     seatnumber = models.positiveintegerfield(null=true, blank=true)  class soldticket(models.model):     ### same fields here 

what best way it?

having 2 identical tables in database suggests don't need them, boolean field or foreign key job.

hovewer, if want have 2 identical models, should @ abstract models.

class abstractbase(models.model):     listing = models.foreignkey(listing)     ticketid = models.charfield(max_length=32)     ...      class meta:         abstract = true  class model1(abstractbase):     pass  class model1(abstractbase):     pass 

that way model1 , model2 have same fields.


Comments

Popular posts from this blog

java - SSE Emitter : Manage timeouts and complete() -

jquery - uncaught exception: DataTables Editor - remote hosting of code not allowed -

java - How to resolve error - package com.squareup.okhttp3 doesn't exist? -