Set of choices of which several can be chosen without using a ManyToManyField

2011-11-01 Thread Jaroslav Dobrek
Hello, what is the most straightforward way to use a set of choices of which several can be chosen without using a ManyToManyField? Using a ManyToManyField would make my program unnecessarily complicated. Example: class Candidate(models.Model): programming_languages = models.MultipleChoice

Disk I/O Error

2011-11-01 Thread Nicole Button
I'm getting a DatabaseError, looking like this: Django Version: 1.3 Exception Type: DatabaseError Exception Value:disk I/O error Exception Location: /usr/local/lib/python2.6/dist-packages/django/db/ backends/sqlite3/base.py in execute, line 234 whenever I try to read o

Re: Disk I/O Error

2011-11-01 Thread Jani Tiainen
On 1.11.2011 8:23, Nicole Button wrote: I'm getting a DatabaseError, looking like this: Django Version: 1.3 Exception Type: DatabaseError Exception Value:disk I/O error Exception Location: /usr/local/lib/python2.6/dist-packages/django/db/ backends/sqlite3/base.py in e

Re: Set of choices of which several can be chosen without using a ManyToManyField

2011-11-01 Thread Tom Evans
On Tue, Nov 1, 2011 at 11:07 AM, Jaroslav Dobrek wrote: > Hello, > > what is the most straightforward way to use a set of choices of which > several can be chosen without using a ManyToManyField? > > Using a ManyToManyField would make my program unnecessarily > complicated. > > Example: > > class

Closing all connections to DB.

2011-11-01 Thread Thomas Guettler
Hi, I want to close all connections to the database, because I develop a long running daemon process: for connection in connections.all(): connection.close() But the above code does not work. select * from pg_stat_activity ; --> There Script is still "idle in transaction" I found out, th

Re: Set of choices of which several can be chosen without using a ManyToManyField

2011-11-01 Thread Jaroslav Dobrek
> You are confusing model fields with form fields. MultipleChoiceField > is a form field, not a model field. I wasn't aware of the existence of MultipleChoiceFields. The idea of the above code was to express that I wanted to use this code class Candidate(models.Model): programming_languages

Re: Set of choices of which several can be chosen without using a ManyToManyField

2011-11-01 Thread Tom Evans
On Tue, Nov 1, 2011 at 1:05 PM, Jaroslav Dobrek wrote: >> You are confusing model fields with form fields. MultipleChoiceField >> is a form field, not a model field. > > I wasn't aware of the existence of MultipleChoiceFields. The idea of > the above code was to express that I wanted to use this c

Re: Set of choices of which several can be chosen without using a ManyToManyField

2011-11-01 Thread J. Cliff Dyer
On 11/01/2011 09:05 AM, Jaroslav Dobrek wrote: You are confusing model fields with form fields. MultipleChoiceField is a form field, not a model field. I wasn't aware of the existence of MultipleChoiceFields. The idea of the above code was to express that I wanted to use this code class Candida

Re: django request.POST data caching

2011-11-01 Thread luke lukes
thanks kurtis for the reply. Anyway: solved -> fixed many error in the view (a lot of lines were written by copy and paste) On 30 Ott, 08:48, Kurtis Mullins wrote: > I apologize if this answer doesn't help much -- I'm confused by your > question. > > request.POST doesn't cache anything. It's

django model forms validation and error display

2011-11-01 Thread luke lukes
i have this template: http://dpaste.com/645468/ that send data to this view: http://dpaste.com/645469/. the template display a form made by modelforms, with a custom layout. i have to validate the fields value send to view, and then redirect to the same template if the field validation fails. i've

Django app, part 1, error with the database

2011-11-01 Thread Nicolas
Dear all, I'm completly new to the world of django and python. I'm trying to go through the tuto "Writing your first Django app, part 1" and of course I have an error. This error happens in the step "database setup". I edited the settings file, wrote 'django.db.backends.sqlite3' for engine and a pa

Re: Django app, part 1, error with the database

2011-11-01 Thread Nikolas Stevenson-Molnar
Hi Nicolas, It looks like you have a syntax error in your settings file. It's possible you left of a comma after one of your dictionary values, or didn't close a brace. I can't tell for sure without more context: could you please provide the complete "DATABASES" section of your settings file? On

Re: Django app, part 1, error with the database

2011-11-01 Thread Sandro Dutra
'NAME': 'C:/Users/songbird/Desktop/bdd/' # Or path to database file if using sqlite3. You're using a SQLite database, so you've to provide the full path to SQLite database file, for example: 'NAME': 'C:/Users/songbird/Desktop/bdd/mydb.db3' instead only the path to directory. 2011/11/1 Nikolas S

Re: django model forms validation and error display

2011-11-01 Thread Kurtis Mullins
I recommend using Class Based Views if you're running Django 1.3. I tried to go over your app and re-create a prototype using CBVs. I didn't spend a lot of time on the actual logic or field types. I also didn't even try running this. You'll need to fill in a couple of blanks but hopefully you get t

Re: Django app, part 1, error with the database

2011-11-01 Thread Nicolas
Hi, Thanks for your messages. The problem was indeed some missing commas after 'ENGINE': ' ' and 'NAME': ' ' Best -Nicolas- On Nov 1, 6:32 pm, Sandro Dutra wrote: >  'NAME': 'C:/Users/songbird/Desktop/bdd/' # Or path to database file > if using sqlite3. > > You're using a SQLite database, so you'

Re: User data being exposed with mod_wsgi/apache

2011-11-01 Thread Jennifer Bell
Well... you were right. The problem was with my code. As a public service, the code below will expose the data of a logged in user for anyone viewing the site: BAD code > view.py: def show( request, report_id ): report = get_object_or_404(Report, id=report_i

Django aggregation does excessive GROUP BY clauses

2011-11-01 Thread christian.oudard
I am doing a very simple aggregation using the Django ORM, and it is producing a GROUP BY clause that includes the data field, which is very large, and is slowing down the query by over 100-fold. Here is a simplified version of the model: class Document(models.Model): data = models.TextField(

Suggestions on "Loading" for possible long load-times?

2011-11-01 Thread Kurtis
Hey, I've got a part of my site that is just prototyped at the moment. It's not particularly optimized since it's still in the works. I don't think it's going to take a considerable amount of time to load while we have few users. But, when we start migrating our old users to the new system, I can

Re: User data being exposed with mod_wsgi/apache

2011-11-01 Thread Karen Tracey
On Tue, Nov 1, 2011 at 4:40 PM, Jennifer Bell wrote: >def > __init__(self,data=None,files=None,initial={},first_update=False,user=None, > report=None): > if user and user.is_authenticated() and > UserProfile.objects.filter(user=user).exists(): > initial[ 'author' ] = user.f

Re: Suggestions on "Loading" for possible long load-times?

2011-11-01 Thread Russell Keith-Magee
On Wed, Nov 2, 2011 at 7:37 AM, Kurtis wrote: > Hey, > > I've got a part of my site that is just prototyped at the moment. It's > not particularly optimized since it's still in the works. > > I don't think it's going to take a considerable amount of time to load > while we have few users. But, whe

Field available via Django shell but not via web application (crossposted from StackOverFlow)

2011-11-01 Thread Jordan
On the web page, I get the following error: FieldError at /foo/bar/ Cannot resolve keyword 'foos' into field. Choices are: __unused__, [snip] The problem code is User.objects.filter(foos__name='bar') When I run this in the shell, it works and I get a recordset: >>> User.objects

Re:Field available via Django shell but not via web application (crossposted from StackOverFlow)

2011-11-01 Thread Andy McKay
Is this using the Django built in runserver or some other way of serving pages? If not try using runserver. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from t

Re: Django aggregation does excessive GROUP BY clauses

2011-11-01 Thread Karen Tracey
On Tue, Nov 1, 2011 at 6:19 PM, christian.oudard wrote: > I am doing a very simple aggregation using the Django ORM, and it is > producing a GROUP BY clause that includes the data field, which is > very large, and is slowing down the query by over 100-fold. > > Here is a simplified version of the

Can't locate Django source code path

2011-11-01 Thread BillB1951
FRom part 2 of the tutorial I am instructed to copy a file --- Now copy the template admin/base_site.html from within the default Django admin template directory in the source code of Django itself (django/contrib/admin/templates) i I can't find the path. How do I get to it? -- You received t

Re: Can't locate Django source code path

2011-11-01 Thread Nikolas Stevenson-Molnar
It will be in the "site-packages" directory of your Python installation. For Windows, this is typically C:\Python27\Lib\site-packages\django. The location varies based on operating system. You can always open the python interpreter and run >>> import sys >>> sys.path to get a clue where your PYth

Re: Can't locate Django source code path

2011-11-01 Thread Kurtis Mullins
To grab the entire source package, follow the instructions on this page: https://code.djangoproject.com/#Browsingthecodeonline To grab just that single HTML file, it can be found here: https://code.djangoproject.com/browser/django/trunk/django/contrib/admin/templates/admin Note, that there's di

Re: Suggestions on "Loading" for possible long load-times?

2011-11-01 Thread Kurtis Mullins
Thanks a lot Russel! It sounds like a pretty reasonable approach to me. On Tue, Nov 1, 2011 at 7:54 PM, Russell Keith-Magee wrote: > On Wed, Nov 2, 2011 at 7:37 AM, Kurtis wrote: > > Hey, > > > > I've got a part of my site that is just prototyped at the moment. It's > > not particularly optimiz

Image Model, Form and View -> Easily change "upload_to" path from form.save()?

2011-11-01 Thread Kurtis
Hey, I've got a very simple setup for a sample application. Basically, I have a Model w/ an ImageField. I have a ModelForm using that Model. Finally, I have a FormView for using that Form. In my View, I call my form's .save() method and pass along the request user. I'd like to manipulate where th

Re: Image Model, Form and View -> Easily change "upload_to" path from form.save()?

2011-11-01 Thread Kurtis
I'm not sure if there's a better solution, but here's one I kind of came up with after reading into the documentation and some other Discussions. Let me know if there's a better solution out there. Hopefully this will help someone else out as well. from django.db import models from django.contrib.