Re: Revisiting the case-sensitive login for the default user manager

2014-12-20 Thread Collin Anderson
Hi Roman, That might be good enough, as long as you don't have any name conflicts already. Just make sure it prevents new users from signing up with a different case of an existing username. Collin On Friday, December 19, 2014 10:53:23 AM UTC-5, Roman Onosovski wrote: > > Hello fellow Djangoer

Re: Raw access to cache table

2014-12-20 Thread Collin Anderson
Hi Erik, If you want a nicer interface, I just ran manage.py inspecdb on one of my databases and got this for the cache table. Not sure why django still does it by hand. class Cache(models.Model): cache_key = models.CharField(primary_key=True, max_length=255) value = models.TextField()

Where to put my bugfix tests?

2014-12-20 Thread Андрей Маслов
Hello everyone. I decided to make my first bugfix :) Ticket: https://code.djangoproject.com/ticket/24008 And I have a question for where to put my tests? Should I create a new file? Or take already written and add my code (unfortunately I did not find anything related to ValidationError testing)

Re: Random row

2014-12-20 Thread Dariusz Mysior
I change it on import csv, random def new_name(): with open('PL_surnames.csv', newline='') as csvfile: namesreader = csv.reader(csvfile, delimiter=' ', quotechar='|') random_choice=random.choice(namesreader) return random_choice print(new_name()) No I have thi

Re: ModelAdmin with inlines: How to learn if/what has changed before the models are saved?

2014-12-20 Thread Alex Haylock
On 18/12/14 17:19, Carsten Fuchs wrote: > I would like to find out if anything has changed in the parent > model or the related (inline) models, and depending on the result, > update one of the parent model's fields before it is saved. > > Can you please tell me how can this be achieved? Take a

Re: Random row

2014-12-20 Thread Cal Leeming
Doh sorry, hit return too quickly. return random.choice(namesreader) On Sat, Dec 20, 2014 at 9:42 PM, Cal Leeming wrote: > Somewhat off-topic for django-users, this would have been better placed on > StackOverflow. > > If I understood your question correctly, I think you need to remove the > "f

Re: Random row

2014-12-20 Thread m1chael
you keep overwriting your random_choice every time the loop is run, getting the last result is expected On Sat, Dec 20, 2014 at 4:37 PM, Dariusz Mysior wrote: > Why I get only last row from my csv file, why I don't get in any time ranom > row :/ > > import csv, random > > def new_name(): > w

Re: Random row

2014-12-20 Thread Cal Leeming
Somewhat off-topic for django-users, this would have been better placed on StackOverflow. If I understood your question correctly, I think you need to remove the "for row in namesreader" and replace with; namesreader = csv.reader(csvfile, delimiter=' ', quotechar='|') return random.choice(row) O

Random row

2014-12-20 Thread Dariusz Mysior
Why I get only last row from my csv file, why I don't get in any time ranom row :/ import csv, random def new_name(): with open('PL_surnames.csv', newline='') as csvfile: namesreader = csv.reader(csvfile, delimiter=' ', quotechar='|') for row in namesreader: #print (

(yet another) Custom templatetag raising KeyError when DEBUG=False

2014-12-20 Thread Alexandre Provencio
Hello all, this is a cross post i made on stackoverflow http://stackoverflow.com/questions/27503581/yet-another-custom-templatetag-raising-keyerror-when-debug-false I'm trying to use a custom templatetag (this one actually: https://djangosnippets.org/snippets/2875/), on my project which works fine

Re: Database queries location

2014-12-20 Thread pythonista
Thank you for your response. Most of my data is complex raw sql. I had placed it in the views and it is working as expected I would like to migrate the raw sql to managers, Can you point me to one or more good examples of how the manager is coded and how the sql interacts with the views. Tha