There is this already

http://mdp.cti.depaul.edu/AlterEgo/default/show/101

I could make it more detailed if you think it is necessary.

Massimo

On Nov 3, 2:50 pm, JorgeRpo <[EMAIL PROTECTED]> wrote:
> good answer. i had the same doubt too.
>
> I just had an idea.
>
> Can you write a tutorial on how to do the exact tutorial in django
> site. (the one about poll). That surely attract users.
>
> On Nov 2, 12:23 am, mdipierro <[EMAIL PROTECTED]> wrote:
>
> > In Django:
>
> > class Poll(models.Model):
> >     question = models.CharField(max_length=200)
>
> > class Choice(models.Model):
> >     poll = models.ForeignKey(Poll)
> >     choice = models.CharField(max_length=200)
> >     votes = models.IntegerField()
>
> > p = Poll(question="What's up?")
> > p = Poll.objects.get(pk=1)
> > p.choice_set.create(choice='Not much', votes=0)
>
> > in web2py:
>
> > db.define_table('poll',SQLField('question',length=200))
> > db.define_table('choice',
> >    SQLField('poll',db.poll),
> >    SQLField('choice',length=200),
> >    SQLField('votes','integer',default=0))
>
> > poll_id=db.poll.insert(question="What's up?")
> > poll=db(db.poll.id==poll_id).select()[0]  ### poll.id == poll_id
> > db.choice.insert(poll=poll_id,choice='Not much',votes=0)
>
> > Hope this helps.
>
> > Massimo
>
> > On Nov 1, 10:08 pm, kev <[EMAIL PROTECTED]> wrote:
>
> > > Hello,
> > > I am checking out web2py after doing a little bit of django and i was
> > > wondering how you could do the following line in web2py:
>
> > > p = Poll.objects.get(pk=1)
> > > p.choice_set.create(choice='Not much', votes=0)
>
> > > What i need to know is how to go from poll to choice like django
> > > does.
>
> > > Thanks.
> > > Kev
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to