i’m not sure what terms python uses for objects – forgive my lack of python know how!
Effectively, how can i do this:
strToObject = {'story':Story,'post':Post}
def post(self,request):
type = request.POST['theTypeInTheForm']
id = request.POST['idInTheForm']
get_object_or_404(strToObject.get(type,None),id)
so what this is doing is taking a value from a form field, working out what type we’re talking about, and then pulling from the db the right type from the id.
I don’t quite know how to do this though. (the form is really for a rating button, so i don’t really have a whole form behind it!)
You probably want to use ContentTypes, which is a model containing all the different models defined in your app.