In trying to better wrap my head around the workings of web2py, I am
attempting to convert a Django tutorial I used a while back to learn
Django into web2py-speak. It is a series of video tutorials that walk
one through building a twitter-ish site (Start The Dark).
I am already confused about how to implement the Django style many-to-
many relationship in web2py.
The model starts out in the Django tutorial like so (this is the just
the begining):
# in models.py
from django.db import models
from datetime import datetime, timedelta
from django.contrib.auth.models import User
class Event(models.Model):
description = models.TextField()
creation_date = models.DateTimeField(default=datetime.now)
start_date = models.DateTimeField(blank=True, null=True)
creator = models.ForeignKey(User,
related_name='event_creator_set')
attendees = models.ManyToManyField(User, through='Attendance')
latest = models.BooleanField(default=True)
def __unicode__(self):
return self.description
class Attendance(models.Model):
user = models.ForeignKey(User)
event = models.ForeignKey(Event)
registration_date = models.DateTimeField(default=datetime.now)
def __unicode__(self):
return u"%s is attending %s" % (self.username, self.event)
The ultimate result at the end of the tutorial series is a site where
users can post one event per day and other users can "attend" events
I left out some of the requirements here like the custom managers and
querysets.
for clarity and brevity.
How would I do this in web2py, assuming i wanted to use the auth_user
table for users?
Once I figure out how, I would like to do the whole project w/
screencasts. I think it will help my understanding a lot and it might
make a nice learning guide for others coming from Django
Thanks,
__future__
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---