I have the following Tables: Ticket , Manager and Services
Ticket has information such as creation date, manager, services and more. manager that has 2 fields name and percentage. and the services table that has 2 services and price fields.
I want to create a view where I can enter the ticket data and add one or more services on the same ticket.
I already have the form to introduce responsible and services, I have the view that shows the tickets that are in the database What I have no idea is how to make a ticket have one or more services when creating the ticket
my models.py
from django.db import models
from django.core.urlresolvers import reverse
# Create your models here.
class Servicios(models.Model):
servicio = models.CharField(max_length=250)
precio = models.FloatField()
class Encargado(models.Model):
nombre = models.CharField(max_length=250)
porcentaje = models.FloatField()
class Ticket(models.Model):
fecha = models.DateTimeField(auto_now_add=True)
servicio = models.ForeignKey(Servicios)
encargado = models.ForeignKey(Encargado)
cantidad = models.IntegerField()
p_unitario = models.FloatField()
total = models.FloatField()
def get_absolute_url(self):
return reverse('Main:get-list')