/
models.py
30 lines (22 loc) · 945 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
from __future__ import unicode_literals
from django.db import models
import django
from datetime import datetime
# Create your models here.
class Item(models.Model):
noms = models.CharField(max_length=200,help_text="Els cantants que van a triomfar")
tema = models.CharField(max_length=200,help_text="Tema que cantareu")
url = models.URLField(max_length=300,help_text="Link al YouTube, Vimeo o altres")
data = models.DateTimeField( default=django.utils.timezone.now )
fet = models.BooleanField(default=False)
comentari = models.TextField(blank=True)
#ip = models.CharField(blank=True,null=True,default=get_ip(request))
def __str__(self):
return str(self.noms)+" | "+str(self.tema)
class Vot(models.Model):
item = models.ForeignKey(Item)
ip = models.CharField(max_length=20)
comentari = models.TextField(blank=True)
data = models.DateTimeField( default=django.utils.timezone.now )
def __str__(self):
return str(self.item)