Add: PostModel to archive app
This commit is contained in:
parent
a848667152
commit
4dd76d6ae3
1 changed files with 36 additions and 0 deletions
|
@ -1,5 +1,7 @@
|
||||||
from django.db import models
|
from django.db import models
|
||||||
|
|
||||||
|
from apps.files.models import PostFileModel
|
||||||
|
|
||||||
|
|
||||||
class SourceSiteModel(models.Model):
|
class SourceSiteModel(models.Model):
|
||||||
slug = models.CharField(max_length=64)
|
slug = models.CharField(max_length=64)
|
||||||
|
@ -47,3 +49,37 @@ class DescriptionModel(models.Model):
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return str(self.hash)
|
return str(self.hash)
|
||||||
|
class PostModel(models.Model):
|
||||||
|
post_id = models.CharField(max_length=128, db_index=True)
|
||||||
|
title = models.CharField(max_length=64)
|
||||||
|
description = models.ManyToManyField(
|
||||||
|
to=DescriptionModel, related_name="posts", through=PostDescription
|
||||||
|
)
|
||||||
|
creator = models.ForeignKey(
|
||||||
|
to=CreatorModel,
|
||||||
|
on_delete=models.CASCADE,
|
||||||
|
null=True,
|
||||||
|
blank=True,
|
||||||
|
related_name="posts",
|
||||||
|
)
|
||||||
|
source_site = models.ForeignKey(
|
||||||
|
to=SourceSiteModel, on_delete=models.CASCADE, related_name="posts"
|
||||||
|
)
|
||||||
|
category = models.ManyToManyField(to=CategoryModel, related_name="posts")
|
||||||
|
|
||||||
|
tags = models.ManyToManyField(to=TagModel, related_name="posts")
|
||||||
|
|
||||||
|
mature = models.BooleanField(default=False)
|
||||||
|
|
||||||
|
files = models.ManyToManyField(to=PostFileModel, related_name="posts")
|
||||||
|
|
||||||
|
date_created = models.DateTimeField(auto_now_add=True, editable=True)
|
||||||
|
date_imported = models.DateTimeField(auto_now_add=True, editable=True)
|
||||||
|
date_last_import = models.DateTimeField(auto_now=True, editable=True)
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
verbose_name = "Post"
|
||||||
|
verbose_name_plural = "Posts"
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
return str(self.title)
|
||||||
|
|
Loading…
Add table
Reference in a new issue