Re: Django admin stops showing all apps

2009-11-04 Thread Greg Brown
Hi Diego, Thanks for your suggestion - I had looked in the logs but not hard enough it would seem! I think I've tracked the problem down... for some reason my models.py files sometimes can't complete an import (this was in the logs, I have no idea why it fails however) and because of this, the

Re: Django admin stops showing all apps

2009-11-04 Thread Diego Ucha
Hello Greg, What does Apache writes in his log when you try to access the admin when it is unreachable? []s, Diego Ucha http://www.scientificcircle.com/ On 1 nov, 20:52, Greg wrote: > Hi all, > > I have a very strange problem with one of my django sites - when I >

Re: Django and PostgreSQL/Slony for load-balancing?

2009-11-04 Thread Michael Price
I've been working on the same project and figured I would chip in. A compromise to avoid needing synchronous replication would be to determine which functions in our code need to use "live" or recently modified data, and ensure that queries pertaining to those function calls get sent to the

coercing to Unicode: need string or buffer, Connector found

2009-11-04 Thread adelaide_mike
Hi. Still learning, slowly. This is Django 1.0.2 The relevant models are Unit, Connector and Cable class Cable(models.Model): cable = models.CharField(max_length=8, blank=False) desc = models.CharField(max_length=128, blank=True) cabletype = models.ForeignKey(Cabletype, blank=True,

Debugging exceptions thrown by loaddata

2009-11-04 Thread Bram Duvigneau
Hi all, I'm trying to import a JSON fixture using loaddata. It gives me a ProgrammingError because it seems that it's trying to put to much data in a varchar. Without access to the variables in that scope, I'm quite lost which record is causing this. Using "python -i manage.py loaddata

Re: (Re)Using Django Models in eventlet environment

2009-11-04 Thread tyler
On Tue, 03 Nov 2009, ty...@monkeypox.org wrote: > Howdy folks, I'm working on some backend services using eventlet[0] and I > would > like to re-use my Django models code, doing so "out of the box" is proving > more > difficult than I had hoped. > > In order to prevent blocking coroutines, I

How to filter queryset on calculated field provided by `extra` call in Django?

2009-11-04 Thread dnedbaylo
Hi all, Here is my django models: class Author (models.Model): name = models.CharField(max_length=255) removed = models.BooleanField(default=False) class Image (models.Model): author = models.ForeignKey(Author) name = models.CharField(max_length=255) height =

Re: unique_for_date

2009-11-04 Thread David
Hi Ramiro I'm using Django 1.1.1 --~--~-~--~~~---~--~~ 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 this group, send email to

Re: Where are forms usually defined?

2009-11-04 Thread hcarvalhoalves
The common convention seen on Django code and 3rd party apps is to have a forms.py inside the app dir. But It doesn't matter because Django doesn't enforce a particular file name for this, you're free to organize your code tree as you like. Keep in mind that Django is just Python, so if you're

Re: unique_for_date

2009-11-04 Thread Ramiro Morales
On Wed, Nov 4, 2009 at 2:52 PM, David wrote: > > Hello > > I was wondering if unique_for_date is not working or if I am not > understanding how it is meant to be used. What version of Django are you using? -- Ramiro Morales | http://rmorales.net

Re: Preventing JOIN while checking if a self referencing FK is null

2009-11-04 Thread John Boxall
Thanks for the suggestion Daniel, but that doesn't help either :\ This will raise a field error (bff_id is not a valid field, only bff is) Person.objects.exclude(bff_id=None) And these both result in JOINs: Person.objects.exclude(bff=None) Person.objects.exclude(bff__id=None) Perhaps there is

Re: Preventing JOIN while checking if a self referencing FK is null

2009-11-04 Thread Daniel Roseman
On Nov 4, 7:22 pm, John Boxall wrote: > Both of these will raise a FieldError: > > people_with_bffs = Person.objects.filter(bbf_id__isnull=False) > people_with_bffs = Person.objects.filter(bbf_pk__isnull=False) > > Cannot resolve keyword 'bbf_pk' into field. Choices are

Re: Dictionary pagination

2009-11-04 Thread David
Thanks Bill. Your reply is quite helpful. On Nov 4, 12:01 pm, Bill Freeman wrote: > On Wed, Nov 4, 2009 at 1:32 PM, David wrote: > > > Hello, > > > I just wonder if anybody has handled this before. Here is a 2-D > > dictionary. > > > dict[key_1] =

Re: PLEASE HELP ME! update python 2.5 to 2.6 and django doesnt work

2009-11-04 Thread sstein...@gmail.com
On Nov 4, 2009, at 4:01 AM, joker wrote: > > i update python 2.5.2 to 2.6 and setup changed directory > /usr/lib/python2.5 to /usr/local/lib/python2.5/ That doesn't look right. If you installed 2.6, the new directories should have 2.6 in them, not 2.5 and so should your tracebacks. S >

Re: Deploying Django to production environment

2009-11-04 Thread sstein...@gmail.com
On Nov 3, 2009, at 11:19 PM, JohnL wrote: > Hi All, > > I just joined linode and followed there instructions in setting up > Django at http://library.linode.com/lamp-guides/ubuntu-9.10-karmic/. > > > > ServerAdmin squ...@bucknell.net > ServerName bucknell.net > ServerAlias

Re: Preventing JOIN while checking if a self referencing FK is null

2009-11-04 Thread John Boxall
Both of these will raise a FieldError: people_with_bffs = Person.objects.filter(bbf_id__isnull=False) people_with_bffs = Person.objects.filter(bbf_pk__isnull=False) Cannot resolve keyword 'bbf_pk' into field. Choices are 'bbf'. Thanks for the suggestion though! jb On Nov 4, 11:13 am, Javier

Re: Preventing JOIN while checking if a self referencing FK is null

2009-11-04 Thread Javier Guerra
what about people_with_bffs = Person.objects.filter(bbf_id__isnull=False) ? (disclaimer, i haven't tried it) -- Javier --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this

Re: Building Q queries

2009-11-04 Thread John Boxall
Hey Marc, You can store queryset by pickling them - you might find this documentation helpful: http://docs.djangoproject.com/en/dev/ref/models/querysets/#id2 I could imagine an interface that combined Alex's django-filter with a Model for storing the pickled query objects to implement your

Preventing JOIN while checking if a self referencing FK is null

2009-11-04 Thread John Boxall
Hey Djangonauts, I'd like to optimize the performance of a query I've got running on a page - I've got a model which has a self referencing nullable foreign key and I'd like to select all instances of that model that which have a value for that column. Imagine a class Person with a nullable FK

Re: Dictionary pagination

2009-11-04 Thread Bill Freeman
On Wed, Nov 4, 2009 at 1:32 PM, David wrote: > > Hello, > > I just wonder if anybody has handled this before. Here is a 2-D > dictionary. > > dict[key_1] = {'a':'aa', 'b':'bb', 'c':'cc'} > dict[key_2] = {'a':'dd', 'b':'ee', 'c':'ff'} > dict[key_3] = {'a':'eef', 'b': 'ff',

Dictionary pagination

2009-11-04 Thread David
Hello, I just wonder if anybody has handled this before. Here is a 2-D dictionary. dict[key_1] = {'a':'aa', 'b':'bb', 'c':'cc'} dict[key_2] = {'a':'dd', 'b':'ee', 'c':'ff'} dict[key_3] = {'a':'eef', 'b': 'ff', 'c':'ghh'} Assume that this dict is so long that I need to paginate. Do

Re: unique_for_date

2009-11-04 Thread David
Hi Alessandro I just tried converting pubDate to a DateField and it didn't solve the problem. Does unique_for_date apply to only the admin interface ? Or, just everything else ? I am testing this purely with the admin interface. Thanks --~--~-~--~~~---~--~~ You

unique_for_date

2009-11-04 Thread David
Hello I was wondering if unique_for_date is not working or if I am not understanding how it is meant to be used. My model: class Entry(models.Model): title = models.CharField(max_length=255) content = models.TextField() pubDate =

Re: urls.py generic views and foreign keys

2009-11-04 Thread David
Thank you Daniel, that worked perfectly. --~--~-~--~~~---~--~~ 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 this group, send

Re: redirect or reload page after pdf file generation.

2009-11-04 Thread jai_python
I save the response content in pdf file and then page will be redirected and pdf file will be called on page onload Thanks Jai On Nov 3, 11:10 am, Jani Tiainen wrote: > jai_python kirjoitti: > > > > > Hello every one, > > > I have a form which contains group of data and I

Re: Checkboxes checked when editing a form

2009-11-04 Thread chewynougat
Yes, here is the view code form = group_forms.GroupForm(request.POST, instance=group) options_form = group_forms.GroupOptionForm(request.POST, instance=group.groupoption_set.all()[0]) if form.is_valid() and options_form.is_valid():

Re: urls.py generic views and foreign keys

2009-11-04 Thread Daniel Roseman
On Nov 4, 3:34 pm, David wrote: > Hello > > I have just started to learn Django. > > I have setup a Blog model, and an Entry model. I would like to use a > generic view to list all of the entries in a given blog. The url to > this should be /blog-slug/. > > I am unclear

Re: Admin not looking in templates/admin/flatpages/flatpage for change_form.html

2009-11-04 Thread Nev
I've still not managed to get this to do the documented behaviour. Anyone? Please. On Oct 27, 1:38 am, Nev wrote: > Hello, > > I have done the tinymce thing for my flatpages, but it only works if I > put mychange_form.htmlunder templates/admin. If I put it under >

Re: change of m2m field not reflected

2009-11-04 Thread Georg Göttlich
Hello Russ, thank you for your detailed reply! I wasn't aware of the complete decoupling of m2m fields from the model. This made me realise that the admin must handle m2m field differently which in turn led to ModelAdmin.save_formset and formset.save_m2m(). I haven't tried this yet, but I'm

Re: Checkboxes checked when editing a form

2009-11-04 Thread Daniel Roseman
On Nov 4, 3:58 pm, chewynougat wrote: > Hi > > When I want a user to edit a form, I would like previously checked > checkboxes to show as checked. However, they are not showing (just > unchecked checkboxes). Can anyone explain to me why this is? > > Model: > >

Building Q queries

2009-11-04 Thread mettwoch
Hi, I wonder if I can use the Q object to build queries interactively and store them for repeated use. I imagine building up the tree of the Q object in a simple web interface that introspects the models, shows the fields and some operators and let the user build, name and store queries for

Checkboxes checked when editing a form

2009-11-04 Thread chewynougat
Hi When I want a user to edit a form, I would like previously checked checkboxes to show as checked. However, they are not showing (just unchecked checkboxes). Can anyone explain to me why this is? Model: class GroupOption(models.Model): group = models.ForeignKey(Group) media =

urls.py generic views and foreign keys

2009-11-04 Thread David
Hello I have just started to learn Django. I have setup a Blog model, and an Entry model. I would like to use a generic view to list all of the entries in a given blog. The url to this should be /blog-slug/. I am unclear how I can bring up all of the entries for my blog, or rather how I can

Re: Dynamic content in the database

2009-11-04 Thread David De La Harpe Golden
Peter Harley wrote: > Hi all, > > I was wondering if anyone had any suggestions on how to approach what I > imagine is a fairly common issue. > > Say for example I'm developing a blog app (just to reinvent the wheel > again). In my blog posts I want to link to something else on my site. >

Re: filter_horizontal

2009-11-04 Thread Russell Keith-Magee
On Wed, Nov 4, 2009 at 10:50 PM, DavodM wrote: > > Hello, > > I have a many to many relationship between 'Projects' and 'Tags' in my > app. > > In the admin screen I would like to be able to use the > filter_horizontal interface for adding/editing from both sides of the >

Re: filter_horizontal

2009-11-04 Thread Daniel Roseman
On Nov 4, 2:50 pm, DavodM wrote: > Hello, > > I have a many to many relationship between 'Projects' and 'Tags' in my > app. > > In the admin screen I would like to be able to use the > filter_horizontal interface for adding/editing from both sides of the > relationship

Dynamic content in the database

2009-11-04 Thread Peter Harley
Hi all, I was wondering if anyone had any suggestions on how to approach what I imagine is a fairly common issue. Say for example I'm developing a blog app (just to reinvent the wheel again). In my blog posts I want to link to something else on my site. Normally I would use reverse (or {%

filter_horizontal

2009-11-04 Thread DavodM
Hello, I have a many to many relationship between 'Projects' and 'Tags' in my app. In the admin screen I would like to be able to use the filter_horizontal interface for adding/editing from both sides of the relationship but I can only seem to get it for one or the other. I have tried the

Re: Trace SQL back to python statement

2009-11-04 Thread Knut Nesheim
4 nov 2009 kl. 14.21 skrev Mark L.: > When you are in the SQL tab, to the left of the actual query, isn't > there a "Toggle Stacktrace" link? Clicking it reveals the stacktrace, > which has precisely the information you need. This is a bit embarassing.. I downloaded django-debug-toolbar from

Customized django Group model

2009-11-04 Thread Ivan Poluyanov
Hello Django Users! I wish customize standart Group model to add some fields (is_region, is_managers). how i can do this? true way:) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to

Re: Trace SQL back to python statement

2009-11-04 Thread Mark L.
On Nov 4, 3:44 pm, Knut Nesheim wrote: > 4 nov 2009 kl. 13.34 skrev Mark L.: > > > I guess by "debug toolbar" you mean the django-debug-toolbar (http:// > > pypi.python.org/pypi/django-debug-toolbar/0.8.0). If that is the case, > > django-debug-toolbar has a number of

Re: MultiValueField and MultiWidget

2009-11-04 Thread psvent
OK, that was emberssing :). Thanks! On Nov 4, 1:43 pm, Maksymus007 wrote: > widgets = (forms.Select(), forms.TextInput()) > > you make empty widget, just specify available choices there > > On Wed, Nov 4, 2009 at 11:19 AM, psvent wrote: > > > Hi! >

Re: Trace SQL back to python statement

2009-11-04 Thread Knut Nesheim
4 nov 2009 kl. 13.34 skrev Mark L.: > I guess by "debug toolbar" you mean the django-debug-toolbar (http:// > pypi.python.org/pypi/django-debug-toolbar/0.8.0). If that is the case, > django-debug-toolbar has a number of options and among them > HIDE_DJANGO_SQL (set to True by default), which

Re: MultiValueField and MultiWidget

2009-11-04 Thread Maksymus007
widgets = (forms.Select(), forms.TextInput()) you make empty widget, just specify available choices there On Wed, Nov 4, 2009 at 11:19 AM, psvent wrote: > > Hi! > > I am struggling to get  MultiValueField and MultiWidget to work. > > I have a CharField and ChoiceField in

Re: Trace SQL back to python statement

2009-11-04 Thread Mark L.
On Nov 4, 2:02 pm, Knut Nesheim wrote: > Hello all, > > I'm trying to do some profiling on an application so I know where to   > optimize and how I can expect it to perform with large datasets. I use   > the debug toolbar to inspect sql queries. > >  From time to time

unique_for_date

2009-11-04 Thread Alessandro Ronchi
unique_for_date checks only the date in a datetime field or also for the time? -- Alessandro Ronchi SOASI Sviluppo Software e Sistemi Open Source http://www.soasi.com http://www.linkedin.com/in/ronchialessandro --~--~-~--~~~---~--~~ You received this message

manytomany relation: extra field data _or_ related field data not reproduced?

2009-11-04 Thread Hainje
LS. I'm building a nut mix recept database: class Ingredient(models.Model): naam = models.CharField(max_length=30) class MaatEenheid(models.Model): naam = models.CharField(max_length=30) class Recept(models.Model): naam = models.CharField(max_length=30) hoeveelheid =

Re: uncaught exception: Syntax error, unrecognized expression: %}, on using ajax

2009-11-04 Thread Nicu Marcu
2009/11/4 Nicu Marcu > I'm getting in that specific url, means test_ajax1 view. I test this. It do > the render_to response. I put a print and a raw_input() in that specific > view, and it fire up, on that click event. I think the problem is when that > #test_div is

Re: uncaught exception: Syntax error, unrecognized expression: %}, on using ajax

2009-11-04 Thread Nicu Marcu
I'm getting in that specific url, means test_ajax1 view. I test this. It do the render_to response. I put a print and a raw_input() in that specific view, and it fire up, on that click event. I think the problem is when that #test_div is updated. 2009/11/4 Tom Evans >

Re: Accessing 'bytea' field using django.

2009-11-04 Thread David De La Harpe Golden
ds99 wrote: > Hi, > I am using django with postgres as backend. Some of the fields in the > table are of type "bytea"(bytearray). Which django fields should I use > while defining a model for such tables? > > for eg: To access "boolean" we use BooleanField while modelling. I > want to know how

Re: uncaught exception: Syntax error, unrecognized expression: %}, on using ajax

2009-11-04 Thread Tom Evans
On Wed, Nov 4, 2009 at 9:50 AM, NMarcu wrote: > > Hello all, > > I got an error, and I don't know how to pass on it. I got this > error when I try to use ajax from django templates. > I use this, from jquery: > $('#create-user').click(function() { >$(

Trace SQL back to python statement

2009-11-04 Thread Knut Nesheim
Hello all, I'm trying to do some profiling on an application so I know where to optimize and how I can expect it to perform with large datasets. I use the debug toolbar to inspect sql queries. From time to time certain pages will generate ~100 duplicated extra queries. These pages lists

MultiValueField and MultiWidget

2009-11-04 Thread psvent
Hi! I am struggling to get MultiValueField and MultiWidget to work. I have a CharField and ChoiceField in the MultiValueField class, but I can't get the choices to show in the select tag. Am I doing something wrong? This is what I have so far: class AutocompleteWidget(forms.MultiWidget):

Re: uncaught exception: Syntax error, unrecognized expression: %}, on using ajax

2009-11-04 Thread Nicu Marcu
I see it with firebug. 2009/11/4 Daniel Roseman > > On Nov 4, 9:50 am, NMarcu wrote: > > Hello all, > > > >I got an error, and I don't know how to pass on it. I got this > > error when I try to use ajax from django templates. > > I use this,

Re: uncaught exception: Syntax error, unrecognized expression: %}, on using ajax

2009-11-04 Thread Daniel Roseman
On Nov 4, 9:50 am, NMarcu wrote: > Hello all, > >    I got an error, and I don't know how to pass on it. I got this > error when I try to use ajax from django templates. > I use this, from jquery: > $('#create-user').click(function() { >                 $( '#test_div'

Re: PLEASE HELP ME! update python 2.5 to 2.6 and django doesnt work

2009-11-04 Thread joker
i worked easy_install mysql-python command but still doesnt work On 4 Kasım, 11:17, Roland van Laar wrote: > joker wrote: > > i update python 2.5.2 to 2.6 and setup changed directory > > /usr/lib/python2.5 to /usr/local/lib/python2.5/ > >  and django doesnt working now > > >

Re: Strange SQL Query

2009-11-04 Thread Maksymus007
On Wed, Nov 4, 2009 at 11:13 AM, Mark L. wrote: > > > > On Nov 4, 11:20 am, Maksymus007 wrote: >> I'm trying to use modelformset for my model using specified form. >> Everything works well unless i try to save forms - ale changes are >> saved, but for

Re: Strange SQL Query

2009-11-04 Thread Mark L.
On Nov 4, 11:20 am, Maksymus007 wrote: > I'm trying to use modelformset for my model using specified form. > Everything works well unless i try to save forms - ale changes are > saved, but for 22 forms django generates 91 queries (some of them are > for auth, other parts

uncaught exception: Syntax error, unrecognized expression: %}, on using ajax

2009-11-04 Thread NMarcu
Hello all, I got an error, and I don't know how to pass on it. I got this error when I try to use ajax from django templates. I use this, from jquery: $('#create-user').click(function() { $( '#test_div' ).load( "{% url test_ajax %}"); }); I have this button: Add a new

Re: User Login in django

2009-11-04 Thread Julien Petitperrin
On Wed, Nov 4, 2009 at 10:31 AM, Daniel Roseman wrote: > > On Nov 4, 4:26 am, Denis Bahati wrote: > > Am real need to reinvent the wheel because i have a project which needs > to > > define some user roles, and enable users to update the status of their

Re: User Login in django

2009-11-04 Thread Daniel Roseman
On Nov 4, 4:26 am, Denis Bahati wrote: > Am real need to reinvent the wheel because i have a project which needs to > define some user roles, and enable users to update the status of their own > properties and not the other property. Thanks in advance for any help you > give

Re: Deploying Django to production environment

2009-11-04 Thread Daniel Roseman
On Nov 4, 4:19 am, JohnL wrote: > Hi All, > > I just joined linode and followed there instructions in setting up > Django athttp://library.linode.com/lamp-guides/ubuntu-9.10-karmic/. > > >      ServerAdmin squ...@bucknell.net >      ServerName bucknell.net >      

Re: PLEASE HELP ME! update python 2.5 to 2.6 and django doesnt work

2009-11-04 Thread Roland van Laar
joker wrote: > i update python 2.5.2 to 2.6 and setup changed directory > /usr/lib/python2.5 to /usr/local/lib/python2.5/ > and django doesnt working now > > ImproperlyConfigured: Error importing middleware > django.contrib.flatpages.middleware: "No module named mysql.base" > You might want

Re: PLEASE HELP ME! update python 2.5 to 2.6 and django doesnt work

2009-11-04 Thread Crispin Wellington
Looks like your python 2.5 had the python mysql packages installed, but your new python 2.6 doesn't, which it wouldn't being a fresh install. Now you need to install the python mysql bindings into python 2.6. Also, you should probably have your libs in for python 2.6 in

Re: Deploying Django to production environment

2009-11-04 Thread fest
Hi John, It doesn't really matter where you place your application code- just don't put it in a place accessible by your web server, so nobody can access your source code. I have apache configured to serve php websites from /var/sharedwww/ site1/www, but my django site resides in

DRY in django.contrib.auth

2009-11-04 Thread fest
Hello, I'm not sure if I should post this message in django-developers or here, but before I bother django developers, I wanted to discuss this issue with django users. I stumbled across this one when I was creating a custom User class, by inheriting from django's built in User class. I extended

PLEASE HELP ME! update python 2.5 to 2.6 and django doesnt work

2009-11-04 Thread joker
i update python 2.5.2 to 2.6 and setup changed directory /usr/lib/python2.5 to /usr/local/lib/python2.5/ and django doesnt working now Traceback (most recent call last): File "/usr/lib/python2.5/site-packages/mod_python/importer.py", line 1537, in HandlerDispatch File

Strange SQL Query

2009-11-04 Thread Maksymus007
I'm trying to use modelformset for my model using specified form. Everything works well unless i try to save forms - ale changes are saved, but for 22 forms django generates 91 queries (some of them are for auth, other parts etc - but this number should not exceed 30 counting one query for each