best alternative for subclassing

2007-09-13 Thread Rob Slotboom
For a model I need subclassing which is work on progres. Falling back to a OneToOne approach seems tricky because "the semantics of one-to- one relationships will be changing soon". I'm wondering now what to do. Here's my model in the OneToOne approach. class Cropcat(models.Model): parent =

Re: ManyToMany and save()

2007-09-13 Thread Alessandro Ronchi
2007/9/13, Collin Grady <[EMAIL PROTECTED]>: > As such, it's impossible to add an m2m link until the object is saved > - this means that admin's code can't possibly set the m2ms up in time > for save() to get them, and there is no event or function to hook > where you can get it. 2007/9/13,

Re: caching and authentication

2007-09-13 Thread patrickk
I´ve upgraded to the current trunk and it´s still not working. this is my views: def top_imagegalleries(request): ... response = render_to_response('site/container/ topimagegalleries.html', { 'object_list_left': rendered_object_list_left, 'object_list_right':

mod_python memory consumption and tuning issues

2007-09-13 Thread omat
Hi, This is more of a python / mod_python configuration issue, but there had been some discussions on this list ([1]), and django-users is where I feel home, so I am posting here. Sorry. I am running 7 Django sites with an Apache + mod_python setup, on a Fedora Core 4 dedicated server with 2 GB

Re: caching and authentication

2007-09-13 Thread patrickk
one additional note: if 2 users are logged in, the username is displayed correctly for each user. BUT: if a user is logged-out, his/her username is still displayed. something doesn´t seem to work here and I can´t figure out what´s wrong. On 13 Sep., 10:14, patrickk <[EMAIL PROTECTED]> wrote: >

Re: mod_python memory consumption and tuning issues

2007-09-13 Thread Kenneth Gonsalves
On 13-Sep-07, at 1:48 PM, omat wrote: > I am running 7 Django sites with an Apache + mod_python setup, on a > Fedora Core 4 dedicated server with 2 GB memory. When I restart > apache, memory usage is somewhere between 200 - 400 MB and quickly > climbs up to somewhere around 1.5 GB. The sites

Re: Populating a form

2007-09-13 Thread Peter Melvyn
On 9/11/07, Ole Laursen <[EMAIL PROTECTED]> wrote: > You can also use the initial parameter when instantiating the form: And how to solve situation when you've processed posted data and in the next step you need to redisplay the same form with some values reset to initial values? Peter

Re: Foreign key error "Reverse query name for field 'foo' clashes with field Foo.bar"

2007-09-13 Thread Jon Atkinson
Thank you all for your help - I renamed the application. Best regards, --Jon On 9/13/07, Joseph Kocherhans <[EMAIL PROTECTED]> wrote: > > On 9/12/07, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > > > > On Thu, 2007-09-13 at 08:16 +0800, Russell Keith-Magee wrote: > > [...] > > > The long

Re: mod_python memory consumption and tuning issues

2007-09-13 Thread omat
I have one apache instance for serving both django and static content but the static content is not served through mod_python (with a directive for static content in the virtual host configuration that does "SetHandler None") After solving this dynamic / static library issue for mod_python, I

Re: Only Simplified Chinese translation not working?

2007-09-13 Thread Nis Jørgensen
Ryan K skrev: > Hi. I have a few languages I've translated my site into. They all work > except Simplified Chinese. Any hints as to why? > Try being more specific than "does not work". Do you see English, garbled characters, something else? > This is in my settings file: > > LANGUAGES = ( >

Re: Populating a form

2007-09-13 Thread MikeHowarth
Look at form_for_instance in newforms: http://www.djangoproject.com/documentation/newforms/ On Sep 13, 9:08 am, "Peter Melvyn" <[EMAIL PROTECTED]> wrote: > On 9/11/07, Ole Laursen <[EMAIL PROTECTED]> wrote: > > > You can also use the initial parameter when instantiating the form: > > And how

django & trac on the same lighttpd?

2007-09-13 Thread est
Could I install django on www.xxx.com while trac nicely on www.xxx.com/trac/ ? My lighttpd.conf is something like this but it is not working $HTTP["host"] == "labs.dormforce.net" { server.document-root = "/srv/dormlabs/django-projects/ labtest" fastcgi.server = (

Re: Only Simplified Chinese translation not working?

2007-09-13 Thread Ryan K
Yesafter checking the Django sources I saw that zh_CN is where the .po .mo files should go. On Sep 13, 10:02 am, Nis Jørgensen <[EMAIL PROTECTED]> wrote: > Ryan K skrev:> Hi. I have a few languages I've translated my site into. They > all work > > except Simplified Chinese. Any hints as to

Re: Only Simplified Chinese translation not working?

2007-09-13 Thread Ryan K
You are correct Nis...in django.utils.translation.trans_real.to_locale. No idea why the two need be any different... On Sep 13, 10:02 am, Nis Jørgensen <[EMAIL PROTECTED]> wrote: > Ryan K skrev:> Hi. I have a few languages I've translated my site into. They > all work > > except Simplified

Re: HELP needed POST and Python

2007-09-13 Thread AniNair
Hello, I wish to make an app that takes id (as integer ) from the user and displays details. I am using GET to take the value from the user to the view. Now I have the id in variable uid in a function disp_list(). def disp_list(request): uid = request.GET['id_user']

Re: HELP needed POST and Python

2007-09-13 Thread AniNair
It's working fine now. thank you --~--~-~--~~~---~--~~ 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

Re: HELP needed POST and Python

2007-09-13 Thread AniNair
Hello, I wish to make an app that takes id (as integer ) from the user and displays details. I am using GET to take the value from the user to the view. Now I have the id in variable uid in a function disp_list(). def disp_list(request): uid = request.GET['id_user']

how to access the host-name in settings.py

2007-09-13 Thread Julian
hello, in a view it's easy to find out under wich host the django-project ist running: {{{ def view(request): from django import http hostname = http.get_host(request) }}} hostname ist set to localhost:8000 running the django-app with ./ manage.py runserver but how do i access the full

Re: Initial value for a choices field in admin?

2007-09-13 Thread Ana
> > the 'default' keyword argument should work, but be sure to use the > > stored-value(first) element from the stored/representation tuple you use. > > > ie if your UNITS tuple is defined > > > >>> UNITS = ( ('in', 'Inches'), ('cm', 'Centimeters'), ) > > > you'll want to use > > > >>> class

Re: Populating a form

2007-09-13 Thread Peter Melvyn
On 9/13/07, MikeHowarth <[EMAIL PROTECTED]> wrote: > Look at form_for_instance in newforms: I am not sure if it could help me. I try to demostrate my problem on the view fragment handling post request: form = MyHTMLForm(request.POST) if not form.is_valid(): # will render bound form else:

Re: mod_python memory consumption and tuning issues

2007-09-13 Thread Graham Dumpleton
On Sep 13, 6:18 pm, omat <[EMAIL PROTECTED]> wrote: > Hi, > > This is more of a python / mod_python configuration issue, but there > had been some discussions on this list ([1]), and django-users is > where I feel home, so I am posting here. Sorry. > > I am running 7 Django sites with an Apache +

Django - Password field and manipulators

2007-09-13 Thread cschand
I have a login form. The model follows class Login(models.Model): user_name = models.CharField(max_length=20) password = models.CharField(max_length=20) In my view i am trying to create a login form using manipulator def login(request): manipulator = Login.AddManipulator() form

Re: how to access the host-name in settings.py

2007-09-13 Thread Alex Koshelev
Where is no way to find host name in settings module. To solve the problem you can split your settings.py file into host-specified- settings.py and settings.py Into settings.py: from host-specified-settings import * So you can have one settings.py but many host-specified files at different

Re: django & trac on the same lighttpd?

2007-09-13 Thread Chris Moffitt
Yes, you can absolutely have trac and django on the same instance. When you say it doesn't work, what is happening? -Chris --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this

Re: django-voting question

2007-09-13 Thread [EMAIL PROTECTED]
Thanks Samuel. I tried that, too, but all p.X seemed to return was the index of the tuple (1, 2, etc). On Sep 12, 2:54 pm, Samuel Adam <[EMAIL PROTECTED]> wrote: > Try this : > > {% for p in posts %} > {{ p.0 }} > {{ p.1 }} > {% endfor %} > > :P

Re: Django deployment à lá Capistrano

2007-09-13 Thread rex
Hello. I'd be interested in helping with writing a Capistrano replacement for Django in python (not a port!). I'm relatively new to django sites, but quite an old hand at python. Regarding names... surely this is the least important part of a project like this :) My 2c though: dojango!

Question about Django+Feedjack

2007-09-13 Thread Chandra
Hi, I have installed Django and then feedjack, everything went on fine. I created a site and subscribed to some feeds. When I run the feedjack_update.py script it is grabbing all the posts from feeds and posts are visible in the admin interface. But I couldn't see any posts in the main site.

Signals not working correctly

2007-09-13 Thread Greg
Hello, I'm trying to use signals so that when a Publication gets deleted from within the Admin it will 'assert False, "Here"' (This will obviously change at a later date). Currently, when I delete a Publication (in the django admin) no assert statement is raised. So I guess that means that my

Signals not working correctly

2007-09-13 Thread Greg
Hello, I'm trying to use signals so that when a Publication gets deleted from within the Admin it will 'assert False, "Here"' (This will obviously change at a later date). Currently, when I delete a Publication (in the django admin) no assert statement is raised. So I guess that means that my

two apps in project using comments. Skip 'posted.html'?

2007-09-13 Thread hotani
First off, this is only working at all because one app is using free comments while the other is using the standard non-free comment system. Which means they can use separate templates (free_preview.html vs preview.html). This is all great until I come to the common template, 'posted.html'.

tinymce popups in the admin interface

2007-09-13 Thread Thomas Badran
Any one have some nice css/theme for making tiny mce look like the rest of the admin interface. It integrates so nicely anyway, and would be awesome to have it look the same. Thanks Tom --~--~-~--~~~---~--~~ You received this message because you are subscribed

Is Britney Spears washed up?

2007-09-13 Thread Juicy Hilton
Has Britney killed off her career? *Britney Spears is back in

Deleting the relations and not the objects?

2007-09-13 Thread Xan
hi, Suppose for example that we have: class Aclass(models.Model): be = models.ForeignKey('B') ce = models.ManytoManyfield('C') class B(models.Model): [...] class C(models.Model): [...] Suppose that with admin interface, I put: be = b1 (b1 is B) ce has

Validating dynamically generated fields (guess i'll need a metaclass)

2007-09-13 Thread [EMAIL PROTECTED]
Hi all, I'm adding elements to the DOM so i will not know the number of elements the HTML form will be having beforehand, hence cannot define a form class with the exact number of fields i need. Once the form is POSTed i'm creating a Form instance and setattr-ing the fields to it. The problem

ANN: django-admin-uploads (media browser for django admin)

2007-09-13 Thread Peter Baumgartner
http://code.google.com/p/django-admin-uploads/ File/media browser for Django admin interface. Designed to insert images and files into textareas in the admin interface with a simple GUI interface. Just posted this on Google Code. Thought some of you might find it helpful. -- Pete

Re: tinymce popups in the admin interface

2007-09-13 Thread patrickk
you might wanna take a look at: http://trac.dedhost-sil-076.sil.at/trac/filebrowser/wiki there are some screenhosts including tinymce. we didn´t do all the buttons, because we don´t need them. we also re-styled the admin a bit. if that´s what you´re looking for, just drop me an email. patrick

Re: ANN: django-admin-uploads (media browser for django admin)

2007-09-13 Thread Dmitry Shevchenko
Wow, Peter, thank you very-very much, it's exactly what i've been looking for, great work! :) 2007/9/13, Peter Baumgartner <[EMAIL PROTECTED]>: > > > http://code.google.com/p/django-admin-uploads/ > File/media browser for Django admin interface. Designed to insert > images and files into

Re: ANN: django-admin-uploads (media browser for django admin)

2007-09-13 Thread Dmitry Shevchenko
Oh, and i think that it would be a great idea to provide some way to show uploaded data only for specific item (e.g. article, news). 2007/9/13, Dmitry Shevchenko <[EMAIL PROTECTED]>: > > Wow, Peter, thank you very-very much, it's exactly what i've been looking > for, great work! :) > > >

Re: ANN: django-admin-uploads (media browser for django admin)

2007-09-13 Thread Peter Baumgartner
On 9/13/07, Dmitry Shevchenko <[EMAIL PROTECTED]> wrote: > Oh, and i think that it would be a great idea to provide some way to show > uploaded data only for specific item (e.g. article, news). Not on my priority list, but it's open-source, have at it :)

ifequal function not working?

2007-09-13 Thread John M
I have a view / template where im passing in a queryset and a value of what the current selected record, and am tring to setup a option pulldown to show the selected record. My problem is that I can't get the passed in selected record to match the ID of the queryset. for example: {% ifequal

Re: Signals not working correctly

2007-09-13 Thread RajeshD
On Sep 13, 11:13 am, Greg <[EMAIL PROTECTED]> wrote: > Hello, > I'm trying to use signals so that when a Publication gets deleted from > within the Admin it will 'assert False, "Here"' (This will obviously > change at a later date). Currently, when I delete a Publication (in > the django

Re: How to automatically apply a method to all fields in newforms subclass?

2007-09-13 Thread Doug B
I think you can make a custom form field to do your validation check for you. def StrippedField(forms.CharField): def clean(self,value): #do your validation here --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google

admin interface, search fields for many-to-many relationships

2007-09-13 Thread Alice
I'm running into trouble using the admin interface's search feature, probably due to the default way that tables are being joined. I have an Actor and a Group, and a many-to-many relationship between them. (So Actors can be in multiple Groups, and Groups can have multiple Actors). For the Group

Re: Validating dynamically generated fields (guess i'll need a metaclass)

2007-09-13 Thread Doug B
Could you just use a collection of forms with different prefixes (which posted back via a hidden field generated by your script)? add to each of your element sets. class RoomShared(Form): room_type = IntegerField(widget=Select(choices=BEDROOM_TYPES)) room_price = IntegerField()

Re: ifequal function not working?

2007-09-13 Thread John M
the ID is the primary key ID generated by django on models. basically, it's not the syntax im having issue with, i think the selected_id is being passed / parsed as a string not an intenger like ID is. J On Sep 13, 12:45 pm, Alex Koshelev <[EMAIL PROTECTED]> wrote: > Hmm... What is

How to automatically apply a method to all fields in newforms subclass?

2007-09-13 Thread Nimrod A. Abing
Hello, I have several forms that I subclass from a subclass of newforms: # newforms is aliased as forms class StrippedFieldsForm(forms.Form) def strip_field(self, field, error_message): if (self.clean_data.get(field)): data = self.clean_data[field].strip() if

Re: ifequal function not working?

2007-09-13 Thread Alex Koshelev
Hmm... What is `recordset`? QuerySet? QuerySet doesn't have id attribute. {% for recod in recodeset %} {% ifequal record.id selected_id %} Selected! {% endifequal %} {% endfor %} --~--~-~--~~~---~--~~ You received this message because you are subscribed to the

Django Admin page says a ForeignKey("self", null=True) field is required

2007-09-13 Thread Martin Taylor
I've created a very simple Django app to model a tree (like a file system directory tree). Here's the model.py file: from django.db import models # # Define constants used to control sizes of DB fields # MAX_NAME = 100 # Maximum size of an object's Name field # # Create your models here. #

Re: ifequal function not working?

2007-09-13 Thread jake elliott
hi john - John M wrote: > {% ifequal selected_id recordset.id %} never seems to work. > > where selected_id = 1 > recordset has ID from 1 - 10 just a guess - are selected_id and recordset.id really the same type? {% ifequal %} will not match for example '1' == 1 best, jake

reverse select_related()

2007-09-13 Thread Michael Elsdoerfer
I am using a unique=True foreign key relationship to model inheritance, as suggested by the documentation. Say a TypedItem model that has a FK to BaseItem. Now I am in a situation where it would be really nice to be able to access the typed item from within the base item, e.g. the one row in

Re: form_for_instance + user profile

2007-09-13 Thread MikeHowarth
Well I thought I had this working but it turns out it was previous form I had set up manually. At the moment I'm getting no form returned at all, from reading the documentation I'm struggling to see what I'm doing wrong. My UserProfile model is sat in eshop.shop.models, I'm referencing this in

Re: ERROR: permission denied for relation

2007-09-13 Thread [EMAIL PROTECTED]
I finally found my own answer. I am running on django 91 but strangely enough when I imported a new model into my database my default user was assigned access to that table instead of the user that I had assigned to it. So I went into postgres and changed that and all is well. anyone know why

Re: Django Admin page says a ForeignKey("self", null=True) field is required

2007-09-13 Thread James Bennett
On 9/13/07, Martin Taylor <[EMAIL PROTECTED]> wrote: > Obviously the first folder in the folder tree, or any top level > folder, will not have a Parent. I don't really want to create an > artificial top level Parent like "root". Any explanation of why this > is happening and what to do to fix it

Re: django + sqlalchemy = ?

2007-09-13 Thread Ken Kuhlman
Sorry, my interest in Django is too abstracted for that. I've got enough vested interest to want to keep track of the situation, but not enough to make the push myself. I'm sure you know the drill. I've done a little more digging since my post, and found Adam Gomaa's excellent blog entry [1]

content types question

2007-09-13 Thread [EMAIL PROTECTED]
Helo all, I have been working with middleware and I need to get a content_type to be returned so that I can store it in a table. No matter what part of the site I go to I can't get a content_type to be returned in my headers: 'CONTENT_TYPE': None, What triggers this to return an actual number

can't inherit from models?

2007-09-13 Thread mthorley
Please some one explain to me why I can't do this, or what __metaclass__ hack I have to pull to get it to work? I searched google and the list and saw a lot of old (7/2006) pages and discussions about this, but nothing current. from django.db import models from django.contrib.auth.models import

Re: Django Admin page says a ForeignKey("self", null=True) field is required

2007-09-13 Thread Martin Taylor
Found the solution myself: It seems that you must have both "null=True" and "blank=True" to get the desired behavior of "not required" for the "Parent" field. My modified model has this line now: Parent = models.ForeignKey("self", null=True, blank=True, verbose_name="ParentFolder") On Sep

Re: django & trac on the same lighttpd?

2007-09-13 Thread Graham Dumpleton
On Sep 14, 1:31 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > I did it on Apache with mod-python. The problem I ran into was that I > couldn't deploy Django to the root of my site and still serve up other > content. I ended up having trac and my Django site sitting in > subdirectories,

Re: can't inherit from models?

2007-09-13 Thread Russell Keith-Magee
On 9/14/07, mthorley <[EMAIL PROTECTED]> wrote: > > Please some one explain to me why I can't do this, or what > __metaclass__ hack I have to pull to get it to work? I searched google > and the list and saw a lot of old (7/2006) pages and discussions about > this, but nothing current. Model

ATTN: Moving djangoproject.com to a new server!

2007-09-13 Thread Jacob Kaplan-Moss
Howdy folks -- I'm about to move djangoproject.com (and subdomains) to a new server. The short version of the changes: DNS should update within the hour, but if it doesn't, you'll want to put this in your /etc/hosts (or equivalent):: 64.207.133.18 djangoproject.com 64.207.133.18

Re: Arithmetic operations in a templete

2007-09-13 Thread Scott Anderson
On Thu, 2007-08-23 at 21:59 +0800, Russell Keith-Magee wrote: [...] > Generally speaking - you don't. > > This is by design. Django tries very hard to prevent you from putting > logic into a template. Logic and calculations belong in the view; the > template shouldn't have any need for

Re: Arithmetic operations in a templete

2007-09-13 Thread James Bennett
On 9/13/07, Scott Anderson <[EMAIL PROTECTED]> wrote: > What I'm hoping, however, is that this missive was moot, because you'll > say, "no, Scott, you should just do *this*:", followed by an elegant and > reasonable solution that I, as a relative newcomer to Django, have not > yet considered.