That would just be short_name = "something", what you are doing is creating an object, however you aren't saving it to the database, you are just using it to pre-populate info to a model form.
On Jan 28, 4:19 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > Hello that's what I wanted but it doesn't work > ('prepopulate_short_name' is an invalid keyword argument for this > function) > > I have > player_create_name = request.GET.get('name') > tplayer = Player(prepopulate_short_name=player_create_name) > playerForm = CreatePlayerForm(instance=tplayer) > > models: > class Player(models.Model): > short_name = models.CharField(max_length=100, db_index=True) > complete_name = models.CharField(max_length=250, db_index=True) > ... > > Can you please help me? > > Luis > > On Jan 28, 10:09 pm, "Vance Dubberly" <[EMAIL PROTECTED]> wrote: > > > If I get what you are asking correctly, you are trying to pre-populate > > some fields in a form without printing out the validation errors that > > occur from not having all the fields populated? > > > If so this should help: > > > # create object instance with pre-populated data > > obj_instance = Object(prepoulate_field_key="value") > > > #create from with obj_instance > > obj_form = ObjectForm(instance=obj_instance) > > > It's not obvious or in the docs, but it's a nice mechanism. > > > Hope that helps. > > > vance > > > On Jan 28, 2008 9:47 AM, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > > > Hello, > > > > I have a view with searches for a given record (using a text field). > > > If the object does not exist show a error and a link: <a href="/ > > > create/?val=value%20%not%20found">Create</a> > > > > On the create view if GET.get('val') then I put that data in the form. > > > I want this just to make it simple for a user to enter a new object if > > > it does not exist. > > > > My problem if that django validates the form with the data I added, so > > > I get several fields with have the "not provided value" (since I did > > > not pass that data) > > > > How can I make this work? Is there some flag to tell django not > > > validate the form when I'm first creating it? > > > > Regards, > > > > Luis > > > -- > > To pretend, I actually do the thing: I have therefore only pretended to > > pretend. > > - Jacques Derrida --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---