fabio natali wrote: > That's right! So here comes my current urls.py: > > http://dpaste.com/72638/ > > then the traceback I get at http://localhost:8000/: > > http://dpaste.com/72639/
Oy! I've found it :-). It has nothing to do with model_view decorator or anything that we're talking here about. It's in urls.py, on line 30: (r'^$', 'current_datetime') You pass a string instead of a function. Django tries to import this name, fails and tries to call it as a function. Then you get this error because strings are not callable. > and finally the traceback I get at http://localhost:8000/manufacturer/: > > http://dpaste.com/72637/ Ok... I've finally managed to actually check what I has "invented" and it seems I was on crack... Sorry for the confusion. I've messed up building model_classes dict in two places but it doesn't matter because it can be done simpler. from django.db.models import get_model def model_view(func): def wrapper(request, *args, **kwargs): model = get_model('arteak', kwargs.pop('model')) kwargs['queryset'] = model.objects.all() return func(request, *args, **kwargs) return wrapper It happens that Django already has a registry of all models and get_model can, well, get a model from it by an app_name ('arteak') and a model_name which is passed in kwargs right out of urlconf. And model_classes code can be just thrown away. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---