Hello,

I'm no pro about this yet.
But probably you need to explicitly use the object as follows:

If you don't use the primary key (default = id), you must first
retrieve the object:
objectA = ObjectA.objects.get(name = ...)
then you can use it:
objectB = ...(... , fk_to_ObjectA = objectA)

using the primary key you can go directly:
objectB = ...(..., fk_to_objectA = pk_value)

in your case:
foto = Photo.objects.create(photo_name = "...", category =
Category.objects.get(name = request.POST['name'])
while you can use foto = Photo.objects.create(photo_name = "...",
category = request.POST['id'])

Don't know if this is exactly what you are asking, but it should help
out.

Regards,
Maarten

hern42 schreef:
> Hello,
> I have an issue (it might be a beginner issue, if so I am sorry...
> please point to the chapter in the doc)
>
> I have a class Photo and a class Category with a one to many
> relationship (many pictures can be in one category, but each photo can
> be in only one category)...
> I want to do an app for mysite/photo/category/OneCategory/ and have
> all picture in OneCategory... Nothing fancy.
> So far I managed to do it with mysite/photo/category/1 or 2 or n, n
> being the category.id but never with the actual name of the
> category...
>
> What am I missing?
> I am pretty sure it is quite dumb but cannot find it...
>
> Best regards,
> H
--~--~---------~--~----~------------~-------~--~----~
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