On Nov 11, 4:46 pm, phred78 <[EMAIL PROTECTED]> wrote:
> I see what you mean. But if I change the view:
>
> def ecard_preview(request):
>     ecard_id = request.GET.get('ecard').encode('utf8')
>     (...)
>
> So that it gets the value from the url: /ecards/preview/?
> ecard=1&sender_name(...), I get this error when submitting:
>
> ValueError at /ecards/save/
> Cannot assign "1": "Ecards.ecard" must be a "EcardsFiles" instance.
>
> And I can't load the swf file from EcardsFiles to the template :(

Sorry, I hadn't looked closely enough at the models to realise that it
was a foreignkey.
I think if you change the form field name from ecard to ecard_id it
might work. Or try keeping it at ecard but use a ModelChoiceField
instead of an IntegerField.

I must say though, I'm not really sure I understand your workflow
here. You request a page at /preview/x/, so x is the pk of a
previously-existing instance in the EcardFiles table. The Flash object
is populated using the values you pass in from the GET parameters, but
I don't see how these get to the URL in the first place or how they
relate to the existing instance. On submit you POST to a different URL
and save the result to a new Ecards instance.

I think you might be over-engineering this a bit. Rather than use the
GET parameters to pass things between Flash and Django, why not get
the javascript to populate the hidden fields directly? Then you can
just POST the result and save it as normal. Would that work?

(Plus, and I'm sure you know this, the 'translations' of the Submit
button don't say the same things in the other languages - for example
the Swedish one is marked Anna Frida, one of the girls from ABBA...
Just in case someone was playing a trick on you and you were using
them in good faith!)
--
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