Exemplo n.º 1
0
class SimulacionCultivo(models.Model):
    nombreSimulacionCultivo = models.CharField(max_length=30)
    fechaSiembra = models.DateField()
    fc = models.ManyToOneRel(FactorControlable)
    ca = models.ManyToOneRel(CondicionAnual)
    dc = models.ManyToOneRel(DensidadCañera)
    mg = models.ManyToManyRel(MaterialGenetico)
Exemplo n.º 2
0
class Book(models.Model):
    title = models.CharField(max_length=100)
    authors = models.ManyToManyRel(Author)
    publisher = models.ForeignKey(Publisher)
    publication_date = models.DateField()

    def __unicode__(self):
        return self.title
Exemplo n.º 3
0
class Articulo(models.Model):
    Titulo = models.CharField(max_length=150)
    cualquiera = models.CharField(max_length=150)
    Contenido = models.TextField()
    fecha = models.DateField(auto_now=True)
    categoria = models.ManyToManyRel(Categorias)

    def __unicode__(self):
        return "->%s " % (self.Titulo)
Exemplo n.º 4
0
class Projeto(models.Model):
    descricao = models.CharField(max_length=255)
    data_inicial = models.DateField()
    prazo_previsto = models.DateField()
    administrador = models.ForeignKey('Perfil',
                                      related_name="administradores",
                                      on_delete=models.CASCADE)
    membros = models.ManyToManyRel('Perfil', through='Usuario_Projeto', to="")
    def __str__(self):
        return "Projeto: %s | Dt. Inicial: %s" % (self.descricao, self.data_inicial)
 def test_many_to_many_relation(self):
     field = models.ManyToManyRel(
         models.ForeignKey(Project, on_delete=models.CASCADE), Project,
         "projects")
     field.related_model = (
         Project  # set this manually because django does not initialize the model
     )
     input_field = get_input_field(field, _registry)
     self.assertTrue(isinstance(input_field, graphene.List))
     self.assertEqual(input_field.of_type._meta.name, "ID")  # type:ignore
Exemplo n.º 6
0
class SharingTokens(models.Model):
    '''
  Class to allow you to create a project sharing token
  that allows a user to let others see a private project.
  '''
    token = models.CharField(max_length=64)
    issued_by = models.ForeignKey(
        User, 'username')  # Many-to-one . Many here, other in auth_user
    project_name = models.ManyToManyRel(to=BuildGraphModel,
                                        related_name='project_name')
    issue_date = models.DateTimeField(auto_now_add=True)
    expire_date = models.DateField(null=True)
Exemplo n.º 7
0
class Group(models.Model):
    id = models.AutoField(primary_key=True)

    name = models.CharField(db_column="name", max_length=64, blank=False)
    email = models.CharField(db_column="email", max_length=128, blank=True)
    site = models.CharField(db_column="site", max_length=128, blank=False)
    lead = models.OneToOneField(Person)
    team = models.ManyToManyRel(Person)
    owner = models.OneToOneField(Company)

    def __str__(self):
        return self.name
Exemplo n.º 8
0
class SimulacionCultivo(models.Model):
    nombreSimulacionCultivo = models.CharField(max_length=50)
    fechaDeSiembra = models.DateField()
    fechaDeSimulacion = models.DateField()
    fc = models.ManyToOneRel(FactorControlable)
    ca = models.ManyToOneRel(CondicionAnual)
    dc = models.ManyToOneRel(DensidadCañera)
    mg = models.ManyToOneRel(MaterialGenetico)
    pyenp = models.ManyToManyRel(PlagaYEnfermedadDeLaPlanta)

    def getiter(self):
        return iter(self.from_db(self))

    def __str__(self):
        return self.nombreSimulacionCultivo

    def __get_FIELD_display(self, field):
        return super()._get_FIELD_display(field)
Exemplo n.º 9
0
 def __init__(
     self,
     to,
     db_constraint=True,
     swappable=True,
     related_name=None,
     related_query_name=None,
     limit_choices_to=None,
     symmetrical=None,
     through=None,
     through_fields=None,
     db_table=None,
     **kwargs,
 ):
     try:
         to._meta
     except AttributeError:
         to = str(to)
     kwargs["rel"] = models.ManyToManyRel(
         self,
         to,
         related_name=related_name,
         related_query_name=related_query_name,
         limit_choices_to=limit_choices_to,
         symmetrical=symmetrical
         if symmetrical is not None
         else (to == RECURSIVE_RELATIONSHIP_CONSTANT),
         through=through,
         through_fields=through_fields,
         db_constraint=db_constraint,
     )
     self.swappable = swappable
     self.db_table = db_table
     if kwargs["rel"].through is not None and self.db_table is not None:
         raise ValueError(
             "Cannot specify a db_table if an intermediary model is used."
         )
     super().__init__(
         related_name=related_name,
         related_query_name=related_query_name,
         limit_choices_to=limit_choices_to,
         **kwargs,
     )
Exemplo n.º 10
0
class partRoutes(models.Model):
    PartCode = models.ManyToManyRel(partNumb)
    BOM = models.ManyToManyRel(partBom)
    MaPros = models.ManyToManyRel(maqPros)
    Version = models.IntegerField(null=False)
Exemplo n.º 11
0
class partBom(models.Model):
    PartCode = models.OneToOneRel(partNumb, on_delete=models.CASCADE())
    Descipcion = models.CharField(max_length=200)
    Version = models.IntegerField(null=False)
    Fecha = models.DateField(null=False)
    Componentes = models.ManyToManyRel()
Exemplo n.º 12
0
 def __init__(self, *args, **kwargs):
     super(ProductAdminForm, self).__init__(*args, **kwargs)
     rel = models.ManyToManyRel(Product, 'id')
     self.fields['pack_product'].widget = widgets.RelatedFieldWidgetWrapper(
         self.fields['pack_product'].widget, rel, self.admin_site)
Exemplo n.º 13
0
class Room(models.Model):
    users = models.ManyToManyRel(to=User, field='id')
Exemplo n.º 14
0
class Project(models.Model):
    creation_date = models.DateField()
    project = models.ManyToManyRel()
Exemplo n.º 15
0
class ManejoDelSuelo(models.Model):
    muestreo = models.CharField(max_length=200)
    recuperacion = models.BooleanField()
    espaciamiento = models.ForeignKey(Categorizacion)
    fertilizante = models.ManyToManyRel(Fertilizante)