Templaite:display li items alternatively using for

2008-10-31 Thread Xian Chen
Hi, I want to display a list of items by using {% for item in items %}. To make the web pages look better, I want to use two kinds of alternatively. E.G item item My question is how can i use the tags to implement this requirement? Any build-in tags for this? Thanks in advance,

Re: alert table while updating model automatically

2008-10-31 Thread Karen Tracey
On Sat, Nov 1, 2008 at 12:51 AM, Xian Chen <[EMAIL PROTECTED]> wrote: > Hi All, > > I want to know whether Django support alerting the tables automatically > while I modify the models or not. > > Suppose the website has run a long time and stored lots of data. In this > case, the administrator

Re: FileField; url oddness

2008-10-31 Thread csingley
On Oct 31, 7:05 pm, "Marty Alchin" <[EMAIL PROTECTED]> wrote: > My guess is that you need a trailing slash here. Without it, the > urljoin() function doesn't know 'reports' is a directory, so  it > strips 'reports' out and replaces it with the path from the database. > This is why your

Re: Using settings.py mechanism for application settings

2008-10-31 Thread James Bennett
On Fri, Oct 31, 2008 at 8:29 PM, pk <[EMAIL PROTECTED]> wrote: > Am I missing something? Should that mechanism be refactored so that it > can be used for user applications? Is there a better way to do > application level configuration -- i.e. for app designed to be > distributed and reused? If

alert table while updating model automatically

2008-10-31 Thread Xian Chen
Hi All, I want to know whether Django support alerting the tables automatically while I modify the models or not. Suppose the website has run a long time and stored lots of data. In this case, the administrator wants to modify the model to add/remove some properties. Does the corresponding

Re: Using settings.py mechanism for application settings

2008-10-31 Thread Sahil R Cooner
I'm a little confused as to the purpose behind the question, it feels pretty general, so I have a few questions. 1. When you say application are you talking about django apps generated via the "manage.py startapp" command? 2. LazySettings allows for a "proxying" of the Global settings in your

Re: How to modify field error wording ?

2008-10-31 Thread Karen Tracey
On Fri, Oct 31, 2008 at 11:46 PM, nkulmati <[EMAIL PROTECTED]> wrote: > > Hi all: > > > How to modify field error wording ? > Please do not send me to the page "Form-subclasses-and-modifying-field- > errors" in the docs. > > All I need is to override the error messages, NOT the validation >

Re: Is there a way to use the Cut Filter to only do the first instance?

2008-10-31 Thread Jeff FW
If you know the length of the string that you want to cut off the beginning, you could use slice: http://docs.djangoproject.com/en/dev/ref/templates/builtins/#slice Really, though, you might be going about this in a strange way. It might be better to use the url tag to get the correct URL that

How to modify field error wording ?

2008-10-31 Thread nkulmati
Hi all: How to modify field error wording ? Please do not send me to the page "Form-subclasses-and-modifying-field- errors" in the docs. All I need is to override the error messages, NOT the validation system. That page does not address this need for some reason! I don't want to start

Using settings.py mechanism for application settings

2008-10-31 Thread pk
There are always needs for application level configuration settings. I really like the way settings.py works, with a package (django) level default settings overridable by local settings. However looking at the whole LazySettings setup it is not easily used outside of django/conf. Am I missing

Re: HttpRequest with chunked encoding is not buffered

2008-10-31 Thread Tomáš Brambora
I have a standard Django installation without any changes in the settings (except adding mysql db to the settings.py) and I'm sending the message to localhost:8000, so there is no proxy or anything else in the way. Still, the request body comes after me sending the response... On Fri, Oct 31,

Re: Using Django

2008-10-31 Thread Alessandro
2008/10/31 [EMAIL PROTECTED] <[EMAIL PROTECTED]>: > > Hello, > > I'm new to Django and it's taken me a while to get things setup > correctly on Dreamhost. I've done the tutorials on my local machine > prior to setting things up on Dreamhost but it seems like I'm missing > instructions on how to

Re: FileField; url oddness

2008-10-31 Thread Marty Alchin
On Fri, Oct 31, 2008 at 1:42 PM, csingley <[EMAIL PROTECTED]> wrote: > report_storage = ReportStorage(location='%s/reports' % > settings.MEDIA_ROOT, >base_url=settings.MEDIA_URL > +'reports') My guess is that you need a trailing slash here. Without it, the

Re: Is there a way to host serveral django projects under a single virtual host

2008-10-31 Thread Graham Dumpleton
On Nov 1, 4:54 am, Håkan Waara <[EMAIL PROTECTED]> wrote: > 31 okt 2008 kl. 16.43 skrev ilyail3: > > > > > > > hello people, Is there a way to host several django projects under a > > single virtual host? > > I know this is possible with mod_php with wildcards as server alias > > > and later

Re: Response is sent before post body arrives

2008-10-31 Thread Graham Dumpleton
On Nov 1, 8:22 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > Hi, > > I'm using chunked transfer encoding and i send a post http request to > my Django application. But when I try to read the post body, it's not > there (request.POST.keys() returns []). according to Wireshark, I send >

Re: Multiple Copies of Libraries, Apache/mod_wsgi and Performance

2008-10-31 Thread Graham Dumpleton
On Nov 1, 10:06 am, Graham Dumpleton <[EMAIL PROTECTED]> wrote: > On Nov 1, 8:44 am, "Naitik Shah" <[EMAIL PROTECTED]> wrote: > > > > > On Fri, Oct 31, 2008 at 1:01 PM, Naitik Shah <[EMAIL PROTECTED]> wrote: > > > On Thu, Oct 30, 2008 at 10:58 PM, Graham Dumpleton < > > > [EMAIL PROTECTED]>

Re: Multiple Copies of Libraries, Apache/mod_wsgi and Performance

2008-10-31 Thread Graham Dumpleton
On Nov 1, 8:44 am, "Naitik Shah" <[EMAIL PROTECTED]> wrote: > On Fri, Oct 31, 2008 at 1:01 PM, Naitik Shah <[EMAIL PROTECTED]> wrote: > > On Thu, Oct 30, 2008 at 10:58 PM, Graham Dumpleton < > > [EMAIL PROTECTED]> wrote: > > >> In respect of having nginx in front, one of the over benefits of

Re: HttpRequest with chunked encoding is not buffered

2008-10-31 Thread Graham Dumpleton
[EMAIL PROTECTED] wrote: > Hello, > I'm trying to receive a possibly large XML message via HttpRequest > (POST method) with chunked encoding. However, when I send a response, > I found out (using Wireshark) that the response is being sent before > the whole POST request body is available. I

Re: Migrate app from MySQL to PostgreSQL

2008-10-31 Thread Naitik Shah
On Fri, Oct 31, 2008 at 6:29 AM, varikin <[EMAIL PROTECTED]> wrote: > > Check out django_extensions app, > http://code.google.com/p/django-command-extensions/. > It has a command, dumpscript, which creates a python script to > populate the database. That might get ride of the incompatible types.

HttpRequest with chunked encoding is not buffered

2008-10-31 Thread [EMAIL PROTECTED]
Hello, I'm trying to receive a possibly large XML message via HttpRequest (POST method) with chunked encoding. However, when I send a response, I found out (using Wireshark) that the response is being sent before the whole POST request body is available. I expected Django to be buffering the

ManytoMany using intermediary table and custom db_table

2008-10-31 Thread Mark
I'm having a little trouble tracking a down a small problem. My models (which are working) look like this (with some of the boilerplate cut out): class Image(models.Model): id = models.AutoField(primary_key=True) pub_date = models.DateTimeField(blank=True) caption =

Response is sent before post body arrives

2008-10-31 Thread [EMAIL PROTECTED]
Hi, I'm using chunked transfer encoding and i send a post http request to my Django application. But when I try to read the post body, it's not there (request.POST.keys() returns []). according to Wireshark, I send the response and right after that comes the request body. Do you know how to wait

FileField; url oddness

2008-10-31 Thread csingley
Hi, I've got a model defined like so: """ from django.conf import settings from django.db import models from django.core.files.storage import FileSystemStorage class ReportStorage(FileSystemStorage): @staticmethod def filepath(instance, filename): subdir =

Re: Multiple Copies of Libraries, Apache/mod_wsgi and Performance

2008-10-31 Thread Naitik Shah
On Fri, Oct 31, 2008 at 1:01 PM, Naitik Shah <[EMAIL PROTECTED]> wrote: > On Thu, Oct 30, 2008 at 10:58 PM, Graham Dumpleton < > [EMAIL PROTECTED]> wrote: > >> >> In respect of having nginx in front, one of the over benefits of that >> was that nginx could have been quite selective about the URLs

Using Django

2008-10-31 Thread [EMAIL PROTECTED]
Hello, I'm new to Django and it's taken me a while to get things setup correctly on Dreamhost. I've done the tutorials on my local machine prior to setting things up on Dreamhost but it seems like I'm missing instructions on how to actually use Django. Yes, I've read the "Using Django" section

Re: Multiple Copies of Libraries, Apache/mod_wsgi and Performance

2008-10-31 Thread Naitik Shah
On Thu, Oct 30, 2008 at 10:58 PM, Graham Dumpleton < [EMAIL PROTECTED]> wrote: > > If there are definite idle periods of reasonable size, perhaps look at > 'inactivity-timeout' option to WSGIDaemonProcess. This way daemon > process will be restarted when doing nothing, and providing that >

Re: How to setup django-apache-mod_wsgi without killing existing php site?

2008-10-31 Thread Ross Dakin
I run prefork with mod_wsgi (embedded) and mod_php. No troubles so far, though I'm using MySQL with PHP and Postgres with Django, so I'm not likely to experience the MySQL library issues Graham described. I've read that mod_php actually doesn't like worker MPM, because come common PHP

Re: Is there a way to host serveral django projects under a single virtual host

2008-10-31 Thread Håkan Waara
31 okt 2008 kl. 16.43 skrev ilyail3: > > hello people, Is there a way to host several django projects under a > single virtual host? > I know this is possible with mod_php with wildcards as server alias > > and later map urls to dirs using mod_rewrite > > >DocumentRoot /var/www >

Re: updating a single field / attribute, is it possible? or better practices?

2008-10-31 Thread omat
Exactly. Thanks for the reference. -- oMat On Oct 31, 6:54 pm, "Karen Tracey" <[EMAIL PROTECTED]> wrote: > On Fri, Oct 31, 2008 at 12:39 PM, omat <[EMAIL PROTECTED]> wrote: > > > Hi all, > > > Is it possible to update a chosen subset of attributes of a model > > instance? > >

Re: Execute a java program

2008-10-31 Thread [EMAIL PROTECTED]
On Oct 31, 2:21 pm, varikin <[EMAIL PROTECTED]> wrote: > On Oct 30, 5:12 am, "[EMAIL PROTECTED]" > > > > <[EMAIL PROTECTED]> wrote: > > Hi everyone I am newbie to django and I am italian so excuse me for my > > english :P > > I have to execute a java program very simple look something like

Re: Is there a way to host serveral django projects under a single virtual host

2008-10-31 Thread Sahil R Cooner
Of course there is :), for the VirtualHost *, means everything, instead use names like projecta, projectb, etc...if that doesn't make sense then the best thing to do prior to messing with your settings is to read the documentation from apache on VirtualHost. --neuro On Fri, Oct 31, 2008 at

Re: updating a single field / attribute, is it possible? or better practices?

2008-10-31 Thread Karen Tracey
On Fri, Oct 31, 2008 at 12:39 PM, omat <[EMAIL PROTECTED]> wrote: > > Hi all, > > Is it possible to update a chosen subset of attributes of a model > instance? > http://code.djangoproject.com/ticket/4102 asks for this, I believe. Karen --~--~-~--~~~---~--~~ You

updating a single field / attribute, is it possible? or better practices?

2008-10-31 Thread omat
Hi all, Is it possible to update a chosen subset of attributes of a model instance? In my case, the view function saves a model instance which was updated in the model's custom save() method. Thus, the update by the save() is overridden. Pseudo code of the scenario: class MyModel(Model):

Re: Is there a way to use the Cut Filter to only do the first instance?

2008-10-31 Thread Karen Tracey
On Fri, Oct 31, 2008 at 11:55 AM, Frank Peterson <[EMAIL PROTECTED]>wrote: > > I am using the following > {{ section.get_absolute_url|cut:"/news/" }} > on a string that is > /news/new-york-jets/news/ > > I need to remove the first /news but the CUT filter removes all > instances of it, is there a

Is there a way to use the Cut Filter to only do the first instance?

2008-10-31 Thread Frank Peterson
I am using the following {{ section.get_absolute_url|cut:"/news/" }} on a string that is /news/new-york-jets/news/ I need to remove the first /news but the CUT filter removes all instances of it, is there a way for me to remove on the first "/news"?

Is there a way to host serveral django projects under a single virtual host

2008-10-31 Thread ilyail3
hello people, Is there a way to host several django projects under a single virtual host? I know this is possible with mod_php with wildcards as server alias and later map urls to dirs using mod_rewrite DocumentRoot /var/www ServerName www.projects ServerAlias *.projects

Re: Custom change list and list_display

2008-10-31 Thread Karen Tracey
On Fri, Oct 31, 2008 at 10:24 AM, Fabio Natali <[EMAIL PROTECTED]>wrote: > > Rajesh Dhawan wrote: > [...] > > > What's more, how can I make those callables columns sortable > > > within the change list page? I'm working with trunk. I read this: > > > http://code.djangoproject.com/changeset/9211

Re: Custom change list and list_display

2008-10-31 Thread Fabio Natali
Karen Tracey wrote: [...] > > Ok, we can't sort on callable columns. Anyway that's a pity... > The sorting is done at the database level (SQL ORDER BY), as is the > pagination (SQL OFFSET & LIMIT), so it is efficient (DBs are optimized to do > these things efficiently). Karen thank you very

Re: Custom change list and list_display

2008-10-31 Thread Fabio Natali
Rajesh Dhawan wrote: [...] > > What's more, how can I make those callables columns sortable > > within the change list page? I'm working with trunk. I read this: > > http://code.djangoproject.com/changeset/9211 Does this mean that I > > can add some callable and then alphabetically order them? >

Re: inspect a model's field's option's values

2008-10-31 Thread Mark Wolgemuth
That's exactly what I'm looking for. I'll probably try adding that feature to the model base class or as a mixin. @classmethod def get_field_option_by_name(self, fieldname, optionname): field = self._meta.get_field_by_name(fieldname)[0] return getattr(fieldname, optionname) possibly

browser setting takes over /i18n/setlang?language=english

2008-10-31 Thread Genis Pujol Hamelink
Hello, I'm checking out the i18N features and apparently the browser setting takes over always, if I try to select the language via the link it doesn't work, it just falls back to whatever language is set in the browser (i.e. u click and nothing happens, no error messages, nothing). If I change

Re: Migrate app from MySQL to PostgreSQL

2008-10-31 Thread varikin
On Oct 30, 1:57 pm, "Naitik Shah" <[EMAIL PROTECTED]> wrote: > I ran into issues with this approach as well - first uniqueness constraints > were failing, which I managed to fix manually. Next I got ContentType > matching query issues, which I have not fixed yet. > > I was hoping to come up

Re: Why is my string not auto escaped?

2008-10-31 Thread Rajesh Dhawan
> > > > So if these built in filters are marking my strings safe, inspite of > > > unsafe data being passed in, should they not handle escaping as well? > > > The problem seems to be that your filter function doesn't mark itself > > with an is_safe attribute (defaulting it to False). So try

Re: Execute a java program

2008-10-31 Thread varikin
On Oct 30, 5:12 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > Hi everyone I am newbie to django and I am italian so excuse me for my > english :P > I have to execute a java program very simple look something like this: > > public class Book { >     public static void main(String[] args)

Re: Why is my string not auto escaped?

2008-10-31 Thread varikin
On Oct 30, 6:58 am, Rajesh Dhawan <[EMAIL PROTECTED]> wrote: > On Oct 30, 1:30 am, shabda <[EMAIL PROTECTED]> wrote: > > > So if these built in filters are marking my strings safe, inspite of > > unsafe data being passed in, should they not handle escaping as well? > > The problem seems to be

populating forms using models

2008-10-31 Thread Vokial
Hi I'm working on a registration form which is based, among the others, on this model: class City(models.Model): prov_name = models.CharField(verbose_name='Provincia',max_length=50) (obviously i'm writing down just the field i'm interested in to save some space..) In the form i have to put

Re: User.email

2008-10-31 Thread [EMAIL PROTECTED]
On Oct 31, 1:32 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > On Oct 31, 11:01 am, Daniel Roseman <[EMAIL PROTECTED]> > wrote: > > > > > On Oct 31, 9:51 am, "Alfredo Alessandrini" <[EMAIL PROTECTED]> > > wrote: > > > > Hi, > > > > I've this model: > > > > from django.contrib.auth.models

Re: User.email

2008-10-31 Thread [EMAIL PROTECTED]
On Oct 31, 11:01 am, Daniel Roseman <[EMAIL PROTECTED]> wrote: > On Oct 31, 9:51 am, "Alfredo Alessandrini" <[EMAIL PROTECTED]> > wrote: > > > > > Hi, > > > I've this model: > > > from django.contrib.auth.models import User > > > class Player(models.Model): > >     first_name =

Re: Problem with pyExcelerator and response

2008-10-31 Thread Steve Holden
Try replacing workbook.save('output.xls') return response with workbook.save('output.xls') response.write(open('output.xls', 'b').read()) return response regards Steve laspal wrote: > So how can I fix it. > I am not able to fix it. > Thanks > > On Oct 30, 4:26 pm, Steve

Re: Problem with pyExcelerator and response

2008-10-31 Thread laspal
So how can I fix it. I am not able to fix it. Thanks On Oct 30, 4:26 pm, Steve Holden <[EMAIL PROTECTED]> wrote: > laspalwrote: > > Any one can help me out. > > Thanks. > > > On Oct 29, 11:41 am,laspal<[EMAIL PROTECTED]> wrote: > >> Hi, > >> I am trying to create Excel file usingpyExceleratorbut

Re: database API from external tools?

2008-10-31 Thread megrez80
I'm trying to accomplish the same thing: use django standalone. After getting DJANGO_SETTINGS_MODULE set correctly so that it finds my settings.py, I get: File "C:\Python25\Lib\site-packages\django\db\models\base.py", line 51, in __new__ kwargs = {"app_label":

Re: User.email

2008-10-31 Thread Daniel Roseman
On Oct 31, 9:51 am, "Alfredo Alessandrini" <[EMAIL PROTECTED]> wrote: > Hi, > > I've this model: > > from django.contrib.auth.models import User > > class Player(models.Model): >     first_name = models.CharField(max_length=30) >     last_name = models.CharField(max_length=40) >     email =

User.email

2008-10-31 Thread Alfredo Alessandrini
Hi, I've this model: from django.contrib.auth.models import User class Player(models.Model): first_name = models.CharField(max_length=30) last_name = models.CharField(max_length=40) email = models.EmailField() user = models.ForeignKey(User, blank=True, null=True) I try to set

Re: Adding properties to models at run-time.

2008-10-31 Thread Daniel Roseman
On Oct 30, 10:13 pm, Alex G <[EMAIL PROTECTED]> wrote: > Thanks for the reply, DR. > > How would I use the generic relationship without the backward link? > > I have the normal auth.user class, and I have the my.user class that > extends it and has a polymorphic link pointing at auth.user.  The >

Re: How to setup django-apache-mod_wsgi without killing existing php site?

2008-10-31 Thread Håkan Waara
31 okt 2008 kl. 04.23 skrev Graham Dumpleton: > > > > On Oct 31, 10:14 am, Håkan Waara <[EMAIL PROTECTED]> wrote: >> Hi folks, >> >> I'm in the process of for the first time deploying a django site that >> (unfortunately) needs to share its Apache with an existing PHP site. >> >> I've been

Re: access request.user in clean method of ModelForm

2008-10-31 Thread Michel Thadeu Sabchuk
Hi Merrick, > How can I access request.user in a clean method of a ModelForm? > > class UserEmailForm(ModelForm): > ... > You can instantiate your form passing the request or the user as argument: class UserEmailForm(ModelForm): def __init__(self, *args, **kw): self.request =

Re: 500 displayed instead of 404

2008-10-31 Thread janedenone
On 29 Okt., 14:00, Thomas Guettler <[EMAIL PROTECTED]> wrote: > > Thanks to all who answered, now I'll go looking for the person who > > messed with the development machine. > > Everybody can make mistakes. The root of the problem is (or was) > that you don't see tracebacks if

access request.user in clean method of ModelForm

2008-10-31 Thread Merrick
How can I access request.user in a clean method of a ModelForm? I have the following code in forms.py: === #profle email form class UserEmailForm(ModelForm): class Meta: model = User fields = ['email',] def clean_email(self): email_submitted =

Access request.user in a clean method of a ModelForm

2008-10-31 Thread Merrick
I have the code below: === class UserEmailForm(ModelForm): class Meta: model = User fields = ['email',] def clean_email(self): email_submitted = self.cleaned_data.get('email') email_exists =

Re: Query subset

2008-10-31 Thread Russell Keith-Magee
On Fri, Oct 31, 2008 at 4:08 PM, Tonne <[EMAIL PROTECTED]> wrote: > > So, what I've done is use Model.objects.values() to limit the returned > values, which is not ideal as I'm losing the objectness of the > queryset. > > I've worked around the loss Queryset.get_absolute_url by using a less >

Re: Query subset

2008-10-31 Thread Marcelo Ramos
On Fri, Oct 31, 2008 at 5:08 AM, Tonne <[EMAIL PROTECTED]> wrote: > > So, what I've done is use Model.objects.values() to limit the returned > values, which is not ideal as I'm losing the objectness of the > queryset. > > I've worked around the loss Queryset.get_absolute_url by using a less >

Re: Query subset

2008-10-31 Thread Tonne
Thanks Marcelo. --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED]

Re: fetching images from database

2008-10-31 Thread Marcelo Ramos
On Fri, Oct 31, 2008 at 4:06 AM, please smile <[EMAIL PROTECTED]> wrote: > Hi All, > > I have uploaded some images in a folder and also saved the image name > into data base table. > Now I need to fetch and display all the images to my client side web page . > How can I do this .Please help.

Re: Query subset

2008-10-31 Thread Tonne
So, what I've done is use Model.objects.values() to limit the returned values, which is not ideal as I'm losing the objectness of the queryset. I've worked around the loss Queryset.get_absolute_url by using a less than elegant semi-hardcoded url. So if I'm missing a blindingly obvious way of

Re: Query subset

2008-10-31 Thread Marcelo Ramos
On Fri, Oct 31, 2008 at 4:37 AM, Tonne <[EMAIL PROTECTED]> wrote: > > I have spent hours looking in the docs and one this list for an answer > to this problem: > > I have a model that has, for example, 20 fields. > > On my site's homepage, where I'd like to offer a preview version of > the

Query subset

2008-10-31 Thread Tonne
I have spent hours looking in the docs and one this list for an answer to this problem: I have a model that has, for example, 20 fields. On my site's homepage, where I'd like to offer a preview version of the object, I'd need to retrieve only say, half of those fields to be displayed. My

Re: Help regarding Login form in client side (front end) in Django.

2008-10-31 Thread Steve Holden
sadeesh Arumugam wrote: > Hi Friends, > > I want to create a login form in client side, anybody please send me > the Sample login page for the client side coding.. > Are you reading the answers to your questions before sending them out again? regards Steve

Help regarding Login form in client side (front end) in Django.

2008-10-31 Thread sadeesh Arumugam
Hi Friends, I want to create a login form in client side, anybody please send me the Sample login page for the client side coding.. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to

Re: Multiple Copies of Libraries, Apache/mod_wsgi and Performance

2008-10-31 Thread Graham Dumpleton
On Oct 31, 4:09 pm, "Naitik Shah" <[EMAIL PROTECTED]> wrote: > > Also indicate how much traffic each site gets and whether any would > > potentially be idle for periods, as can then look at inactivity > > timeouts etc. > > As embarrassing as it sounds, I don't have good numbers available yet.

fetching images from database

2008-10-31 Thread please smile
Hi All, I have uploaded some images in a folder and also saved the image name into data base table. Now I need to fetch and display all the images to my client side web page . How can I do this .Please help. Thanks --~--~-~--~~~---~--~~ You received this