{
"id": 3,
"title": "Python Workshop",
"location": "ALX Hub",
"start_time": "2025-08-10T10:00:00Z"
}
Then Eden RSVPs by sending this to the API:
json
Copy code
# POST /api/rsvps/
{
"event": 3,
"status": "going"
}
✅ This means Eden is going to the Python Workshop.
The RSVP
model will store:
Field | Example |
---|---|
user | Eden |
event | Python Workshop |
status | going/maybe/declined |
You can use a Django model like this:
python
Copy code
class RSVP(models.Model):
STATUS_CHOICES = [
('going', 'Going'),
('maybe', 'Maybe'),
('declined', 'Declined'),
]
user = models.ForeignKey(User, on_delete=models.CASCADE)
event = models.ForeignKey(Event, on_delete=models.CASCADE)
status = models.CharField(max_length=10, choices=STATUS_CHOICES)
class Meta:
unique_together = ['user', 'event'] # One RSVP per user per event