んにゃぴ


テストーーー

python manage.py runsever

python manage.py runsever

python manage.py runservdr

from django.db import models
from markdown import markdown

# Create your models here.
class Language(models.Model):
    name = models.CharField(max_length=20, unique=True)

    def __str__(self):
        return self.name

class Category(models.Model):
    language =  models.ForeignKey(Language, on_delete=models.PROTECT)
    name = models.CharField(max_length=100, unique=True)

    def __str__(self):
        return self.name

class Tag(models.Model):
    language =  models.ForeignKey(Language, on_delete=models.PROTECT)
    category =  models.ForeignKey(Category, on_delete=models.PROTECT)
    name = models.CharField(max_length=100, unique=True)

    def __str__(self):
        return self.name

class Post(models.Model):
    language =  models.ForeignKey(Language, on_delete=models.PROTECT)
    title = models.CharField(max_length=100, unique=True)
    text = models.TextField()
    category =  models.ForeignKey(Category, on_delete=models.PROTECT)
    tag =  models.ForeignKey(Tag, on_delete=models.PROTECT)
    relation = models.ManyToManyField('self', blank=True)
    status = models.BooleanField(verbose_name='published', default=False)

    def __str__(self):
        return self.title

    def markdown(self):
        return markdown(self.text, safe_mode='escape', extensions=['toc', 'fenced_code', 'codehilite' ])

from django.db import models
from markdown import markdown

# Create your models here.
class Language(models.Model):
    name = models.CharField(max_length=20, unique=True)

    def __str__(self):
        return self.name

class Category(models.Model):
    language =  models.ForeignKey(Language, on_delete=models.PROTECT)
    name = models.CharField(max_length=100, unique=True)

    def __str__(self):
        return self.name

class Tag(models.Model):
    language =  models.ForeignKey(Language, on_delete=models.PROTECT)
    category =  models.ForeignKey(Category, on_delete=models.PROTECT)
    name = models.CharField(max_length=100, unique=True)

    def __str__(self):
        return self.name

class Post(models.Model):
    language =  models.ForeignKey(Language, on_delete=models.PROTECT)
    title = models.CharField(max_length=100, unique=True)
    text = models.TextField()
    category =  models.ForeignKey(Category, on_delete=models.PROTECT)
    tag =  models.ForeignKey(Tag, on_delete=models.PROTECT)
    relation = models.ManyToManyField('self', blank=True)
    status = models.BooleanField(verbose_name='published', default=False)

    def __str__(self):
        return self.title

    def markdown(self):
        return markdown(self.text, safe_mode='escape', extensions=['toc', 'fenced_code', 'codehilite' ])