lowercase alphanumeric usernames

2011-10-27 Thread Andrew Marder
Dear Django Users, I want to restrict usernames to be lowercase alphanumeric characters like this: def clean_username(username): return re.sub(r'\W', '', username).lower() Now, I'm not sure where is best to do this. I thought it might be clever to do this using middleware like this: def

Re: using signals to add users to a group

2011-07-19 Thread Andrew Marder
Hi Shawn, I've pasted the traceback below, I need to write some more tests to give you better information. Andrew $ python manage.py test user_management Creating test database for alias 'default'... ..F == FAIL:

using signals to add users to a group

2011-07-18 Thread Andrew Marder
Dear Django Users, I want to add users to a particular group based on the domain of their email address. I set up some code in models.py to do this and it seems to work. But, when I go to test the code things don't work out so smoothly. I think in the test environment the objects I try to create

Re: Mongo - testing

2011-01-22 Thread Andrew Marder
com> wrote: > On 20 January 2011 22:26, Andrew Marder <andrew.ei.mar...@gmail.com> wrote: > > > Has anyone had any luck setting up testing databases with mongo? Right > > now I'm using pymongo in a single app, and I thought it would be cool > > if in that app I c

Mongo - testing

2011-01-20 Thread Andrew Marder
Has anyone had any luck setting up testing databases with mongo? Right now I'm using pymongo in a single app, and I thought it would be cool if in that app I could see if my code was being tested and in that case I could use a different database. Problem is there doesn't seem to be an environment

Re: script adding FileField, no attribute chunks

2010-12-01 Thread Andrew Marder
Awesome! Thanks so much for the help. Andrew On Wed, 2010-12-01 at 12:32 +, Tom Evans wrote: > On Wed, Dec 1, 2010 at 12:23 PM, Andrew Marder > <andrew.n.mar...@gmail.com> wrote: > > I'm trying to add a bunch of files from disk into my django database. > > Here's

Re: script adding FileField, no attribute chunks

2010-12-01 Thread Andrew Marder
I'm trying to add a bunch of files from disk into my django database. Here's the helper function I've written so far: def django_file(path, field_name, content_type): # adapted from here: http://groups.google.com/group/django-users/browse_thread/thread/834f988876ff3c45/ from

get object qs with generic relation

2010-09-11 Thread Andrew Marder
Dear Django users, I have a tagging system that uses a GenericForeignKey to assign tags to generic objects. I would like to write a function that given a model and a list of tags returns a QuerySet containing all instances of that model that have been given those tags. I'm not a huge fan of