Django methodologies and best practices

2009-10-17 Thread Shakefu
So my questions are simple: What are your opinions on the best methodologies and practices for developing django apps and projects? What sort of planning do you do for an application or project? What development techniques do you use to help conceptualize an evolving project/app? For example:

How to get multiple test cases to work with manage.py test?

2009-10-17 Thread Jeff
Hi, I'm fairly new to Django and unittest and I seem to be having a problem getting manage.py to execute all of my tests. I can only get it to execute one test at a time by specifying the test method. When I just specify the TestCase class expecting it to execute all of the test methods, it

AttributeError when trying to run syncdb after installing django-friends

2009-10-17 Thread Gezim Hoxha
Hi everyone, I git cloned django friends from the github url provided. Then I installed it with "sudo python setup.py install". I also added "friends" to the INSTALLED_APPS. That all went fine. However running syncdb gave me this error: $ python manage.py syncdb Skipping creation of

How do I add an incrementing numeric field to a generic list?

2009-10-17 Thread jeffself
I've got a view that returns a generic list. It contains the following fields: school, wins, losses, pf, pa, rating I want to add a field called rank that assigns the values 1 through whatever for each of the records returned. Is this possible using the templating engine or do I have to write

Re: Trouble on Apache: unable to open database file

2009-10-17 Thread John D Giotta
Thanks, Sid; I'll try it. On Oct 17, 7:57 am, Sid wrote: > I guess you're using SQLite as your database. It's a file permission > error. > >  If you're on linux try "chmod 777 test.db" to change the file > permissions. And also!!, keep in mind that the directory that the

vDateField and generics views when migrating from oldforms

2009-10-17 Thread qhfgva
I have a .97 app that I'm trying to migrate to 1.1. The current hangup is that forms that were generated by generic.create_update were using oldforms under the covers and automatically put the class="vDateField" in place that let the javascript do it's magic and make the calendar selection

Can not get Apache2, fastcgi, and django working

2009-10-17 Thread AIM
Hi, I am having difficulty getting fastcgi on apache 2 working on my personal centos 5.3 computer. I have been trying to get this to work for 21 days. May I have help? -- I do the following. service httpd restart [r...@localhost mysite]# ./manage.py runfcgi method=threaded

Re: Regarding login functionality in page other than login

2009-10-17 Thread Shawn Milochik
On Sat, Oct 17, 2009 at 1:42 PM, Raashid Malik wrote: > I have a custom page e.g home and i want to have login functionality on this > page. I m using django registration module for django login and > registrations process. Now i m totally blank on how to implement this. Plz >

Re: Linking items from the same model

2009-10-17 Thread Oleg Oltar
I would really want to add some sort of filtering to that http://img.skitch.com/20091017-mfs2mbhbuudk2rgquium1bu61d.png On Sat, Oct 17, 2009 at 10:00 PM, Oleg Oltar <oltarase...@gmail.com> wrote: > I tried to do it. It works really nice. > > I wonder how can I query all a

Re: Linking items from the same model

2009-10-17 Thread Oleg Oltar
I tried to do it. It works really nice. I wonder how can I query all articles related to the current one in a view... Need some examples. Also currently I see all articles in a listbox...And as far as I have more then 200 in the database it's quite hard to select something. Maybe its possible

Regarding login functionality in page other than login

2009-10-17 Thread Raashid Malik
I have a custom page e.g home and i want to have login functionality on this page. I m using django registration module for django login and registrations process. Now i m totally blank on how to implement this. Plz help Thanks, Raashid Malik

Stored proderures/functions in Django

2009-10-17 Thread Tomas Pelka
Hi gang, I know that Django do not support stored procedures/function, but is here still a chance to handle this stuff in Django? I found this http://www.djangosnippets.org/snippets/272/, have somebody experience with this? Thanks for advices, cheers Tom. -- Tom

Re: how to handle menu links in a template

2009-10-17 Thread bruno desthuilliers
On 17 oct, 16:01, rvandam wrote: > I started with a parent template with a menu included. The links in > the menu are relative. This works fine for statical template pages, > but things go wrong when i add dynamic pages. For example a page with > forms only works from a

Re: when click ,the corresponding view function was called twice,why?

2009-10-17 Thread bruno desthuilliers
On 17 oct, 17:59, hao he wrote: > with the follow code/config,one request   lead to  view function was > execute twice。 > > -- > template: > If that's copy-pasted from your code

Re: Linking items from the same model

2009-10-17 Thread bruno desthuilliers
On 17 oct, 17:45, Oleg Oltar wrote: > Hi > > I am trying to create a model for Article site. I want to link each article > with 3-5 related articles, so what I am thinking of is creating code this > way: > >     class Article (models.Model): >         # Tiny url >        

Re: Can't get css working

2009-10-17 Thread bruno desthuilliers
On 17 oct, 15:26, David wrote: > Finally I solved it, and my first suspicion of me being to stupid > proved to be true. > I've put my url-settings in the projects-url-file, instead of the > app's. Don't feel stupid - we all do this kind of mistakes, and sometimes even

Re: Can't get css working

2009-10-17 Thread bruno desthuilliers
On 16 oct, 11:09, David wrote: > > The "interesting discussion" was actually a practical example of a > > setup that is known to work and really helps avoiding typos. > > Of course I included your suggestion before I was replying. Sorry to ask but since you didn't mention

Re: when click ,the corresponding view function was called twice,why?

2009-10-17 Thread ringemup
I've had that problem when a stylesheet import in my document head used an empty string for the path -- the browser called the same URL as for the document in an attempt to import the stylesheet. On Oct 17, 11:59 am, hao he wrote: > with the follow code/config,one request

when click ,the corresponding view function was called twice,why?

2009-10-17 Thread hao he
with the follow code/config,one request lead to view function was execute twice。 -- url config: url(r'^ader/basic/(?P[0-9]+)/ $',ader_basic,name='ad_ader_basic'),

when click ,the corresponding view function was called twice,why?

2009-10-17 Thread hao he
with the follow code/config,one request lead to view function was execute twice。 -- url config: url(r'^ader/basic/(?P[0-9]+)/ $',ader_basic,name='ad_ader_basic'),

Linking items from the same model

2009-10-17 Thread Oleg Oltar
Hi I am trying to create a model for Article site. I want to link each article with 3-5 related articles, so what I am thinking of is creating code this way: class Article (models.Model): # Tiny url url = models.CharField(max_length = 30, unique=True) is_published =

Re: Template code runs in both branches of an if statement

2009-10-17 Thread pjrhar...@gmail.com
Thanks for the suggestion, I'm vaguely familiar with lazyness, and I think at the moment my template tag is actually ok. It just returns a queryset of the latest objects for a particular model to the context. I was just surprised to see debugging output from the template tag when as far as I was

Re: Please help: {% url ... %} path resolve issue

2009-10-17 Thread Gerard
Hi David, It sure is getting clearer! So the only 'dirty way' to get the path shorter in the template tag would be to make them available in the project package (or app package), which indeed sounds like complications in the long run. The more I think of it, the name-tag on the views does

how to handle menu links in a template

2009-10-17 Thread rvandam
I started with a parent template with a menu included. The links in the menu are relative. This works fine for statical template pages, but things go wrong when i add dynamic pages. For example a page with forms only works from a subdirectory like /forms/ and al my relative links dont work

Re: Can't get css working

2009-10-17 Thread David
Finally I solved it, and my first suspicion of me being to stupid proved to be true. I've put my url-settings in the projects-url-file, instead of the app's. However, now I can sleep again :) Thanks everybody for looking into this, and at least I've learned about clean setting-files!

Re: Should (or can) you have many to many relationship with abstract base class

2009-10-17 Thread Peter Mott
I had a dim memory about this and found this link http://www.objectmatter.com/vbsf/docs/maptool/ormapping.html which describes three ways (which as I recall are the standard ways) to map an object hierarchy onto relational tables. None of the ways seem very pretty but as Kurt says there is

Re: Can't get css working

2009-10-17 Thread David
Finally I solved it, and my first suspicion of me being to stupid proved to be true. I've put my url-settings in the projects-url-file, instead of the app's. However, now I can sleep again :) Thanks everybody for looking into this, and at least I've learned about clean setting-files!

Re: Please help: {% url ... %} path resolve issue

2009-10-17 Thread David Paccoud
Hi Gerard, Views and not found by the template loader but the the PYTONPATH.. For "project.myapp.views.customer_edit", it finds a project package in your PYTHONPATH and follow the path up to "customer_edit" function. Just using "customer_edit" is a shortcut for the same thing. "customer_edit" is

Re: Please help: {% url ... %} path resolve issue

2009-10-17 Thread Gerard
Hi David, Thanx for the feedback. The keyword in your sentence below would be *only* i assume. Meaning if not named explicitly, there's no way to get the reverse lookup to work (with the brief notation)? Still makes me wonder where the template loader gets it's information from to be able to

Re: Please help: {% url ... %} path resolve issue

2009-10-17 Thread David Paccoud
Hi, You can use {% url customer_edit customer.id %} only if customer_edit is declared as the name of view in urls.py. See http://docs.djangoproject.com/en/1.1/topics/http/urls/#id2 for more details. David On Sat, Oct 17, 2009 at 11:10 AM, Gerard wrote: > > Hi All, > >

Re: django blog

2009-10-17 Thread David Paccoud
Hi, Have you installed all the dependancies listed in the README file and declared the django apps in your settings.py? Note that the project is now hosted on github. You may want to grab the lastest version there. David On Fri, Oct 16, 2009 at 8:18 PM, lafada

Re: Please help: {% url ... %} path resolve issue

2009-10-17 Thread Gerard
Hi Thierry, The actual url used (and working) is: http://192.168.1.81:8000/customer/2/edit Without the end slash. Gerard. Thierry wrote: > Hi, > > Could it be that you are missing trailing slashes in customer add/edit/ > delete url patterns? > E.g try: > (r'^customer/(?P\d+)/edit/$',

Re: Use one project for a blog, forums, and custom application?

2009-10-17 Thread Grant Livingston
Try setting the SESSION_COOKIE_DOMAIN setting to something like ".mysite.com " So, in settings.py SESSION_COOKIE_DOMAIN = ".mysite.com" --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post

Re: Django project layout - authentication

2009-10-17 Thread nausikaa
Great. Sorry for sending this twice. I thought it got deleted so I sent it again. Looks like it was delayed for ~2 days : ( But I'm still greatful for any advice : ) On Oct 17, 2:19 pm, nausikaa wrote: > Hi > > I'm writing a web interface where users (in groups with

Re: Please help: {% url ... %} path resolve issue

2009-10-17 Thread Thierry
Hi, Could it be that you are missing trailing slashes in customer add/edit/ delete url patterns? E.g try: (r'^customer/(?P\d+)/edit/$', 'customer_edit'), instead of: (r'^customer/(?P\d+)/edit$', 'customer_edit'), Thierry. On 17 oct, 14:12, Gerard wrote: > Hi Boyombo, > >

Django project layout - authentication

2009-10-17 Thread nausikaa
Hi I'm writing a web interface where users (in groups with different rights) can login and view and edit db entries. At the moment the authentication functionality is in myproject/ auth.py The authenticate method in auth.py does ldap authentication. Now my question: Would it be better to

Re: Please help: {% url ... %} path resolve issue

2009-10-17 Thread Gerard
Hi Boyombo, The error I get when using {% url customer_edit customer.id %} is: NoReverseMatch at /customer/2 Reverse for 'customer_edit' with arguments '(2L,)' and keyword arguments '{}' not found. # The project url.py: from django.conf.urls.defaults import * urlpatterns = patterns('',

Re: Trouble on Apache: unable to open database file

2009-10-17 Thread Sid
I guess you're using SQLite as your database. It's a file permission error. If you're on linux try "chmod 777 test.db" to change the file permissions. And also!!, keep in mind that the directory that the DB file is should also be writable. So do a chmod on the dir as well to test it out. -Sid

search_fields

2009-10-17 Thread Alfredo Alessandrini
Hi, I've this admin.py: from chessemail.GAME.models import Game from django.contrib import admin class GameAdmin(admin.ModelAdmin): list_display = ('id', 'white', 'black', 'time_days_W', 'time_days_B', 'move_game', 'last_move_W', 'last_move_B', 'is_active')

Re: Please help: {% url ... %} path resolve issue

2009-10-17 Thread boyombo
Hi Gerard, can you what is your url conf like and the error message you get? On Oct 17, 10:10 am, Gerard wrote: > Hi All, > > I've been trying to figure out why this works: > > {% url project.myapp.views.customer_edit customer.id %} > > And this does not: > > {% url

Re: When would you use Context instead of RequestContext?

2009-10-17 Thread bobhaugen
On Oct 15, 5:13 pm, bruno desthuilliers wrote: > On 15 oct, 18:28, ringemup wrote: > > > I don't think I've seen the two-function technique used much, if at > > all. > > To be true, I never saw it anywhere except in some of my own code. But > I

How to attach managers to models (outside model definition)?

2009-10-17 Thread Thierry
Hi, I did not see any section of Django documentation related to attaching managers to models outside of model definition. My current case is a manager defined in a separate module (long story short: to avoid circular imports), that I expected to attach to a model with a naive statement:

Please help: {% url ... %} path resolve issue

2009-10-17 Thread Gerard
Hi All, I've been trying to figure out why this works: {% url project.myapp.views.customer_edit customer.id %} And this does not: {% url customer_edit customer.id %} I could go for url() in my patterns and decouple view and pattern name, but is it not possible to tell the template loader

Re: Complex annotated/aggregated QuerySet ?

2009-10-17 Thread Thierry
Thanks Javier, This is the perfect translation of the SQL I came up with. I was almost there, but just afraid of having to play with 'extra' and raw SQL. Thierry. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups