Re: How to get the Exception Type

2012-05-14 Thread Luis Gonzalez
Hi as you can see here at http://docs.python.org/tutorial/errors.html in 8.3 handling exceptions theres a piece of code that works as you want. for example try this: try: int("a") except Exception as e: #The key is using "as" and the variable name you like for retrieving the exception because i

Can I use request.user, in the limit_choices_to filter in Model class?

2010-02-24 Thread Luis Gonzalez
I need to filter a field by a UserProfile function, i.e. how can I do something like this? class Paquet(models.Model): ... profiles = models.ManyToManyField(UserProfile, limit_choices_to = {'country': request.user.userprofile.country}) Thanks in advance. -- _