Skip to content

Instantly share code, notes, and snippets.

@sdcasas
Last active December 5, 2018 16:17
Show Gist options
  • Save sdcasas/a5e9e386f8ac885d1502058a702dad13 to your computer and use it in GitHub Desktop.
Save sdcasas/a5e9e386f8ac885d1502058a702dad13 to your computer and use it in GitHub Desktop.

Revisions

  1. sdcasas revised this gist Dec 5, 2018. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion django_orm.py
    Original file line number Diff line number Diff line change
    @@ -12,5 +12,5 @@ class ProyectoEstado(models.Model):
    pc = Sesion.objects.get(pk = 1)

    ProyectoEstado.objects.create(
    fecha_cambio_estado = pc.sesion.fecha + pc.sesion.hora,
    fecha_cambio_estado = pc.sesion.fecha + pc.sesion.hora, # error
    )
  2. sdcasas renamed this gist Dec 5, 2018. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  3. sdcasas renamed this gist Dec 5, 2018. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  4. sdcasas created this gist Dec 5, 2018.
    16 changes: 16 additions & 0 deletions django orm
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,16 @@
    # django orm DateTimeField = DateField +TimeField

    # models.py
    class Sesion(models.Model):
    fecha = models.DateField(null=True, blank=True)
    hora = models.TimeField(null=True, blank=True)

    class ProyectoEstado(models.Model):
    fecha_cambio_estado = models.DateTimeField()

    # shell
    pc = Sesion.objects.get(pk = 1)

    ProyectoEstado.objects.create(
    fecha_cambio_estado = pc.sesion.fecha + pc.sesion.hora,
    )