Database queries using django models framework.

2010-01-19 Thread django_user
I am not sure if the following statements in Django/Mysql will result in one or three database queries. candidates = Candidate.objects.filter(department = dept).order_by('- salary')[:30] # Gets all the top salary candidates head_candidates = candidates[:20] # Gets top 20 tail_candidates =

the configuration of nginx/django/fastcgi,can't find the static file

2010-01-19 Thread CCC
hi ,now i want to deploy my website to nginx,,use ubuntu, then myproject is located at /home/x/myproject/ , here is my configuration,thank you very much: user www-data; worker_processes 2; error_log /var/log/nginx/error.log info; events { worker_connections 1024; use epoll; } http

Django Web Developer Needed For Web Project

2010-01-19 Thread Django_Newb
I am currently looking for a Django Developer in South Australia, Victoria or New South Wales, who can assist me with a current web project. The project will involve working from an existing website that requires both major and minor alterations. If anyone interested, could please let me of any

Re: Announce: django-ldap-groups

2010-01-19 Thread Mike Dewhirst
On 6/08/2009 10:15am, Peter Herndon wrote: I'm pleased to announce the release of django-ldap-groups. Of special interest for building intranet sites, django-ldap-groups allows Django users to authenticate against LDAP, and allows site administrators to map LDAP organizational units (OUs) to

Re: Filtering only on Annotations

2010-01-19 Thread Russell Keith-Magee
On Wed, Jan 20, 2010 at 3:42 AM, Collin Anderson wrote: > Taking the example from: > http://docs.djangoproject.com/en/dev/topics/db/aggregation/#filter-and-exclude > > Publisher.objects.filter(book__rating__gt=3.0).annotate(num_books=Count > ('book')) > > Is there

TypeError: 'float' object is not iterable

2010-01-19 Thread Christopher Bird
Hi Im trying iterating over a dictionary. i have no problem with this but when i get to the last key:value ( value is a list) i get the following error value= list TypeError: 'float' object is not iterable django code {% for states in prices_demand.items %} {{ states.0 }} {{

Re: how to do a form with elements drawn from database (not hard-wired in forms.py)?

2010-01-19 Thread dk
The suggestions provided in the replies have all been very helpful to me. I appreciate the help greatly, and I suspect that others coming across this thread on google-groups will find the advice helpful, as well. I ended up doing as follows in my forms.py, and it works nicely for me. class

Re: Django, manage.py and Ubuntu

2010-01-19 Thread MauroCam
Bill, thanks for all your help. I have fixed it by manually saving PYTHONPATH in.profile, and the sys.path is now reflecting the correct path. Runnnig the loaddata command now correctly loads the data! Not sure why saving it in .bashrc did not have the same effect. Will also try your

Re: Django, manage.py and Ubuntu

2010-01-19 Thread Bill Freeman
Maybe that sys.path.append('..') gives you access to some stuff. I'm not sure how it's managing to load django from two different places. apache has nothing to do with running stuff via manage.py, such as shell or loaddata. They each run their own process worth of python, and the sys.path

Re: Looking for people to work on a django apps repository

2010-01-19 Thread HRCerqueira
Well, as far as I know, djangoplugables is still in beta, and pinax is very focused on a specific "product". Either way, I don't know enough about any of these to give a precise opinion on how would it differ. Also, django is growing, and it won't hurt if there are more than one website providing

Re: Django, manage.py and Ubuntu

2010-01-19 Thread MauroCam
Bill, see my replies below. > > Well, if sys.path is the same for both, they are both going to load > the same django. > > The exception to this is that, at least when python starts, the first > item o the path is > an empty string, representing the relative path to the current > directory (at

some modifications of Django admin change_list

2010-01-19 Thread SlafS
Hi there! I need to do some changes in the django admin change_list template (I think so). What I need is to add some class or id (html) to every displayed row (that list is a tree with mptt) so i can add a javascript accordion when clicking given row. I noticed the templatetag {% result_list cl

Re: how to do a form with elements drawn from database (not hard-wired in forms.py)?

2010-01-19 Thread Dougal Matthews
2010/1/18 dk > > Is there a way to do what I'm trying? > > As a totally shameless plug I wrote about this fairly recently; http://dougalmatthews.com/articles/2009/dec/16/nicer-dynamic-forms-django/ I don't quite do the step of the database but show how one can create a form

Re: Django, manage.py and Ubuntu

2010-01-19 Thread Bill Freeman
On Tue, Jan 19, 2010 at 4:57 PM, MauroCam wrote: > >> pprint.pprint(sys.path) > - LIVE & TEST both return the same as I'd expect. Not sure if /home/ > test-project/src should be in there though, and if it should not be / > home/project/src: >

Re: Looking for people to work on a django apps repository

2010-01-19 Thread Daniel Roseman
On Jan 19, 10:45 pm, HRCerqueira wrote: > Hello all, > > I'm planing to start a community based django apps website. If there's > anyone interested in participating on the development please reply to > this thread or just mail me. I already have the server and the domain, >

Looking for people to work on a django apps repository

2010-01-19 Thread HRCerqueira
Hello all, I'm planing to start a community based django apps website. If there's anyone interested in participating on the development please reply to this thread or just mail me. I already have the server and the domain, just need the website ;-) Cheers -- You received this message because

Re: how to do a form with elements drawn from database (not hard-wired in forms.py)?

2010-01-19 Thread Paddy Joy
Also take a look at the code for django-survey at http://code.google.com/p/django-survey/ This helped me a lot when I needed to do something similar last year. Paddy On Jan 19, 8:42 am, dk wrote: > I have an application in which I'd like to present a form whose > elements

Re: Django, manage.py and Ubuntu

2010-01-19 Thread MauroCam
Hi Bill, (Forgive the backslashes, when I type it comes natural as a windows developer) I think you found my problem(s), but I am not sure what to do to solve them. Typing in your commands from the LIVE and TEST directories containing manage.py I found > - >

Mod Python ImportError

2010-01-19 Thread David
I'm getting an ImportError... I think it's a sys.path problem but I can't figure out what to do. Below are the details. Any help? ## Mod Python Error ## MOD_PYTHON ERROR ProcessId: 17855 Interpreter:'my_django' ServerName: 'cube.twusa.ca' DocumentRoot: '/var/www/html' URI:

Re: Django, manage.py and Ubuntu

2010-01-19 Thread MauroCam
Thanks for the advice in the previous email. I will try the steps you suggest As for your other comment: > I might be missing something here but I thought that the manage.py > commands were looked for in the "management/commands" subdirectories of > INSTALLED_APPS. > > According to your email,

Re: Django, manage.py and Ubuntu

2010-01-19 Thread Sandman
I might be missing something here but I thought that the manage.py commands were looked for in the "management/commands" subdirectories of INSTALLED_APPS. According to your email, the loaddata command lives in maintenance/commands. Is your set up accounting for this non-default behavior? Take

Re: Django, manage.py and Ubuntu

2010-01-19 Thread Bill Freeman
If you really are using backslash as a path separator on ubuntu, it could lead to various unexpected results. Also, if you're not doing so, cd into the directory containing manage.py before running the commands. Also, try the manage.py shell command, and at the prompt do:

Filtering only on Annotations

2010-01-19 Thread Collin Anderson
Taking the example from: http://docs.djangoproject.com/en/dev/topics/db/aggregation/#filter-and-exclude Publisher.objects.filter(book__rating__gt=3.0).annotate(num_books=Count ('book')) Is there anyway to have the filter only apply to the annotation, so it would return all publishers, with some

Django, manage.py and Ubuntu

2010-01-19 Thread MauroCam
Hi, Please forgive the possibly daft question, but as an Ubuntu newbie I am going crazy with the following problem. I am seeing unexpected behaviour on our live production server, running Ubuntu, when I execute manage.py The site hosts two sites, the LIVE site and a mirror TEST site that we use

Re: Admin site pages + display or hiding instance owner field

2010-01-19 Thread Massimiliano della Rovere
Thanks for your answer Tim. def get_form(self, request, obj=None, **kwargs): form = super(RowModelAdmin, self).get_form(request, obj, **kwargs) if not request.user.is_superuser: * **del form['compilatore']* return form It seems that the object returned by get_form does not behave like a

Re: Admin site pages + display or hiding instance owner field

2010-01-19 Thread Tim
I think it should be pretty easy to do. The get_form() method on ModelAdmin returns the form, and it knows about the current request. So you could modify that to remove the field after the form is generated. class MyModelAdmin(admin.ModelAdmin): def get_form(self, request, obj=None,

Admin site pages + display or hiding instance owner field

2010-01-19 Thread Massimiliano della Rovere
Is there a way to show or hide a model field in a admin site "change" page depending upon the value of request.user.is_superuser ? I was thinking about filling ModelAdmin.field or .fieldset depending on the value of request.user, but how to read the value of request in ? Also .readonly_fields when

Re: auth_group: dropping unique on name

2010-01-19 Thread zweb
Since all my looks up are by id and I am not using admin, I should be ok. I was not sure if django auth framework used it internally anywhere. On Jan 19, 6:03 am, Karen Tracey wrote: > On Tue, Jan 19, 2010 at 3:17 AM, zweb wrote: > > > I am planning

Re: django-sproutcore

2010-01-19 Thread Sam Barnes
Gonzalo, thanks for your reply, but yes, this is tutorial is too old! Waldemar, thanks for sharing your thoughts. A reply on the sproutcore google group has suggested using django- piston and I think this is probably the route I'll take. Sam On 19 Jan, 13:54, Waldemar Kornewald

Re: problems getting the development version running on Leopard

2010-01-19 Thread Shawn Milochik
> The first one trying to rum django-admin.py command not found This means that the directory containing django-admin.py is not on your PATH. You can add it, or just type the full path to django-admin.py. However, if your Django installation isn't on your PYTHONPATH, you may have a

Looking for Django developer in DC

2010-01-19 Thread Andy
Hey, I own and run a small professional services company in the greater DC area (aajinteractive.com). We do project based software development work, staff augmentation and direct recruiting for our clients. I have a client who wants to hire a solid Django developer. The rite person will have:

problems getting the development version running on Leopard

2010-01-19 Thread Rob Slotboom
I followed all instructions regarding the intallation of the development version of Django on Leopard. I’ve created the symbolic links but I keep getting two error messages: The first one trying to rum django-admin.py command not found The seccond trying to import django in the python shell

Re: Switching from soc2009/multidb to trunk; cross db foreign keys

2010-01-19 Thread Russell Keith-Magee
On Sun, Jan 3, 2010 at 10:52 PM, Russell Keith-Magee wrote: > On Sun, Jan 3, 2010 at 4:06 PM, CB wrote: > >>> The >>> default implementation would essentially be: >>> >>>     def db_from_related_object(self, instance): >>>         return

Followup on the Montréal Sprint

2010-01-19 Thread Yannick Gingras
Greetings, The django translation sprint was a clear success. A team of eight sprinters worked on the Django documentation and after an intense training session on the toolchain, we were able complete a sizable part of the API documentation. Our coach, Mathieu Leduc-Hamel, did a great job

Re: Admin pages, filtering instance list by instance field value and a newbie (me)

2010-01-19 Thread Massimiliano della Rovere
Solved: I found this (well hidden) page: http://code.djangoproject.com/wiki/RowLevelPermissions I do not know it is not embedded in Admin.site documentation... and why those fully functional methods are simply hidden in the source code... On Tue, Jan 19, 2010 at 10:00, Massimiliano della Rovere <

Re: Using the form field values in templates

2010-01-19 Thread ondrey
Hi, if the form is bound (i.e. form.is_bound is true) then you can access its data attribute, which contains the data entered into the form. If the form is valid (i.e. form.is_valid() is true), then you can access the cleaned_data attributes as well. So for example if you have form like this: f

Re: What is the best method to load a page?

2010-01-19 Thread Shawn Milochik
Please complete the tutorial: http://docs.djangoproject.com/en/dev/intro/tutorial01/ Then read this, then provide more information about your question. http://catb.org/~esr/faqs/smart-questions.html Shawn -- You received this message because you are subscribed to the Google Groups "Django

Re: auth_group: dropping unique on name

2010-01-19 Thread Karen Tracey
On Tue, Jan 19, 2010 at 3:17 AM, zweb wrote: > > I am planning to drop unique key constraint on "name" column of > auth_group table. > > Any possible issues it may cause? > Yes. With the unique constraint in place, .get() by name is guaranteed to either find a single

What is the best method to load a page?

2010-01-19 Thread NMarcu
Hello all, What is the best method to load a page. This page to be build from a template. The template to have a table, with data from db? The data from db, are from more then one object. So I'm interested how can I build the template, with data from one or more objects(ob.objects.all ()). --

Re: django-sproutcore

2010-01-19 Thread Waldemar Kornewald
On Jan 19, 12:49 pm, Sam Barnes wrote: > Hi, > > Does anybody have any experience using django-sproutcore (code found > here:http://github.com/sproutcoreisyournewbicycle) > > I've spent a several hours trying to figure out how to connect it all > together but can't quite

Initial data fixtures and auto_now_add=True

2010-01-19 Thread Andrew Turner
I have an initial_data.json file which provides some, er, initial data whenever I run syncdb. One of my models has a DateTimeField with auto_now_add=True. The data is loaded first time round, but on subsequent syncdbs, I get "IntegrityError: posts_entry.pub_date may not be NULL". Is this the

Re: Generic Relations and Django Admin?

2010-01-19 Thread LostCruz
Hi Victor, You are trying to do this the wrong way around. It shouldn't be the Adress class on which you want to define a relationship, but on the other classes. An address is an address whether it's the address of a User or the address of an Institution. class Address(models.Model): # the

Re: how to do a form with elements drawn from database (not hard-wired in forms.py)?

2010-01-19 Thread Viktor
definitely, the best way would be to use a form factory with the type () function. There are many articles about this around the web, for me the best introduction was http://www.b-list.org/weblog/2008/nov/09/dynamic-forms/ moreover, you might find useful the code of django-questions[1] have a

fork: Resource temporarily unavailable running django on fastcgi

2010-01-19 Thread Michael Thon
I set up django to run on FCGI in a shared hosting account using a guide that I found in my web host's forums. The setup is working except that after accessing some pages I get an error on my shell session: -jailshell: fork: Resource temporarily unavailable I was able to kill the python

Re: django-sproutcore

2010-01-19 Thread Gonzalo Delgado
El 19/01/10 08:49, Sam Barnes escribió: > I've spent a several hours trying to figure out how to connect it all > together but can't quite figure it out. The code looks usable but > there's no documentation... > Not familiar at all with django-sproutcore (or sproucore itself), but googling a

Re: ANN: LFC - a CMS

2010-01-19 Thread YoungKing
hello, it doen't work on my postgres when I try run syncdb. Python traceback : File "./bin/django", line 28, in djangorecipe.manage.main('lfc_project.settings') File "/opt/eggs/djangorecipe-0.20-py2.6.egg/djangorecipe/manage.py", line 16, in main management.execute_manager(mod)

django-sproutcore

2010-01-19 Thread Sam Barnes
Hi, Does anybody have any experience using django-sproutcore (code found here: http://github.com/sproutcoreisyournewbicycle) I've spent a several hours trying to figure out how to connect it all together but can't quite figure it out. The code looks usable but there's no documentation... Sam --

Re: problem with multiple database with django 1.1.1 please help

2010-01-19 Thread David De La Harpe Golden
chiranjeevi.muttoju wrote: > Hi friends, > > i am working with django1.1.1, now i want to connect django with > multiple database, could you people please help me how to achieve > this. Django 1.1.1 /does not support/ multiple databases. You therefore cannot expect much in the way of help with

Re: Generic Relations and Django Admin?

2010-01-19 Thread Daniel Roseman
On Jan 19, 10:35 am, Victor Hooi wrote: > heya, > > Thanks for the reply =). > > I tried that, and the fields aren't there, but when I try to save the > object, I get a: > >     IntegrityError at /admin/people/address/add/ >     people_address.content_type_id may not be NULL

Re: Generic Relations and Django Admin?

2010-01-19 Thread Raffaele Salmaso
Victor Hooi wrote: > I tried that, and the fields aren't there, but when I try to save the > object, I get a: > > IntegrityError at /admin/people/address/add/ > people_address.content_type_id may not be NULL > > so obvoiusly Django doesn't like it if those fields aren't filled. it's a

Re: Generic Relations and Django Admin?

2010-01-19 Thread Victor Hooi
heya, Thanks for the reply =). I tried that, and the fields aren't there, but when I try to save the object, I get a: IntegrityError at /admin/people/address/add/ people_address.content_type_id may not be NULL so obvoiusly Django doesn't like it if those fields aren't filled. How do

Re: Generic Relations and Django Admin?

2010-01-19 Thread Victor Hooi
heya, The thing is, the foreign key field is on the Address object, linking to another object that *has* an address. AFAIK, that's how it's meant to be in database design. That's why I need to put something there - e.g. class Address(models.Model): ... user =

Re: Admin pages, filtering instance list by instance field value and a newbie (me)

2010-01-19 Thread Massimiliano della Rovere
In simpler terms: is there a way to filter instances shown with "admin" pages considering the logged user id? is there a way to "interface" request.User with admin.ModelAdmin ? On Mon, Jan 18, 2010 at 22:33, Massimiliano della Rovere < massimiliano.dellarov...@gmail.com> wrote: > Greetings, >

auth_group: dropping unique on name

2010-01-19 Thread zweb
I am planning to drop unique key constraint on "name" column of auth_group table. Any possible issues it may cause? thanks -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To