Re: modelformset_factory and unique_together don't always validate unique fields

2014-07-03 Thread gavinwahl
I, too, struggle with this frequently. On Wednesday, July 2, 2014 9:07:04 PM UTC-6, Jon Dufresne wrote: > > I'm reporting this to the developers list as I feel this shows a > shortfall in (to me) expected behavior. I'm not sure this is exactly a > bug or simply a use case the unique validation w

Re: Modify get_or_create() to use field lookups parameters for values

2014-06-09 Thread gavinwahl
I don't think this is possible to do generally. What would count__gt=1 or pub_date__month=12 do? On Friday, June 6, 2014 3:50:08 PM UTC-6, Patrick Bregman wrote: > > Hi all, > > First of, I'm new to this list so please tell me if there's something that > can be done better. It's the best way to

Re: Making assertNumQueries more useful by printing the list of queries executed on failure

2013-11-15 Thread gavinwahl
Every time I get a failure on one of these types of tests I go in and edit the code to print out the queries that were executed. There's no way to troubleshoot the problem without know the queries. On Wednesday, November 13, 2013 11:37:43 PM UTC-7, Dominic Rodger wrote: > > Currently, when asser

Re: Feature request: New middleware method for "universal" decoration

2013-10-14 Thread gavinwahl
This topic was also discussed during the deprecation of TransactionMiddleware and the introduction of ATOMIC_REQUESTS. The existing middleware semantics can't guarantee that __exit__ (during process_response) will get called no matter what, necessitating the setting that invokes BaseHandler.ma

Re: Dynamic AUTH_USER_MODEL based on modules or routes

2013-10-10 Thread gavinwahl
> The current User model is great for admin panel users but in frontend it may become extra overhead for some cases. People try to create another user attribute models and use extra joins to be able to keep extra attributes (city, ip, locale etc.) for their users. Use the user-profile pattern<

Re: AbstractUser to get more abstract

2013-09-20 Thread gavinwahl
> The intention was to mark a particular model as a something that can be replaced. It's hard to find the original rationale behind swappable, but my mental model was always: A model with `swappable = 'x'` means that the model should only be loading if settings.x is set to that same model

Re: AbstractUser to get more abstract

2013-09-19 Thread gavinwahl
> Note that EmailUser *doesn't* have a Meta: swappable definition. There is nothing on this model that says "I am swappable", or "I am an appropriate substitute for User". Ah, this is were the misunderstanding was. authtools does actually set swappable on its replacement user, too[1]. The two d

Username Independence in Auth Forms

2013-06-03 Thread gavinwahl
Some of the built-in auth forms only work on user models whose `USERNAME_FIELD` is `username`. It is possible to remove this constraint and allow them work on any user model. [django-authtools][1] demonstrates this possibility. The two forms in question are `UserCreationForm` and `UserChangeFor

Re: RFC: "universal" view decorators

2013-06-03 Thread gavinwahl
each class that wants to use a decorator. Its implementation is simple: https://gist.github.com/gavinwahl/5694349. This is a complete implementation, and is all that's necessary to use view decorators with Django's CBVs. I use this code in all my projects with great success. [H