from django.db import models from django.contrib.auth.models import User from django.db.models.signals import post_save from django.dispatch import receiver from sites.furaffinity.models import FA_Submission class UserProfile(models.Model): MATURE = [ ("H", "Hide"), ("B", "Blur"), ("S", "Show"), ] user = models.OneToOneField(User, on_delete=models.CASCADE, primary_key=True, unique=True) show_mature = models.CharField(max_length=2, choices=MATURE, default=MATURE[0][0]) class SeenPost(models.Model): user = models.ForeignKey(UserProfile, on_delete=models.CASCADE) post = models.ForeignKey(FA_Submission, on_delete=models.CASCADE) timestamp = models.DateTimeField(auto_now_add=True) #receiver(post_save, sender=User) #def create_user_profile(sender, instance, created, **kwargs): # if created: # UserProfile.objects.create(user=instance) #@receiver(post_save, sender=User) #def save_user_profile(sender, instance, **kwargs): # instance.user.save()