models.py 758 B

1234567891011121314151617181920212223242526272829303132333435
  1. from django.db import models
  2. class Link(models.Model):
  3. key = models.SlugField(
  4. verbose_name="Nombre clave",
  5. max_length=100,
  6. unique=True)
  7. name = models.CharField(
  8. verbose_name="Red social",
  9. max_length=200)
  10. url = models.URLField(
  11. verbose_name="Enlace",
  12. max_length=200,
  13. null=True,
  14. blank=True)
  15. created = models.DateTimeField(
  16. auto_now_add=True,
  17. verbose_name='Fecha de creación')
  18. updated = models.DateTimeField(
  19. auto_now=True,
  20. verbose_name='Fecha de modificación')
  21. class Meta:
  22. verbose_name = 'enlace'
  23. verbose_name_plural = 'enlaces'
  24. ordering = ["name"]
  25. def __str__(self):
  26. return self.name