Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from django.db import models
- # from django import forms
- # Create your models here.
- class Diario(models.Model):
- nombre = models.CharField(max_length=100)
- pais = models.CharField(max_length=100)
- idioma = models.CharField(max_length=100)
- def __str__(self):
- return self.nombre
- class Usuario(models.Model):
- username = models.CharField(max_length=100)
- password = models.CharField(max_length=100)
- email = models.CharField(max_length=100)
- nombre = models.CharField(max_length=100)
- apellidos = models.CharField(max_length=100)
- def __str__(self):
- return self.nombre + self.apellidos
- class Autor(models.Model):
- nombre = models.CharField(max_length=100)
- apellidos = models.CharField(max_length=100)
- email = models.CharField(max_length=100)
- def __str__(self):
- return self.nombre + self.apellidos
- class Noticia(models.Model):
- TIPO_NOTICIAS = (
- ("Deportes", "Deportes"),
- ("Cultura", "Cultura"),
- ("Politica", "Politica"),
- ("Economia", "Economia"),
- ("Actualidad", "Actualidad"),
- )
- titular = models.CharField(max_length=100)
- fecha = models.DateField()
- tipo = models.CharField(max_length=100, choices = TIPO_NOTICIAS)
- resumen = models.CharField(max_length=1000)
- usuarios = models.ManyToManyField(Usuario)
- diario = models.ForeignKey(Diario, on_delete=models.CASCADE)
- autores = models.ManyToManyField(Autor)
- def __str__(self):
- return self.titular
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement