Custom Django Form -


I'm trying to create a custom backend for my system and I've hit a little bit of trouble .... The ability to add new users / models / series that are not already in the system through a form. I am wondering how I will go about this ... My models are given below:

  class creator (model. Model): MANUFACTURER_POPULARITY_CHOICES = (('1', 'Primary' ), ( '2', 'secondary'), ( '3', 'tertiary')) manufacturer = models.CharField (MAX_LENGTH = 15, empty = false) DATE_ADDED = models.DateField () manufacturer_popularity = models.CharField ( MAX_LENGTH = 1, choices = MANUFACTURER_POPULARITY_CHOICES) def __unicode __ (self): return self.manufacturer class model (models.Model): model = models.CharField (MAX_LENGTH = 20, empty = false) manufacturer = models.ForeignKey DATE_ADDED (manufacturer) = Model datefield () def __unicod E __ (self): name = '' + str (self producer) + + "+ str (self. Model) return name category series (models.Model): series = model.carfield (max_length = 20, empty = True, true = True) model = model.forgin (model) date_added = models.DateField () def __unicode __ (self): name = str (self.) * + + (Str.series) return name class engine (model.model ): ENGINE_TYPE_CHOICES = (('H', 'H'), ('I', 'I'), ('R', 'R'), ('V', 'V'), 'W'),) FUEL_TYPE_CHOICES = (( 'G', 'gas'), ( 'D', 'diesel'),) size = models.DecimalField (max_digits = 2, decimal_places = 1) type = models.CharField ( MAX_LENGTH = 1, Option = ENGINE_TYPE_CHOICES) cylinders = models.PositiveSmallIntegerField () specific information = models.CharField (MAX_LENGTH = 20, blank = True, null = True) fuel_type = models.CharField (MAX_LENGTH = 1, choices = FUEL_TYPE_CHOICES) class CommonVehicle (models.Model ): year = models.ForeignKey (year) range = models.ForeignKey (series) engine = models.ForeignKey (engine) body_style = models.ForeignKey (Bodystyle) transmission = models.ForeignKey (transmission) speed = models.PositiveSmallIntegerField () drive_train = models.ForeignKey (drivetrain) horse_power = models.PositiveSmallIntegerField () litre_100km_city = models.DecimalField (max_digits = 3, decimal_places = 1) litre_100km_hwy = modern Els.DecimalField (max_digits = 3, decimal_places = 1) def __unicode __ (self) : Name = '' + str (self.year) + + "+ str (self.series) return name  

This is a standard work for a Django model form. I will suggest the following documentation. There is a detailed instruction on how to build a form from a model and then submit it back to the database submission.


Comments

Popular posts from this blog

sql - dynamically varied number of conditions in the 'where' statement using LINQ -

asp.net mvc - Dynamically Generated Ajax.BeginForm -

Debug on symbian -