example-of-crud-in-django-w.../app/libros/models.py

25 lines
638 B
Python
Raw Normal View History

2021-07-09 19:09:31 +02:00
# app/libros/models.py
2021-07-05 15:56:53 +02:00
from django.contrib.auth.models import AbstractUser
2021-07-09 19:09:31 +02:00
from django.db import models
2021-07-05 15:56:53 +02:00
class CustomUser(AbstractUser):
2021-07-09 19:09:31 +02:00
pass
class Libros(models.Model):
title = models.CharField(max_length=255)
genre = models.CharField(max_length=255)
year = models.CharField(max_length=4)
author = models.CharField(max_length=255)
created_at = models.DateTimeField(auto_now_add=True)
updated_at = models.DateTimeField(auto_now=True)
class Meta:
ordering = ("-created_at",)
verbose_name = "Libro"
verbose_name_plural = "Libros"
def __str__(self):
return self.title