demo-hackernews-with-django.../app/api/models.py
Andros Fenollosa a901b8d54a Add API
2021-06-22 15:43:26 +02:00

16 lines
375 B
Python

from django.db import models
class News(models.Model):
title = models.CharField(max_length=50)
url = models.CharField(max_length=500)
votes = models.IntegerField(default=0)
created = models.DateTimeField(auto_now_add=True)
class Meta:
verbose_name = "News"
verbose_name_plural = "News"
def __str__(self):
return self.title