No problem. Take a look at this as well: http://code.google.com/appengine/articles/djangoforms.html
On Sep 25, 2:08 am, Peter <[EMAIL PROTECTED]> wrote: > That looks solid. I'll give it a go > > Thanks for helping a newbie! > Pete > > On Sep 25, 6:04 am, iceanfire <[EMAIL PROTECTED]> wrote: > > > I'm no Django expert, but here's what I do. > > Use 'exclude' to exclude stuff: > > class Message Form(djangoforms.ModelForm): > > class Meta: > > model = Message > > exclude = ['by', 'chat'] > > > Then under the post method of the class that receives the submitted > > data add: > > > data = RealgroupForm(data=self.request.POST) > > if data.is_valid(): > > entity = data.save(commit=False) > > entity.by = users.get_current_user() > > entity.chat = .. you get the idea > > entity.put() > > self.redirect('/message?message="sent") > > else: > > self.redirect...data invalid > > > On Sep 24, 4:59 pm, Peter <[EMAIL PROTECTED]> wrote: > > > > Hi folks, > > > I'm trying to write a basic chat application. > > > > my models currently look like > > > > *********** > > > # models.py > > > > from google.appengine.ext import db > > > > class Chat(db.Model): > > > name = db.StringProperty > > > > class User(db.Model): > > > name = db.StringProperty() > > > ip = db.StringProperty() > > > > class Message(db.Model): > > > chat = db.ReferenceProperty(Chat, required=True, > > > collection_name='chat') > > > by = db.ReferenceProperty(User, required=True, > > > collection_name='by') > > > date = db.DateTimeProperty(auto_now_add=True) > > > message = db.StringProperty(multiline=True) > > > > from google.appengine.ext.db import djangoforms > > > #from django import newforms as forms > > > > class MessageForm(djangoforms.ModelForm): > > > class Meta: > > > model = Message > > > > *********** > > > > What I want is to have the message itself submitted via the form, > > > but to populate the 'by' and 'chat' parameters. > > > > I figure the form will submit some sort of chatId and userId. I'll > > > need to map those across to User and Chat models. Add them to the > > > Message model, and then I'm ready to save. > > > > How should I go about this? > > > > Cheers, > > > Peter --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google App Engine" group. To post to this group, send email to google-appengine@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en -~----------~----~----~----~------~----~------~--~---