Duplicate results using ORd Q queries

2009-08-08 Thread Thomas Scrace
Hi all, In order to teach myself Django I am creating a simple film database project. My search code looks like this: results = Film.objects.filter( Q(title__icontains=q) | Q(director__name__icontains=q) |

Reloading a page with new data

2009-08-13 Thread Thomas Scrace
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi all, My app has a page where you can enter new data into the database through a form. All is working well, except that some of the fields require a choice from a drop down menu. If the choice for these fields the user wants is not already in the

Re: django template loop collections.defaultdict(lambda: collections.defaultdict(list))

2013-08-24 Thread Thomas Scrace
On 23 Aug 2013, at 16:58, Daviddd wrote: > In my template I tried: > > {% for key, groups in queryset.iteritems %} > groups = {{ groups }} > {% for group_key, cols in groups.iteritems %} > cols = {{ group_key }} > {% for objs in cols %} > {# rest of the code #} >

Re: Django IndexError: list index out of range

2013-08-24 Thread Thomas Scrace
On 24 Aug 2013, at 16:02, Oleg Gorjajnov wrote: > And this is not my case. > > So what's wrong with that? It must work well without meta classes. > Do you get any problems when you do manage.py runserver or syncdb? I think your problem stems from trying to build within Sublime Text. -- Yo

Re: MySQL manage.py dbshell throwing error unknown variable 'character-set-server=utf8'

2013-08-24 Thread Thomas Scrace
On Saturday, 24 August 2013, Brian Lee wrote: > So, my website, involving lots of database calls, works perfectly fine, > even after a reboot. > > However, attempting to connect directly via dbshell results in this error: > $ ./manage.py dbshell > mysql: unknown variable 'character-set-server=utf

Re: MySQL manage.py dbshell throwing error unknown variable 'character-set-server=utf8'

2013-08-24 Thread Thomas Scrace
On Sunday, 25 August 2013, Brian Lee wrote: > [client] > 20 port= 3306 > 21 socket = /var/run/mysqld/mysqld.sock > 22 > 23 # Here is entries for some specific programs > 24 # The following values assume you have at least 32M ram > 25 > 26 # This was formally known as [safe_mysq

Re: DecimalField

2013-08-25 Thread Thomas Scrace
You're creating an entirely new DecimalField, rather than altering the error messages of your existing field. I think what you want is: class YourForm(forms.ModelForm): def __init__(self, *args, **kwargs): super(YourForm, self).__init__(*args, **kwargs) self.fields["amount"

Re: django template loop collections.defaultdict(lambda: collections.defaultdict(list))

2013-08-26 Thread Thomas Scrace
On Monday, 26 August 2013, Daviddd wrote: > Sincerely, I don't know how I can create the dict without using > defaultdict. > > D > You can create it using a defaultdict if you want to, but once it is created, and before you pass it to the template, loop through all the values of your outer dict a