filtering events

This commit is contained in:
rizwanisready
2024-03-06 22:40:53 +05:30
parent 23bae0eac9
commit 1126f3cbbe
10 changed files with 426 additions and 119 deletions

View File

@@ -106,7 +106,7 @@ class EventPrincipalInteraction(models.Model):
)
class Meta:
unique_together = ("principal", "event", "status")
unique_together = ("principal", "event")
class PrincipalPreference(BaseModel):
@@ -120,3 +120,14 @@ class PrincipalPreference(BaseModel):
class Meta:
db_table = "user_preference"
class Favorites(models.Model):
principal = models.ForeignKey(IAmPrincipal, on_delete=models.CASCADE, related_name='favorited_by')
event = models.ForeignKey(Event, on_delete=models.CASCADE, related_name='favorites')
class Meta:
unique_together = ('principal', 'event')
def __str__(self):
return f"{self.principal}'s favorite: {self.event.title}"