Advertisement
Guest User

Untitled

a guest
Jan 11th, 2017
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.28 KB | None | 0 0
  1. from django.db import models
  2. from markdownx.models import MarkdownxField
  3.  
  4.  
  5. class Tag(models.Model):
  6.     name = models.CharField(max_length=100)
  7.  
  8.     def __str__(self):
  9.         return self.name
  10.  
  11.     class Meta:
  12.         db_table = 'blog_tags'
  13.         ordering = ['name', ]
  14.  
  15.  
  16. class Post(models.Model):
  17.     title = models.CharField(max_length=255)
  18.     content = MarkdownxField()
  19.     tags = models.ManyToManyField(Tag)
  20.     draft = models.BooleanField(default=True, blank=True)
  21.     modified = models.DateTimeField(auto_now=True)
  22.  
  23.     def __str__(self):
  24.         return self.title
  25.  
  26.     def get_absolute_url(self):
  27.         return '/post/%i' % self.id
  28.  
  29.     class Meta:
  30.         db_table = 'blog_posts'
  31.         ordering = ['-modified', ]
  32.  
  33.  
  34. class About(models.Model):
  35.     content = MarkdownxField()
  36.     modified = models.DateTimeField(auto_now=True)
  37.  
  38.     class Meta:
  39.         db_table = 'about_me'
  40.  
  41.  
  42. class WhatIDoNow(models.Model):
  43.     content = models.CharField(max_length=255)
  44.     modified = models.DateTimeField(auto_now=True)
  45.  
  46.     class Meta:
  47.         db_table = 'what_i_do_now'
  48.  
  49.  
  50.  
  51.  
  52. class Projects(models.Model):
  53.     name = models.CharField(max_length=256)
  54.     text = models.TextField()
  55.     url = models.URLField()
  56.  
  57.     def __str__(self):
  58.         return self.name
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement