Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from django.db import models
- from markdownx.models import MarkdownxField
- class Tag(models.Model):
- name = models.CharField(max_length=100)
- def __str__(self):
- return self.name
- class Meta:
- db_table = 'blog_tags'
- ordering = ['name', ]
- class Post(models.Model):
- title = models.CharField(max_length=255)
- content = MarkdownxField()
- tags = models.ManyToManyField(Tag)
- draft = models.BooleanField(default=True, blank=True)
- modified = models.DateTimeField(auto_now=True)
- def __str__(self):
- return self.title
- def get_absolute_url(self):
- return '/post/%i' % self.id
- class Meta:
- db_table = 'blog_posts'
- ordering = ['-modified', ]
- class About(models.Model):
- content = MarkdownxField()
- modified = models.DateTimeField(auto_now=True)
- class Meta:
- db_table = 'about_me'
- class WhatIDoNow(models.Model):
- content = models.CharField(max_length=255)
- modified = models.DateTimeField(auto_now=True)
- class Meta:
- db_table = 'what_i_do_now'
- class Projects(models.Model):
- name = models.CharField(max_length=256)
- text = models.TextField()
- url = models.URLField()
- def __str__(self):
- return self.name
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement