Re: Testing seems to get second class treatment - support for more than tests.py and models.py

2008-07-13 Thread jawspeak
Thanks Russ I'll try what you suggested, I was hoping there was another way besides how I was trying to do it. Many people compare Django to rails which, independent of any other connotations, does seem to expose a difference in testing. It's been almost a year since I worked with rails, and the

Re: How to force user login before do anything

2008-07-13 Thread [EMAIL PROTECTED]
thank you for your advice. thanks again. On 7月8日, 下午8时31分, cschand <[EMAIL PROTECTED]> wrote: > If your REQUIRE_LOGIN_PATH is different in settings you can use this > middleware > > http://www.djangosnippets.org/snippets/136/ > > Satheesh > > On Jul 8, 2:25 pm, Daniel Hepper <[EMAIL PROTECTED]>

Re: ImportError: No module named django.core.management

2008-07-13 Thread Karen Tracey
On Mon, Jul 14, 2008 at 12:40 AM, tampler_knight <[EMAIL PROTECTED]> wrote: > > Thank you so much for the reply, Karen. Greatly appreciated. > > I am using Django-0.96.2 which is installed in the C drive of my > machine (running Windows XP SP2). > > As advised in the documentation, I tried to use

Re: Python PATH question

2008-07-13 Thread Rickard
After reading the documentation, it seems to me that it assumes that root is on the path. I am therefore a little surprised that runserver is not working that way. Maybe it is good to modify manage.py to include root on path so that later migration to mod_python will not cause so many problems.

Re: Injecting error messages into ModelForm

2008-07-13 Thread Karen Tracey
On Mon, Jul 14, 2008 at 12:33 AM, Torsten Bronger < [EMAIL PROTECTED]> wrote: > > Hallöchen! > > Karen Tracey writes: > > > On Sun, Jul 13, 2008 at 8:20 AM, Torsten Bronger < > > [EMAIL PROTECTED]> wrote: > > > >> While ModelForm.is_valid() finds field validation errors, it > >> cannot catch

Re: ImportError: No module named django.core.management

2008-07-13 Thread tampler_knight
Thank you so much for the reply, Karen. Greatly appreciated. I am using Django-0.96.2 which is installed in the C drive of my machine (running Windows XP SP2). As advised in the documentation, I tried to use 'setup.py install' but I get the following error: C:\Django-0.96.2>setup.py install

Re: Injecting error messages into ModelForm

2008-07-13 Thread Torsten Bronger
Hallöchen! Karen Tracey writes: > On Sun, Jul 13, 2008 at 8:20 AM, Torsten Bronger < > [EMAIL PROTECTED]> wrote: > >> While ModelForm.is_valid() finds field validation errors, it >> cannot catch errors in uniqueness or referential integrity as far >> as I can see. Thus, I have to check them in

Re: How to display the images in the template page under the django development server

2008-07-13 Thread Eric Liu
Hi all. Thank you all very much. Now I know what's wrong with me.here is the finally result of mine. In the file url.py,just add following code: (r'^site_media/(?P.*)$', 'django.views.static.serve', {'document_root': 'D:/test/mysite2/mysite_media'}), and don't need change the seting in the

Re: IOError with files uploads bigger than 2.5 MB

2008-07-13 Thread Julien Phalip
Looks like apache does not have write access to that directory. Try setting a different directory where Apache will have appropriate access, use the FILE_UPLOAD_TEMP_DIR setting for that. On Jul 14, 11:48 am, tom <[EMAIL PROTECTED]> wrote: > Hi, > > I have a problem with file uploads which are

Re: Testing seems to get second class treatment - support for more than tests.py and models.py

2008-07-13 Thread Russell Keith-Magee
On Mon, Jul 14, 2008 at 9:28 AM, jawspeak <[EMAIL PROTECTED]> wrote: > > I'm not experienced in python but coming from Java I'm having a hard > time being forced to put all my tests for an app in one file. ... > It really bothers me that I don't know how to automatically include > every file

Inquiry

2008-07-13 Thread Kadusale, Myles
Good Day to All! I am new to Django and I was wondering if there is a sample application that deals with sessions that is not using cookies. Also is there a directory structure in an web app when using Django? Like in J2EE?? Hope someone would reply. Thanks Myles

Re: Python PATH question

2008-07-13 Thread Graham Dumpleton
On Jul 14, 11:42 am, Rickard <[EMAIL PROTECTED]> wrote: > Hi, > > The documentation says "The value you use for PythonPath should > include the parent directories of all the modules you are going to > import in your application." > > If I have a typical Django project structure: > > root > -

IOError with files uploads bigger than 2.5 MB

2008-07-13 Thread tom
Hi, I have a problem with file uploads which are bigger than 2.5 MBs. When I use files which are smaller than 2.5 MBs, the files save as expected. As soon as they are bigger than that, I get an IOError (see traceback further down). I have checked that i have write and delete permissions on this

Python PATH question

2008-07-13 Thread Rickard
Hi, The documentation says "The value you use for PythonPath should include the parent directories of all the modules you are going to import in your application." If I have a typical Django project structure: root - mysite -- myapp1 -- myapp2 I should put root on the Python PATH, right? But

Testing seems to get second class treatment - support for more than tests.py and models.py

2008-07-13 Thread jawspeak
I'm not experienced in python but coming from Java I'm having a hard time being forced to put all my tests for an app in one file. I think I figured a workaround, with this directory structure: tutorial1project > some_app_name > tests > __init__.py tutorial1project > another_app_name > tests >

Re: templates: additional forloop variable?

2008-07-13 Thread Tim Chase
> I'm considering adding a forloop.previous (or somesuch) > variable to the supplemental variables produced by the for > tag. If forloop.first is true, this value would always be > None, but otherwise it would reference the actual loop item > from the prior iteration. I'd be tempted to do it

Re: tree structured data

2008-07-13 Thread Russell Keith-Magee
On Mon, Jul 14, 2008 at 6:27 AM, MarC <[EMAIL PROTECTED]> wrote: > > Hello everybody, > > I'm trying to come up with the most django simple friendly way to store > records in a "tree" kind of database. For instance my records are ... > # Create your models here. > class Food(models.Model): >

templates: additional forloop variable?

2008-07-13 Thread Scott Moonen
Within a Django template, sometimes I find myself wishing that I had access to the loop item from the previous iteration of a loop. Usually the ifchanged tag is good enough for my purposes, but occasionally if some attribute of the loop item has changed I need to do further examination of the

Re: tree structured data

2008-07-13 Thread Oscar Carlsson
I believe there's a project called GeoDjango that's dealing with this very issue, you should check it out: http://code.djangoproject.com/wiki/GeoDjango Oscar On Mon, Jul 14, 2008 at 12:27 AM, MarC <[EMAIL PROTECTED]> wrote: > > Hello everybody, > > I'm trying to come up with the most django

Re: Creating a Scheduled Task

2008-07-13 Thread Oscar Carlsson
If you are on a *NIX platform (linux, freebsd, os x etc) the easiest way to schedule a task is using cron, and writing a python script that can be run from cron is trivial, even if you need to use django in this script. Just put the script in your project root, and follow these instructions:

Re: tree structured data

2008-07-13 Thread Frantisek Malina
Download Satchmo and look at how product categories are done. There is a complete solution for you. http://www.satchmoproject.com/ On 14. Júl, 00:27 h., MarC <[EMAIL PROTECTED]> wrote: > Hello everybody, > > I'm trying to come up with the most django simple friendly way to store > records in a

tree structured data

2008-07-13 Thread MarC
Hello everybody, I'm trying to come up with the most django simple friendly way to store records in a "tree" kind of database. For instance my records are Beverages, Food>Fruits>Apples, Food>Vegetables>Carrots, etc . Ideally I'd like to be able to select records that may be categories (Food,

Re: ImportError: No module named django.core.management

2008-07-13 Thread Karen Tracey
On Sun, Jul 13, 2008 at 1:26 PM, tampler_knight <[EMAIL PROTECTED]> wrote: > > Hi all, > > I installed the 'Django poll application' that comes with the Django > tutorial. > > When I try to start the webserver using the command > > C:\django-poll\mysite>python manage.py runserver > > I get the

ImportError: No module named django.core.management

2008-07-13 Thread tampler_knight
Hi all, I installed the 'Django poll application' that comes with the Django tutorial. When I try to start the webserver using the command C:\django-poll\mysite>python manage.py runserver I get the following error: Traceback (most recent call last): File "manage.py", line 2, in from

Re: Template Language Design

2008-07-13 Thread Chris
Thanks for the clarifications everyone. It seems less crazy now ;) --~--~-~--~~~---~--~~ 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

Re: Creating a Scheduled Task

2008-07-13 Thread Adam Fast
I'm not sure about admin integration but there are two apps out there that handle task scheduling. http://code.google.com/p/django-cron/ http://code.google.com/p/django-jits/ On Sat, Jul 12, 2008 at 9:53 AM, Chris <[EMAIL PROTECTED]> wrote: > > Hi, > > I'm a newbie to Django, and I'm trying to

Re: Autoupdate field?

2008-07-13 Thread Adam Fast
The proper design decision there (if Mary's phone number and her family (the Smith's) phone number will /always/ be the same) is to store the data only once - avoiding duplication. This is what Juanjo is saying. Since mary.family = Smith, mary.family.telephone_home = Mary's phone number. If

Re: modify select widget

2008-07-13 Thread Nikolay Panov
Hi, > Is there any easy way to do that? O are hint on how to do it? You should create your custom widget for this. Regards, Nikolay. On Sat, Jul 12, 2008 at 19:57, Nenillo <[EMAIL PROTECTED]> wrote: > > Hi, > > I'm doing an app with a category model. That category model has an >

Re: modify select widget

2008-07-13 Thread Jeff FW
Misspoke in that last post--if you want a select tag, obviously you won't be using li tags. You'd use option tags, and maybe throw in some text in front of each option to indicate the level. Everything else still applies the same. -Jeff On Jul 12, 11:57 am, Nenillo <[EMAIL PROTECTED]> wrote:

Re: modify select widget

2008-07-13 Thread Jeff FW
I recently had to do something similar. The way I went about it (and I'm not sure this is the best way) is to select all of the categories, then iterate through them and build a tree, using each category's parent_id to figure out where in the tree it fits. Then, once you've got a tree, you have

Re: Injecting error messages into ModelForm

2008-07-13 Thread Karen Tracey
On Sun, Jul 13, 2008 at 8:20 AM, Torsten Bronger < [EMAIL PROTECTED]> wrote: > > Hallöchen! > > While ModelForm.is_valid() finds field validation errors, it cannot > catch errors in uniqueness or referential integrity as far as I can > see. Thus, I have to check them in my view.py code

Re: Automatic Image Resizing upon Upload

2008-07-13 Thread Alex Ezell
On Sat, Jul 12, 2008 at 6:37 AM, TheBoff <[EMAIL PROTECTED]> wrote: > > Photologue is perhaps a bit heavyweight for my current purposes, > although it looks like an extremely impressive bit of kit, and were I > to make a dedicated photo gallery etc app with django, I would > certainly use it.

Re: Injecting error messages into ModelForm

2008-07-13 Thread Torsten Bronger
Hallöchen! Andrew Ingram writes: > ModelForm is really just a convenient subclass of Form, so if you > want additional validation methods you just have to > implement/override the clean methods like you would with a normal > form. The problem is that at the time the relational integrity checks

Re: Injecting error messages into ModelForm

2008-07-13 Thread Andrew Ingram
ModelForm is really just a convenient subclass of Form, so if you want additional validation methods you just have to implement/override the clean methods like you would with a normal form. The ease of validation that newforms allows is actually one of the main reasons I prefer Django over

Re: Automatic Image Resizing upon Upload

2008-07-13 Thread Justin
In case other's have the same need, one of the features of the upcoming 2.0 release of Photologue is that all resizing, cacheing, (etc.) behaviors have be put in an abstract base class. When you subclass Photologue.models.ImageModel with your own models they inherit the basic functionailty of a

Re: Many to many array accessible from template?

2008-07-13 Thread Darthmahon
Alex, I don't understand what you mean by that? message.users.all prints out a list of users based on the many to many. I just want to check if the current user is in message.users.all - are you saying I can't because I am passing in a string, not an actual UserProfile instance? On Jul 13, 1:16 

Re: Left Outer Join

2008-07-13 Thread Russell Keith-Magee
On Sun, Jul 13, 2008 at 1:37 PM, Chris <[EMAIL PROTECTED]> wrote: > > I'm reasonably fluent in SQL, and while I've found Django's ORM is > great for basic CRUD operations, I'm having trouble creating joins. > > For example, I have a three tables, Article, Rating, and User. Rating > stores a

Re: Template Language Design

2008-07-13 Thread mario
I would agree with you about not being able to evaluate arbitrary expressions is awkward, not to mention surprising, and, because of unnecessary keyword creep, even adds clutter unnecessarily. You may wish to take a look at Evoque Templating http://evoque.gizmojo.org/ that allows arbitrary

Injecting error messages into ModelForm

2008-07-13 Thread Torsten Bronger
Hallöchen! While ModelForm.is_valid() finds field validation errors, it cannot catch errors in uniqueness or referential integrity as far as I can see. Thus, I have to check them in my view.py code separately before calling save(). If such errors are detected, I'd like to display them the same

Re: Many to many array accessible from template?

2008-07-13 Thread Alex Koshelev
But in this case `message` must be a `UserProfile` instance if it has `users` attribute On Sun, Jul 13, 2008 at 4:09 PM, Darthmahon <[EMAIL PROTECTED]> wrote: > > Alex, > > I set the related name to 'users'. I've printed out the field in the > template like this: > > {{ message.users.all }} > >

Re: Many to many array accessible from template?

2008-07-13 Thread Darthmahon
Alex, I set the related name to 'users'. I've printed out the field in the template like this: {{ message.users.all }} It prints out something like: [,] So I know that it is working... On Jul 13, 12:52 pm, Alex Koshelev <[EMAIL PROTECTED]> wrote: > I`UserMessage` model has

Re: Many to many array accessible from template?

2008-07-13 Thread Alex Koshelev
I`UserMessage` model has `users_read` field why do you write in template `message.users`? On Jul 13, 2:56 pm, Darthmahon <[EMAIL PROTECTED]> wrote: > Hey, > > I'm writing a messaging module at the moment. I'm printing out the > list of messages fine, but when I loop through each message I want

Re: extending flatpages

2008-07-13 Thread benjaoming
I just got started with Django and not before long I was thinking the same as you. So I wrote this blog post: http://overtag.dk/wordpress/2008/07/tip-extending-django-flatpages/ It's really simple, but quite a valuable technique, I think. The main idea is: Instead of extending the original

Many to many array accessible from template?

2008-07-13 Thread Darthmahon
Hey, I'm writing a messaging module at the moment. I'm printing out the list of messages fine, but when I loop through each message I want to check if the current user is in an array. This array has all of the people who have read the message so far. Model looks like this: sender

Re: Template Language Design

2008-07-13 Thread Sander Steffann
Hi Chris, > Just out of curiosity, is there a reason why the templating constructs > can't evaluate arbitrary expressions? It seems terribly awkward to me > that {% if %} can only evaluate variable names, while you need the > separate operator {% ifequals %} to test for equality, and for some >

Re: Template Language Design

2008-07-13 Thread Oscar Carlsson
Well, if you really need arbitrary logic in your templates, but like the django template syntax, you should take a look at Mako[0], but it might require some work in your views. But this separation of presentation (logic) and (business) logic is intentional, and if I have understood everything

Re: Template Language Design

2008-07-13 Thread Karen Tracey
On Sun, Jul 13, 2008 at 3:01 AM, Chris <[EMAIL PROTECTED]> wrote: > > Just out of curiosity, is there a reason why the templating constructs > can't evaluate arbitrary expressions? It seems terribly awkward to me > that {% if %} can only evaluate variable names, while you need the > separate

Template Language Design

2008-07-13 Thread Chris
Just out of curiosity, is there a reason why the templating constructs can't evaluate arbitrary expressions? It seems terribly awkward to me that {% if %} can only evaluate variable names, while you need the separate operator {% ifequals %} to test for equality, and for some reason it doesn't

Re: Visualization of databases

2008-07-13 Thread jdelacueva
Also take a look at Python Google Chart: http://pygooglechart.slowchop.com/ On Jul 12, 7:36 pm, "Oscar Carlsson" <[EMAIL PROTECTED]> wrote: > There are a number of different toolkits that could do this for you, here > are three that looks >

Re: Root Access

2008-07-13 Thread James Matthews
I have used dreamhost and hosted Django. While root is the best Django ran smoothly! On Sat, Jul 12, 2008 at 10:22 PM, Tim Johnson <[EMAIL PROTECTED]> wrote: > > Hi: > Just wanted to thank all of you for the responses. > Good data set! > "Not bad for two fingers" > cheers > tim > > > > --