from django.db import models from django.contrib.contenttypes.models import ContentType from django.contrib.contenttypes.fields import GenericForeignKey class Syndicate(models.Model): name = models.CharField(max_length=200) def __str__(self): return self.name class SyndicatedItem(models.Model): content_type = models.ForeignKey(ContentType, on_delete=models.CASCADE) object_id = models.PositiveIntegerField() content_object = GenericForeignKey('content_type', 'object_id') syndicate = models.ManyToManyField(Syndicate) publish_date = models.DateTimeField() STATUS = ( ('1', "Unsent"), ('2', "Sent"), ) status = models.CharField(max_length=1, choices=STATUS, null=True, blank=True) rel_link = models.CharField(max_length=300, null=True, blank=True) def __str__(self): return self.content_object.title