Re: escape problem in django templates

2009-05-17 Thread ozgurisil
Karen, thanks for your effort. It is bizarre that the problem seems to be gone after I have restarted the computer. I don't know if I can reproduce the situation (in fact I hope I can't). On May 16, 6:17 pm, Karen Tracey wrote: > On Sat, May 16, 2009 at 12:23 AM, ozgurisil

Does a django social sharing widget app exist?

2009-05-17 Thread Aaron Maxwell
Hi. Is anyone aware of a django app that helps with providing social-network sharing buttons to pages? I'm talking about services like Add to Any (http://addtoany.com/), or the Wordpress plugin known as Sociable (http://yoast.com/wordpress/sociable/). Ideally this would be a django app you

Re: Seeking Example of MultipleChoiceField Example with dynamic Choices

2009-05-17 Thread Sam Chuparkoff
On Sun, 2009-05-17 at 20:01 -0700, Bobby Roberts wrote: > yeah i'm still lost... You don't need to change your form, just use form.cleaned_data in your view. Same example, a few more lines: >>> # our form ... >>> from django import forms >>> from django.contrib.auth.models import User >>> >>>

Re: Seeking Example of MultipleChoiceField Example with dynamic Choices

2009-05-17 Thread Bobby Roberts
> You should be looking in cleaned_data, see: > > http://docs.djangoproject.com/en/1.0/topics/forms/#processing-the-dat... > > For a ModelMultipleChoiceField, cleaned_data will be a list of model > instances. You shouldn't even have to think about the pk s. > > sdc yeah i'm still lost... this is

Re: Seeking Example of MultipleChoiceField Example with dynamic Choices

2009-05-17 Thread Sam Chuparkoff
On Sun, 2009-05-17 at 18:43 -0700, Bobby Roberts wrote: > in my view i have this: > > > if request.method=='POST': > form=FrmIdMessage(request.POST) > if form.is_valid(): #process valid form here > assert False, request.POST.get('posted_to','') > [snip] You

Re: Seeking Example of MultipleChoiceField Example with dynamic Choices

2009-05-17 Thread Bobby Roberts
On May 17, 4:23 pm, Bobby Roberts wrote: > > ...     users = forms.ModelMultipleChoiceField( > > ...         queryset=User.objects, > > ...         widget=forms.CheckboxSelectMultiple, > > ...         required=True) > > ...>>> User(username='sdc').save() > > >>>

Re: Seeking Example of MultipleChoiceField Example with dynamic Choices

2009-05-17 Thread Bobby Roberts
On May 17, 4:23 pm, Bobby Roberts wrote: > > ...     users = forms.ModelMultipleChoiceField( > > ...         queryset=User.objects, > > ...         widget=forms.CheckboxSelectMultiple, > > ...         required=True) > > ...>>> User(username='sdc').save() > > >>>

Re: Seeking Example of MultipleChoiceField Example with dynamic Choices

2009-05-17 Thread Bobby Roberts
On May 17, 4:23 pm, Bobby Roberts wrote: > > ...     users = forms.ModelMultipleChoiceField( > > ...         queryset=User.objects, > > ...         widget=forms.CheckboxSelectMultiple, > > ...         required=True) > > ...>>> User(username='sdc').save() > > >>>

Re: dictsort / regroup - custom order?

2009-05-17 Thread ringemup
Well, it was worth a shot. ;-) Thanks! On May 17, 6:27 pm, Alex Gaynor wrote: > On Sun, May 17, 2009 at 5:23 PM, ringemup wrote: > > > If I have a dict that needs to be sorted and regrouped, but I want to > > order the groups in a custom manner

Re: additional data on ManyToManyField and symmetrical

2009-05-17 Thread Russell Keith-Magee
On Sat, May 16, 2009 at 6:14 PM, Alex Rades wrote: > > Hi, > I have a model which looks like: > > class Person(models.Model): >    friends = models.ManyToManyField("self", through="Friendship") > > class Friendship(models.Model): >   person_a = models.ForeignKey(Person) >  

Re: RE searches using sqlite3 on server failing

2009-05-17 Thread Ned
Thank you for your reply, Karen. Your interpretations are correct. The searching works fine using sqlite3 on my windows development machine. The searching works fine on the Linux machine (Apache 2) using MySQL as the DB engine, but blows up when I try to use the sqlite3 engine there. I can use

Re: has_add_permission() isn't working properly

2009-05-17 Thread Sergio A.
here it is: http://code.djangoproject.com/ticket/11136 hope this will be considered, since it improves the user experience. Thanks for your feedback, Sergio On May 18, 12:19 am, Alex Gaynor wrote: > On Sun, May 17, 2009 at 5:15 PM, Karen Tracey

Re: RE searches using sqlite3 on server failing

2009-05-17 Thread Karen Tracey
On Sun, May 17, 2009 at 5:20 PM, Ned wrote: > > I would greatly appreciate any explanations or suggested > courses of action to get to the bottom of the problem described below. > If more information would be helpful I'd be glad to supply it. I'm > using Django 1.0. > > I

Re: LANGUAGE_CODE

2009-05-17 Thread Apple
friend ,you can do a judge operation ,mapping the English terms to the Chinese terms . that is all your need to do .because django is wirtten by english-spoken guys .(i am chinese but this is a english list ,so I write english) On 5/18/09, Kai Kuehne wrote: > > Hi, >

Re: parsing data from fileupload

2009-05-17 Thread Alex Gaynor
On Sun, May 17, 2009 at 5:39 PM, Patrick wrote: > > Filenames is also a table, but I'm interested in the data withing the > file. > > On May 17, 2:38 pm, Antoni Aloy wrote: > > 2009/5/17 Patrick : > > > > > How do I add data from a

Re: parsing data from fileupload

2009-05-17 Thread Patrick
Filenames is also a table, but I'm interested in the data withing the file. On May 17, 2:38 pm, Antoni Aloy wrote: > 2009/5/17 Patrick : > > > How do I add data from a fileupload to a database? > > For example, if I have a Book model that is for names

Re: please help me

2009-05-17 Thread Apple
thank you for your reply ,I will try . On 5/17/09, Eric Abrahamsen wrote: > > > On May 17, 2009, at 1:26 AM, Apple wrote: > >> >> I write some code like following: >>

Re: What's the recommended way to use ForeignKey?

2009-05-17 Thread Alex Gaynor
On Sun, May 17, 2009 at 5:31 PM, Thierry wrote: > > In the Django doc at > http://docs.djangoproject.com/en/dev/ref/models/fields/#django.db.models.ForeignKey > , > it mentions explicitly specifying the application label in 1.0: > > class Car(models.Model): >

What's the recommended way to use ForeignKey?

2009-05-17 Thread Thierry
In the Django doc at http://docs.djangoproject.com/en/dev/ref/models/fields/#django.db.models.ForeignKey, it mentions explicitly specifying the application label in 1.0: class Car(models.Model): manufacturer = models.ForeignKey('production.Manufacturer') The above is using a string for the

Re: dictsort / regroup - custom order?

2009-05-17 Thread Alex Gaynor
On Sun, May 17, 2009 at 5:23 PM, ringemup wrote: > > If I have a dict that needs to be sorted and regrouped, but I want to > order the groups in a custom manner rather than alphabetically by the > regrouping key... is that feasible? > > > The dictsort template filter just

dictsort / regroup - custom order?

2009-05-17 Thread ringemup
If I have a dict that needs to be sorted and regrouped, but I want to order the groups in a custom manner rather than alphabetically by the regrouping key... is that feasible? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google

Re: has_add_permission() isn't working properly

2009-05-17 Thread Alex Gaynor
On Sun, May 17, 2009 at 5:15 PM, Karen Tracey wrote: > On Sun, May 17, 2009 at 5:34 PM, Sergio A. wrote: > >> >> >> the issue seems not to be totally solved by the patch. >> >> If I have two classes A and B >> class A has a field being a foreign

Re: has_add_permission() isn't working properly

2009-05-17 Thread Karen Tracey
On Sun, May 17, 2009 at 5:34 PM, Sergio A. wrote: > > > the issue seems not to be totally solved by the patch. > > If I have two classes A and B > class A has a field being a foreign key to a B class field > in the admin, when I add an A element, I see the '+' button

Re: LANGUAGE_CODE

2009-05-17 Thread Kai Kuehne
Hi, 2009/5/17 sammysun : > > Hi: >When I set LANGUAGE_CODE = 'zh-cn' in the sitting file. I want to > get a 3 letters of month useing filter "date" in the template, e.g. > Useing {{ entry.pub_date|date:"M"}}, I will get "五月" in chinese, but > the one I expect is "May". How

Re: How do I override __unicode__ for User?

2009-05-17 Thread Kai Kuehne
Sorry, pressed that button too early: You could also write a default method inside your BlogPost model. Maybe something like: class BlogPost(models.Model): ... def author_name(self): return '%s %s' % (self.author.first_name, self.author.last_name)

Re: parsing data from fileupload

2009-05-17 Thread Antoni Aloy
2009/5/17 Patrick : > > How do I add data from a fileupload to a database? > For example, if I have a Book model that is for names of books and a > FileNames model that is used on a form, how do I populate Book.title. > > class FileNames(models.Model): >    title =

Re: How do I override __unicode__ for User?

2009-05-17 Thread Kai Kuehne
Hi, On Sun, May 17, 2009 at 10:59 PM, Thierry wrote: > > I currently have a blog model: > > [BlogPost Model] > > Right now, author is returning the default User.username.  I have > other models who has a ForeignKey to User, I want them to keep > defaulting to username

Re: has_add_permission() isn't working properly

2009-05-17 Thread Sergio A.
the issue seems not to be totally solved by the patch. If I have two classes A and B class A has a field being a foreign key to a B class field in the admin, when I add an A element, I see the '+' button on the foreign key field to B even though I do not have the rights to create a B element.

RE searches using sqlite3 on server failing

2009-05-17 Thread Ned
I would greatly appreciate any explanations or suggested courses of action to get to the bottom of the problem described below. If more information would be helpful I'd be glad to supply it. I'm using Django 1.0. I have a search application, in prototype stage, that makes use of regular

How do I override __unicode__ for User?

2009-05-17 Thread Thierry
I currently have a blog model: class BlogPost(models.Model): title = models.CharField(max_length=150) body = models.TextField() author = models.ForeignKey(User) timestamp = models.DateTimeField() Right now, author is returning the default User.username. I have other models who

Re: Oracle connection "cx_Oracle.DatabaseError: ORA-00911: invalid character"

2009-05-17 Thread Karen Tracey
On Sun, May 17, 2009 at 3:14 PM, Doug wrote: > > When I attempt to use Oracle as the backend for Django, I get this > error on issuing the 'syndb' command: > "cx_Oracle.DatabaseError: ORA-00911: invalid character". > > ** Configuration: Python 2.5; cx_Oracle 5.0.1-

Re: How do I override the __unicode__ of User?

2009-05-17 Thread Alex Gaynor
On Sun, May 17, 2009 at 3:51 PM, Thierry wrote: > > I currently have a blog model: > > class BlogPost(models.Model): >title = models.CharField(max_length=150) >body = models.TextField() >author = models.ForeignKey(User) >timestamp = models.DateTimeField() >

How do I override the __unicode__ of User?

2009-05-17 Thread Thierry
I currently have a blog model: class BlogPost(models.Model): title = models.CharField(max_length=150) body = models.TextField() author = models.ForeignKey(User) timestamp = models.DateTimeField() Right now, author is returning the default User.username. How can I customize the

Re: Seeking Example of MultipleChoiceField Example with dynamic Choices

2009-05-17 Thread Sam Chuparkoff
On Sun, 2009-05-17 at 10:41 -0700, Bobby Roberts wrote: > from django import forms > from django.contrib.auth.models import User > > # pull a recordset of the users > userdata = User.objects.all() > > def myuserlist(self): > for i in userdata: > self[i.id]='%s %s'

Re: Seeking Example of MultipleChoiceField Example with dynamic Choices

2009-05-17 Thread Bobby Roberts
> ...     users = forms.ModelMultipleChoiceField( > ...         queryset=User.objects, > ...         widget=forms.CheckboxSelectMultiple, > ...         required=True) > ...>>> User(username='sdc').save() > >>> User(username='bobby').save() dude you rock... i totally missed this. Does exactly

Oracle connection "cx_Oracle.DatabaseError: ORA-00911: invalid character"

2009-05-17 Thread Doug
When I attempt to use Oracle as the backend for Django, I get this error on issuing the 'syndb' command: "cx_Oracle.DatabaseError: ORA-00911: invalid character". ** Configuration: Python 2.5; cx_Oracle 5.0.1- 10g ** Setting: Backend=oracle; User=django; PW=django; Host=BLANK; Port=BLANK **

Re: Formatting a Foreign key combo box in admin change form

2009-05-17 Thread nih
oops forgot to include: from django.contrib.auth.models import User On May 17, 6:18 pm, nih wrote: > Thanks for the info, took me a while to figure out what to do next, > I haven't delved into django internals much before. I ended up > with > > from

parsing data from fileupload

2009-05-17 Thread Patrick
How do I add data from a fileupload to a database? For example, if I have a Book model that is for names of books and a FileNames model that is used on a form, how do I populate Book.title. class FileNames(models.Model): title = models.FileField(upload_to='tmp', blank=False) class

Re: Seeking Example of MultipleChoiceField Example with dynamic Choices

2009-05-17 Thread Bobby Roberts
> oops, please modify the line from "self[i.id]='%s %s', > (i.first_name,i.last_name)"  to "self[i.id]='%s %s' % > (i.first_name,i.last_name) " this results in the same issue: from django import forms from django.contrib.auth.models import User # pull a recordset of the users userdata =

Re: ModelForm not respecting "exclude" - what am I doing wrong?

2009-05-17 Thread Alex Gaynor
On Sun, May 17, 2009 at 12:38 PM, ringemup wrote: > > > Aha. I'm on 1.0. Can I still use custom validation on the ModelForm > if I use the ModelAdmin to exclude the fields? > > Thank you! > > > On May 17, 1:36 pm, Alex Gaynor wrote: > > On Sun, May

Re: ModelForm not respecting "exclude" - what am I doing wrong?

2009-05-17 Thread ringemup
Aha. I'm on 1.0. Can I still use custom validation on the ModelForm if I use the ModelAdmin to exclude the fields? Thank you! On May 17, 1:36 pm, Alex Gaynor wrote: > On Sun, May 17, 2009 at 12:34 PM, ringemup wrote: > > > I'm trying to exclude

Re: ModelForm not respecting "exclude" - what am I doing wrong?

2009-05-17 Thread Alex Gaynor
On Sun, May 17, 2009 at 12:34 PM, ringemup wrote: > > I'm trying to exclude some fields from an admin form, but the exclude > option on the ModelForm is being ignored, as far as I can tell. The > following is my code. When I view the admin page in question, "Entry > Form

Re: Seeking Example of MultipleChoiceField Example with dynamic Choices

2009-05-17 Thread Lokesh
oops, please modify the line from "self[i.id]='%s %s', (i.first_name,i.last_name)" to "self[i.id]='%s %s' % (i.first_name,i.last_name) " On May 17, 10:28 pm, Bobby Roberts wrote: > > Try this below code. I guess this will solve your purpose > >  # pull a recordset of the

ModelForm not respecting "exclude" - what am I doing wrong?

2009-05-17 Thread ringemup
I'm trying to exclude some fields from an admin form, but the exclude option on the ModelForm is being ignored, as far as I can tell. The following is my code. When I view the admin page in question, "Entry Form Initialized" is printed to the command line, but all the fields, including blog and

Re: Seeking Example of MultipleChoiceField Example with dynamic Choices

2009-05-17 Thread Bobby Roberts
> Try this below code. I guess this will solve your purpose > >  # pull a recordset of the users >  userdata = auth_user.objects.all() > >  def user_filler(self): >      for i in userdata: >          self[i.id] = '%s, %s', (i.firstname, i.lastname) >      return self.items() > from django

Re: Formatting a Foreign key combo box in admin change form

2009-05-17 Thread nih
Thanks for the info, took me a while to figure out what to do next, I haven't delved into django internals much before. I ended up with from django.db.models import ForeignKey from django.forms import ModelChoiceField class UserModelChoiceField(ModelChoiceField): def

Re: Seeking Example of MultipleChoiceField Example with dynamic Choices

2009-05-17 Thread Lokesh
Hi, Try this below code. I guess this will solve your purpose # pull a recordset of the users userdata = auth_user.objects.all() def user_filler(self): for i in userdata: self[i.id] = '%s, %s', (i.firstname, i.lastname) return self.items() Regards, Lokesh On May 17,

Re: Help required to generate a query

2009-05-17 Thread Alex Gaynor
On Sun, May 17, 2009 at 11:58 AM, Lokesh wrote: > > Hi, > > class BasicDetails(models.Model): >age = models.PositiveSmallIntegerField(null=False, blank=False) >dom = models.PositiveSmallIntegerField(null=False, blank=False) >dod =

Help required to generate a query

2009-05-17 Thread Lokesh
Hi, class BasicDetails(models.Model): age = models.PositiveSmallIntegerField(null=False, blank=False) dom = models.PositiveSmallIntegerField(null=False, blank=False) dod = models.PositiveSmallIntegerField(null=False, blank=False) doy = models.PositiveIntegerField(null=False,

Re: Seeking Example of MultipleChoiceField Example with dynamic Choices

2009-05-17 Thread Bobby Roberts
> p=Country.objects.all()   -> capturing all the records from > Country table > def country_filler(self):    -> function  to generate a country > list which we are going to fetch from the records >     incr = 0 >     for i in p: >        self[incr] = i.country >        incr = incr+1 >    

Re: Seeking Example of MultipleChoiceField Example with dynamic Choices

2009-05-17 Thread Alex Gaynor
On Sun, May 17, 2009 at 11:24 AM, Lokesh wrote: > > Hi Alex, > > Then I can go ahead with required=false attribute to avoid form > validation and validation should be taken care by program. > Correct me if I am wrong. > > Regards, > Lokesh > > > >incr = 0 > > >

Re: Seeking Example of MultipleChoiceField Example with dynamic Choices

2009-05-17 Thread Lokesh
Hi Alex, Then I can go ahead with required=false attribute to avoid form validation and validation should be taken care by program. Correct me if I am wrong. Regards, Lokesh > >    incr = 0 > >    for i in p: > >       self[incr] = i.country > >       incr = incr+1 > >    return self.items() >

Re: Seeking Example of MultipleChoiceField Example with dynamic Choices

2009-05-17 Thread Alex Gaynor
On Sun, May 17, 2009 at 11:16 AM, wrote: > > Hi, > > p=Country.objects.all() -> capturing all the records from > Country table > def country_filler(self):-> function to generate a country > list which we are going to fetch from the records >incr = 0

Re: Seeking Example of MultipleChoiceField Example with dynamic Choices

2009-05-17 Thread lokeshmaremalla
Hi, p=Country.objects.all() -> capturing all the records from Country table def country_filler(self):-> function to generate a country list which we are going to fetch from the records incr = 0 for i in p: self[incr] = i.country incr = incr+1 return

Re: Form trouble

2009-05-17 Thread Alex Gaynor
On Sun, May 17, 2009 at 4:29 AM, zayatzz wrote: > > > > btw... what is tuple? i am not native english speaker so i fail to > > > understand some words like that. > > > > It's a python data structure. It's an "" Array "" . > > > > > > > > > > Thanks. :) > > Alan > > >

Re: check_constraints module error

2009-05-17 Thread Michael
> > > >>> from check_constraints import Check > Traceback (most recent call last): > File "", line 1, in > ImportError: No module named check_constraints This is the right code. What this is saying is that you don't have the check_constraints module properly installed. Have you installed the

Re: Counting pageviews

2009-05-17 Thread Michael
On Sun, May 17, 2009 at 10:29 AM, Oleg Oltar wrote: > Well, what I want is t implement voting application, so my users can see > article, vote for it and see the vote displayed > So I want to show in template: this page was viewed 100 times, and has 10 > votes for example

Re: displaying image in a template

2009-05-17 Thread Michael
On Sun, May 17, 2009 at 2:54 AM, newbie wrote: > > > Hi, > >I followed those steps in the link and its working fine for > static files (like css scripts etc). But when i'm trying to display an > image, its not working. I'm trying to display an image which is in >

Re: Counting pageviews

2009-05-17 Thread Oleg Oltar
Well, what I want is t implement voting application, so my users can see article, vote for it and see the vote displayed So I want to show in template: this page was viewed 100 times, and has 10 votes for example how can I get those numbers On Sat, May 16, 2009 at 12:12 PM, Antoni Aloy

Seeking Example of MultipleChoiceField Example with dynamic Choices

2009-05-17 Thread Bobby Roberts
Hi. I'm needing to learn how to dynamically pull data out of the database and pass it as a CHOICES argument in my form. I want to pull a recordset of options, dump it into the choices and pass it to the form etc. Can someone out there lend me a hand? I'd like the options on the form to be

LANGUAGE_CODE

2009-05-17 Thread sammysun
Hi: When I set LANGUAGE_CODE = 'zh-cn' in the sitting file. I want to get a 3 letters of month useing filter "date" in the template, e.g. Useing {{ entry.pub_date|date:"M"}}, I will get "五月" in chinese, but the one I expect is "May". How can I fix this? Thanks! sammysun

subscription based web app - want to develop - bounty

2009-05-17 Thread AE
Hi I have looked enough and failed to identify anything that solves or like "SaaS railskit" if I am wrong please let me know. I am not technically savvy enough to develop such app myself. Maybe someone is using django-paypal to make subscription based (e.g. a.la basecamp) web app. What I want

looping through form.errors in templates

2009-05-17 Thread simon101
Hi I've noticed that there have been changes in form error processing for templates when I've been updating some old code to work with django 1.0.2 from 0.96. My code for displaying errors at the top of the pages looked like this in 0.96: {% if form.has_errors %} Please correct the following

Re: Implementing A/B Testing in Django

2009-05-17 Thread TiNo
> > Does anyone have any other ideas or suggestions about how to > dynamically show templates to users in a pluggable way while at the > same time measuring what template the user sees? > It's not about doing it in Django, but you know that Google Website Optimizer does this, and provides you out

Re: referencing the object id from clean validation methods

2009-05-17 Thread simondav
thanks for that alex On May 16, 9:53 pm, Ramiro Morales wrote: > On Sat, May 16, 2009 at 5:18 PM, Alex Gaynor wrote: > > > On Sat, May 16, 2009 at 3:03 PM, simon101 wrote: > > >> Hi > > >> I am using ModelForms to create forms from

Re: how to refer a foreign key to a non primary column from other model

2009-05-17 Thread PeterN
This is not true for Oracle either. A foreign key can certainly reference a unique (not primary) key in Oracle. See Oracle documentation, e.g. http://download.oracle.com/docs/cd/B28359_01/server.111/b28318/data_int.htm#sthref2329, or simply verify by trying it ! -- PeterN On May 16, 6:04 pm,

Re: Form trouble

2009-05-17 Thread zayatzz
> > btw... what is tuple? i am not native english speaker so i fail to > > understand some words like that. > > It's a python data structure. It's an "" Array "" . > > > > Thanks. :) Alan --~--~-~--~~~---~--~~ You received this message because you are subscribed

Re: Form trouble

2009-05-17 Thread Jorge Bastida
> > > Call > if form.*is_valid()*: Sorry > > # use cleaned_data > > Jorge > > >> >> -- neo2001[at]gmail.com jorge[at]thecodefarm.com neo[at]art-xtreme.com --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups

Re: Form trouble

2009-05-17 Thread Jorge Bastida
2009/5/17 zayatzz > > Thanks > > I actually tried that form.cleaned_data at one point but then i got > error that was something like: form object has no cleaned_data > attribute. Call if form.isvalid(): # use cleaned_data Jorge > > > Anyway, its working now -

Re: Form trouble

2009-05-17 Thread zayatzz
Thanks I actually tried that form.cleaned_data at one point but then i got error that was something like: form object has no cleaned_data attribute. Anyway, its working now - thanks alot. btw... what is tuple? i am not native english speaker so i fail to understand some words like that. Alan

Re: quickest way to print template names

2009-05-17 Thread Sam Chuparkoff
On Sat, 2009-05-16 at 23:37 -0500, Alex Gaynor wrote: > There isn't a better solution, a Template doesn't store the file it > was rendered from (especially since that doesn't make sense for all > template loaders, such as if you render a template from a string), nor > does the context inherently

Re: displaying image in a template

2009-05-17 Thread newbie
Hi, I followed those steps in the link and its working fine for static files (like css scripts etc). But when i'm trying to display an image, its not working. I'm trying to display an image which is in static/barcodeimages directory (static is the directory to which i set all static