-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmodels.py
32 lines (24 loc) · 931 Bytes
/
models.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
from django.db import models
# Create your models here.
class Pregunta(models.Model):
pregunta = models.CharField(max_length=255)
def __unicode__(self):
return self.pregunta
class OpcionesPreguntas(models.Model):
pregunta = models.ForeignKey(Pregunta, related_name='preguntaId')
opcion = models.CharField(max_length=255)
def __unicode__(self):
return self.opcion
class Encuesta(models.Model):
nombre = models.CharField(max_length=255)
fechaCreacion = models.DateField(auto_now=True)
preguntas = models.ManyToManyField(Pregunta, related_name='preguntas')
def __unicode__(self):
return self.nombre
class EncuestaContestada(models.Model):
encuesta = models.ForeignKey(Encuesta, related_name='encuesta')
pregunta = models.ForeignKey(Pregunta, related_name='preguntaEncuesta')
respuesta = models.CharField(max_length=255)
fechaContestacion = models.DateField()
def __unicode__(self):
return self.respuesta