Gallery-Archivist/archivist/apps/importer/models.py

35 lines
968 B
Python

from django.db import models
from django.utils.translation import gettext_lazy as _
from apps.sites.models import Category
from apps.user.models import UserProfile
class ImportSourceURLs(models.Model):
SOURCE_TYPES = (
('C', 'Complete User'),
('P', 'Singel Post'),
)
url = models.URLField(unique=True)
category = models.ForeignKey(Category, on_delete=models.CASCADE)
added_by_user = models.ForeignKey(UserProfile, on_delete=models.CASCADE)
date_added = models.DateTimeField(auto_now_add=True, editable=True)
last_imported = models.DateTimeField(editable=True, blank=True, null=True)
source_type = models.CharField(max_length=1, choices=SOURCE_TYPES, default=None)
active = models.BooleanField(default=True)
class Meta:
verbose_name = _("Import Source URL")
verbose_name_plural = _("Import Source URLs")
def __str__(self):
return self.url