On 3 Feb, 07:04, "Jack Oswald" <[EMAIL PROTECTED]> wrote:
> I have just created my first, very simple, Django app.  Using the URL as a
> way to pass in parameters, I capture information and use a template to
> create an iCal file.  I intend to put this up on the web to allow anyone who
> wants to add a link to a web page (especially static pages) a link that
> returns a properly formatted iCal file so page visitors can get a scheduled
> item into their calendar easily.
>
> The challenge that I ran into is this.  I was easily able to capture the
> values I needed from the URL and have them passed into the View function.
> In addition to rendering the template and  passing it back to the browser I
> want to capture the passed in parameters in a database.  The only way I
> could get this to work was to create an empty instance of the database model
> and then set each field value one at a time from the passed in parameters
> from the URL.  I was surprised that I could not simply do the following:
>
> Def makeicalEvent(request, summary, location, start_date, start_time, ...)
>
> p = icalEvent(summary, location, start_date, start_time, ...)
>
> and have it create a new instance and fill the field values.  I tried adding
> an __init__ function to the model but that didn't work either.  What did
> work was this:
>
> p= icalEvent()
> p.summary = summary
> p.location = location
> ...
>
> Seems odd to me.
>
> Jack

You can use keyword arguments:
p = icalEvent(summary=summary, location=location,
start_date=start_date, start_time=start_time, ...)

--
DR
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django 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/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to