添加教程的API
This commit is contained in:
17
tutorial/models.py
Normal file
17
tutorial/models.py
Normal file
@@ -0,0 +1,17 @@
|
||||
from django.db import models
|
||||
from account.models import User
|
||||
|
||||
class Tutorial(models.Model):
|
||||
title = models.CharField(max_length=128)
|
||||
content = models.TextField()
|
||||
created_by = models.ForeignKey(User, on_delete=models.CASCADE)
|
||||
created_at = models.DateTimeField(auto_now_add=True)
|
||||
updated_at = models.DateTimeField(auto_now=True)
|
||||
is_public = models.BooleanField(default=False)
|
||||
order = models.IntegerField(default=0)
|
||||
|
||||
class Meta:
|
||||
ordering = ['order', '-created_at']
|
||||
|
||||
def __str__(self):
|
||||
return self.title
|
||||
Reference in New Issue
Block a user