Re: newforms file upload

2007-05-03 Thread vega
Hi, in fact there is a working patch you can use: #3297 It's really out of my comprehension why fileupload and FloatField have been kept back (the latter due to design decision on decimals). I can't understand how the django-team suggests anybody switch to newforms without these 2 ver

Re: Unknown column 'appname_modelname.category_id' in 'field list

2007-05-03 Thread nerezus
I've just dropped all the tables and "syncdb" another one time. And it's working now! But what should I do if I want to add new field to model? Dropping tables is not a good idea... And without dropping "syncdb" does not work. P.S. How to add an unneccessary field which can be left empty in Djan

User and UserProfile

2007-05-03 Thread Mi Reflejo
Hi, I'm facing a problem and i don't know how to solve it. I'm using the User class "expanded" by ForeingKey [UserProfile] and I need to make a frontend (newforms) for signup. The form should show User fields (first_name, last_name, user, pass) and UserProfile fields. So there is the problem: I

Re: User and UserProfile

2007-05-03 Thread Russell Keith-Magee
On 5/3/07, Mi Reflejo <[EMAIL PROTECTED]> wrote: > Hi, > > I don't know how to do it using form_for_model (I want to keep my "labels", > "help_text", etc from models). Of course i could make my own Form class with > each field but it's redundant and if i change my database struct i should > change

Bug with __str__(self) if we use "return %s %s" ???

2007-05-03 Thread Nicolas Steinmetz
Hello, I have the following model : class Trombi(models.Model): first_name = models.CharField("Prénom", maxlength=40) last_name = models.CharField("Nom", maxlength=40) photo = models.ImageField("Photo", height_field="80", width_field="80", upload_to="photos") url

Re: Unknown column 'appname_modelname.category_id' in 'field list

2007-05-03 Thread Russell Keith-Magee
On 5/3/07, nerezus <[EMAIL PROTECTED]> wrote: > > I've just dropped all the tables and "syncdb" another one time. And > it's working now! > > But what should I do if I want to add new field to model? Dropping > tables is not a good idea... And without dropping "syncdb" does not > work. This probl

Re: Unknown column 'appname_modelname.category_id' in 'field list

2007-05-03 Thread nerezus
Bruno Tikami, Russell Keith-Magee, thanks. > P.S. How to add an unneccessary field which can be left empty in > Django administration panel? Already found, blank=True I will use ALTER TABLE :) The problem has been solved. --~--~-~--~~~---~--~~ You received this

Translation of class names

2007-05-03 Thread Konstantin Pavlovsky
hi all I am working with administrative interface. and want to make it "speak" russian if it possible to translate names of Classes using i18n things? ive translated field lables with lazy gettext [code] manager = models.ForeignKey(User,verbose_name=_("Manager")) ordertext = models.Text

Django puzzle

2007-05-03 Thread Karen Tracey
No, not a coding kind of puzzle, a crossword puzzle. I enjoyed using Django to build a web front-end for my database, and I thought it had a really cool name. When I looked into where the name came from I was pleased to find the source particularly suitable to build a daily-sized crossword a

Making list of M2M field in object's __str__

2007-05-03 Thread [EMAIL PROTECTED]
My model looks like this class Artist(models.Model): name = models.CharField(maxlength=100) class Song(models.Model): title = models.CharField(maxlength=100) artists = models.ManyToManyField(Artist) I would like to join the artists that are related to a particular song into a strin

Adding fields dinamically to a model

2007-05-03 Thread sandro dentella
hi, i'd like to dinamycally add fields to a model (UserProfile) so that it gets populated of all the field needed by each application. Any idea of how to accomplish this? I first try that cannot work would have been: --~--~-~--~~~---~--~~ You receive

Re: Adding fields dinamically to a model

2007-05-03 Thread sandro dentella
hi, i'd like to dinamycally add fields to a model (UserProfile) so that it gets populated wit all the field needed by each application. Any idea of how to accomplish this? A first try that cannot work would have been: class UserProfile(models.Model): user = models.OneToOne

Re: Making list of M2M field in object's __str__

2007-05-03 Thread Tim Chase
> class Artist(models.Model): > name = models.CharField(maxlength=100) > > class Song(models.Model): > title = models.CharField(maxlength=100) > artists = models.ManyToManyField(Artist) > > > I would like to join the artists that are related to a > particular song into a string (com

Re: Making list of M2M field in object's __str__

2007-05-03 Thread [EMAIL PROTECTED]
I did try that, with the artist having a __str__ method. It complained that it couldn't perform the join operation on a ManyToManyManager. I don't have the precise error, but can post it later. Thanks for the suggestion though. On May 3, 9:53 am, Tim Chase <[EMAIL PROTECTED]> wrote: > > class

Re: Making list of M2M field in object's __str__

2007-05-03 Thread Malcolm Tredinnick
On Thu, 2007-05-03 at 13:56 +, [EMAIL PROTECTED] wrote: > I did try that, with the artist having a __str__ method. It > complained that it couldn't perform the join operation on a > ManyToManyManager. I don't have the precise error, but can post it > later. Thanks for the suggestion though.

Re: Making list of M2M field in object's __str__

2007-05-03 Thread [EMAIL PROTECTED]
That is definitely what I have been missing. Thanks. On May 3, 10:00 am, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > On Thu, 2007-05-03 at 13:56 +, [EMAIL PROTECTED] wrote: > > I did try that, with the artist having a __str__ method. It > > complained that it couldn't perform the join o

Re: Making list of M2M field in object's __str__

2007-05-03 Thread Tim Chase
>>def __str__(self): >> return "%s (%s)" % ( >>self.title, >>'/'.join(self.artists) >>) >> >> This assumes that an Artist has a __str__ method as well. If >> not, you could change that one line to >> >>'/'.join([artist.name for artist in self.artists]) > > I

Dictionaries of dictionaries in a template

2007-05-03 Thread wj
Hey everyone, I am new to python and to django, but finally have a project that gives me a good excuse to learn both. It has been a struggle as I come from the old school mod_perl web development world, from about 4-5 years ago. I'm learning a lot and its been fun so far, but slow going. Right

Noob question about javascript files

2007-05-03 Thread Haku
Ok, i'm really sorry to bug you with this noobish question... but i can't get out this mess alone. I'm coming from php and i'm still learning Django and Python. So, my problem is the following. I've got a simple app called "agora" (which is a simple blog) and all works great! but now I'm trying t

QueryDict variables with multiple levels

2007-05-03 Thread simonbun
Suppose the following query parameters: myurl/?var=1&var=2&var=3 Running this through QueryDict correctly gives me I had hoped that multiple levels in these variables would result in a nested dictionary, but no such luck. To illustrate the problem lets suppose the following query: myurl/? coun

Re: QueryDict variables with multiple levels

2007-05-03 Thread Malcolm Tredinnick
On Thu, 2007-05-03 at 15:43 +, simonbun wrote: > Suppose the following query parameters: > myurl/?var=1&var=2&var=3 > > Running this through QueryDict correctly gives me > > > I had hoped that multiple levels in these variables would result in a > nested dictionary, but no such luck. To ill

Re: QueryDict variables with multiple levels

2007-05-03 Thread Mike Axiak
Actually, doing something similar to this was actually a source of a DoS attack on PHP [1]. It does seem to me one of the features of Django that there is little processing done to the actual request. Cheers, Mike Axiak 1: http://www.php-security.org/MOPB/MOPB-03-2007.html On May 3, 11:58 am,

Re: Dictionaries of dictionaries in a template

2007-05-03 Thread Mike Axiak
Hi Will, When you do {{ site }}, it should follow the rules and print str(ts_data[...]), which is probably not what you want. A more pythonic way to do what you want: {% for site in ts_data.items %} Site: {{ site.0 }} Rank: {{ site.1.rank }} ... {% endfor %} Cheers, Mike Axiak On May 3

Re: Dictionaries of dictionaries in a template

2007-05-03 Thread wj
That worked perfectly! Thanks for the help! -Will On 5/3/07, Mike Axiak <[EMAIL PROTECTED]> wrote: > > > Hi Will, > > When you do {{ site }}, it should follow the rules and print > str(ts_data[...]), which is probably not what you want. > A more pythonic way to do what you want: > > {% for site

Re: QueryDict variables with multiple levels

2007-05-03 Thread simonbun
Malcolm, exactly, I'm trying to submit a complex form, albeit through a GET request. For the moment I've worked around the problem seeing as i only need to go 2 levels deep at the moment. When the need arises for an 'n' amount of depths I'll be writing such a function indeed. Mike, thanks. Readin

Re: Adding fields dinamically to a model

2007-05-03 Thread Gulopine
I know of one way of going about this, but it relies on a Django patch (#4144) that hasn't been integrated yet. There are probably ways I'm not aware of, though. -Gul On May 3, 9:49 am, sandro dentella <[EMAIL PROTECTED]> wrote: > hi, > >i'd like to dinamycally add fields to a model (UserPro

Re: Adding fields dinamically to a model

2007-05-03 Thread Mike Axiak
Sandro, I'm not sure #4144 would help. However, I think there are limits to what you can do with python descriptors, and thus Django models. At the risk of giving up all the niceties of having an actual SQL field, can you do what you need by pickling dictionaries? If you really wanted to be lazy/

Re: Unknown column 'appname_modelname.category_id' in 'field list

2007-05-03 Thread Bruno Tikami
Hi! 1st think, syncdb does not update your tables defi9nition so, if you change something in the class, you'll have to "ALTER TALBE" it in order not to drop the table. It's a pitty but you have to do it with regular SQL through your mySql client. About not required fields, you just have to specif

Re: Job: Internships at World Online in Lawrence

2007-05-03 Thread Christian Markwart Hoeppner
That should be a problem :D I live in spain. El mi�, 02-05-2007 a las 23:49 +0100, Gerry Steele escribi�: > Does being an Northern Irish student exclude me? > > Though I guess the geography precludes it anyway :-\ > > Jacob Kaplan-Moss wrote: > > On 5/2/07, Christian Markwart Hoeppner <[EMAIL

Empty QuerySet while using dates() method. Is it a bug?

2007-05-03 Thread Patrick Anderson
Below is my view function to retrieve month values from a QuerySet: def year_get_months(request, year, template_name): months = Letter.objects.filter( date_published__year = year ).dates('date_published', 'month') return render_to_response( template_name, context

No POST data

2007-05-03 Thread tomass
I realise this is likely something trivial I am missing, and I'm aware of http://code.djangoproject.com/wiki/NewbieMistakes... However, I have a form that's set up like this: From: Calendar.setup({ inputField : "date_from", button : "date_from_cal" }); To: Calendar.setup({ inputField : "date_to"

Re: No POST data

2007-05-03 Thread Jeremy Dunck
On 5/3/07, tomass <[EMAIL PROTECTED]> wrote: ... > return HttpResponseRedirect('/landscape/logs/%s/%s/' % > (date_from, date_to)) Are you certain 'index' isn't trying to use request.POST? You're redirecting there in 'parsedate'. --~--~-~--~~~---~--~~ You

Re: No POST data

2007-05-03 Thread tomass
Turns out it was the "disabled" directive in the form. Weird, as I'm pretty sure it works on other forms in other applications, but when I remove it, it works great. On May 3, 11:36 am, tomass <[EMAIL PROTECTED]> wrote: > I realise this is likely something trivial I am missing, and I'm aware > of

Re: newforms file upload

2007-05-03 Thread Vance Dubberly
Thanks Sandro. I concur newforms beats the socks off maninpulator and validators but putting it in trunk prior to getting basic functionality completed was mean. But hey it's pre-1.0 so I guess anything goes. ;) Vance On 5/3/07, vega <[EMAIL PROTECTED]> wrote: > > Hi, > > in fact there is

How do they do the filters in admin?

2007-05-03 Thread Moses Ting
Anyone knows how the Django developers implemented the nice filtering feature in Admin. For example, if filtering is turned on for the id column, then the filters will automatically apply the following key/ value pair to the end of the link. /?object_id__exact=2 How then, does this get implemen

Re: No POST data

2007-05-03 Thread Brian Luft
>From http://www.w3.org/TR/html4/interact/forms.html#h-17.12: "In this example, the INPUT element is disabled. Therefore, it cannot receive user input nor will its value be submitted with the form." Try removing the disabled attribute from the input. If you still need to submit the value from t

Is it possible to redirect with POST data?

2007-05-03 Thread Bob T.
Hi All, I have a situation where I would like a view to do a redirect to a URL that is expecting POST (rather than GET) data. GET would be easy, but how can I do a POST redirect? The URL I would be redirecting to is not under my control, so I can't just change it to use GET data. Thanks, Bob -

Re: Is it possible to redirect with POST data?

2007-05-03 Thread Michael K
On May 3, 4:24 pm, "Bob T." <[EMAIL PROTECTED]> wrote: > Hi All, > > I have a situation where I would like a view to do a redirect to a URL > that is expecting POST (rather than GET) data. GET would be easy, but > how can I do a POST redirect? The URL I would be redirecting to is not > under my co

Re: How do they do the filters in admin?

2007-05-03 Thread Brian Rosner
On 2007-05-03 13:30:57 -0600, Moses Ting <[EMAIL PROTECTED]> said: > > Anyone knows how the Django developers implemented the nice filtering > feature in Admin. For example, if filtering is turned on for the id > column, then the filters will automatically apply the following key/ > value pair

Re: Is it possible to redirect with POST data?

2007-05-03 Thread Joseph Heck
No - redirect sends information back to the browser that causes the browser to make another request - GET style attributes can be easily included in there, but the "aside" kind of data that you have in a POST is not sent back. The closest you could get from a server side type of operation is some

Re: Is it possible to redirect with POST data?

2007-05-03 Thread Mike Axiak
If it's not necessary to have the client *actually* go to the page, you could so some shady things with httplib [1]. E.g. import httplib, urllib params = urllib.urlencode(request.POST) headers = {"Content-type": "application/x-www-form-urlencoded", "Referer": "http://google.com"}

Django Diagram

2007-05-03 Thread FrankW
I'm teaching my son Django and came up with a diagram for him - you know what they say - a picture is worth a thousand words. The diagram is at http://zdecisions.com/zdmedia/img/django.jpg Any comments or suggestions for making it better? --~--~-~--~~~---~--~~ Y

Re: User and UserProfile

2007-05-03 Thread Mi Reflejo
Thank you, it helps me. Now lets supose that i don't want to show some fields from Users model. For example: last_login The only way that I've found is del UserFormModel.base_fields['last_login'] But in the other hand, i need to fill this value with datetime.datetime.now (). So i can't just del

New Diamanda Release [forum, articles, news and other applications]

2007-05-03 Thread [EMAIL PROTECTED]
New Diamanda (Diamanda Applications Set) release - 2007.04.26 - is public and can be downloaded from Google Code: http://code.google.com/p/diamanda/downloads/list Main Changes: The project is treated as a set of applications than can be used together (by default) or separately in other projects e

Re: Django Diagram

2007-05-03 Thread Tim Chase
> I'm teaching my son Django and came up with a diagram > for him - you know what they say - a picture is worth a > thousand words. > > The diagram is at http://zdecisions.com/zdmedia/img/django.jpg > > Any comments or suggestions for making it better? Handy. I'm not sure how I'd change it exa

Re: User and UserProfile

2007-05-03 Thread Mi Reflejo
I just figured i can use a callback function in form_for_model. Something like: def uform_callback(f, **kwargs): "tell forms to ignore other fields differents for visible_field" visible_fields = ['username', 'password', 'first_name', 'last_name'] if f.name not in visible_fields:

Re: QueryDict variables with multiple levels

2007-05-03 Thread Graham Dumpleton
FWIW, In Ian Bicking's FormEncode package there is a form variable decoder which does something similar to what you want and maybe of interest to you. To quote from the source code: """ Takes GET/POST variable dictionary, as might be returned by ``cgi``, and turns them into lists and dictionaries

Re: User and UserProfile

2007-05-03 Thread Daniel Arbanas
Mi Reflejo wrote: > Thank you, it helps me. > > Now lets supose that i don't want to show some fields from Users model. For > example: last_login > > The only way that I've found is > del UserFormModel.base_fields['last_login'] > > But in the other hand, i need to fill this value with datetime.

IE6 is not accepting session cookies

2007-05-03 Thread omat * gezgin.com
I cannot set session cookies in IE6, thus I cannot handle sessions of my users that are using IE6. In the FAQ, there is a section mentioning a similar problem in the admin site and tells to set the SESSION_COOKIE_DOMAIN parameter in the admin settings. As my problem is not limited to admin, I tr

Re: IE6 is not accepting session cookies

2007-05-03 Thread Jeremy Dunck
On 5/3/07, omat * gezgin.com <[EMAIL PROTECTED]> wrote: > > I cannot set session cookies in IE6, thus I cannot handle sessions of > my users that are using IE6. I can't find the MSDN article now, but there is an issue with IE (not) storing cookies for sites whose host/domain name includes a dash

Re: QueryDict variables with multiple levels

2007-05-03 Thread SmileyChris
> You could write a function that takes Django's standard MultiValueDict > and returns the type of nested structure you are after. Not a change > worth making in core, but it's only a function you would have to write > once for your own use. Actually, there is a function that could do what you w

Using newforms for multiple db rows

2007-05-03 Thread Chris Brand
I've been reading all about newforms and playing a little, but I can't see how to approach what I want to do. Say I wanted to do something like a class attendance form, where my model has a class Student, and I want a form with a checkbox for each student to allow me to say whether they were pres

Re: User and UserProfile

2007-05-03 Thread Russell Keith-Magee
On 5/4/07, Mi Reflejo <[EMAIL PROTECTED]> wrote: > I just figured i can use a callback function in form_for_model. Something > like: > > def uform_callback(f, **kwargs): > "tell forms to ignore other fields differents for visible_field" > visible_fields = ['username', 'password', 'first_na

Creating a Blog: combining seperate parts

2007-05-03 Thread Evan H. Carmi
Hey, I am attempting to create a blog from scratch (it sounds like a great way to learn something but it is a lot more work if it is the first project you've done.) I have a models.py: - class Entry(models.Model): title = models.CharField(maxlength=255, core=True) pub_date = models.D

Re: Using newforms for multiple db rows

2007-05-03 Thread dballanc
Don't try too hard to directly link form to model. For the attendance form, you might use a MultipleChoiceField checkboxSelectMultiple widget, where the value of each choice is set to the pk of the student model. You should get a list of id's that were checked when the form gets submitted. Som

Re: Noob question about javascript files

2007-05-03 Thread theju
Since Javascript is a static file you have to define your js directory in your urls.py. I've used a lot of Javascript Libraries and all have worked successfully. First in urls.py (r'^js/(?P.*)$', 'django.views.static.serve', {'document_root': '/media/agora/js/lib/MochiKit/'}), And then in your

list_display with multiple url in admin , select item to change

2007-05-03 Thread Frank Singleton
Hi, Is it possible to embed hyperlinks in the list_display list for model. An example is a model class that has say 1 foreign key reference, and list_display as follows list_display=('id','foreignkeyref') self.id appears in the first column as a hyperlink (nice, this hyperlink you get for f

Re: Making list of M2M field in object's __str__

2007-05-03 Thread [EMAIL PROTECTED]
So, I did this, and Django complains that a string was expected for the join function, and it received an Artist instead. I have a __str__ method defined for my Artist class. Shouldn't it automatically be converting the Artist instance to a string? On May 3, 10:15 am, Tim Chase <[EMAIL PROTECTE

Re: django i18n and google bots

2007-05-03 Thread cactus
You could maybe check the user agent and return the desired specific content for bots. --~--~-~--~~~---~--~~ 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@googlegr

Passing data from view/context to template

2007-05-03 Thread [EMAIL PROTECTED]
Hi everyone, Please help me out. I'm trying to create an aggregator like news.originalsignal.com. I'm trying to limit the default number of feeds and I'm running into trouble passing data from view to template/context... Here's my code: def main(request): feed_titles = Feed.objects.all()

Re: QueryDict variables with multiple levels

2007-05-03 Thread simonbun
Ah brilliant. That would do the trick indeed. Every now and then hidden gems like this one pop up that have been in trunk all along, but somehow escaped my attention. Thanks all Simon On May 4, 1:58 am, SmileyChris <[EMAIL PROTECTED]> wrote: > > You could write a function that takes Django's sta

loaddata issue

2007-05-03 Thread Mark Jarecki
Hi, I've come across an issue trying to loaddata into my database, and am wondering if anyone else has come across this too? and how to go about fixing it. I have Apache2.2.4, mod_python3.3.1, Python-2.5.1, postgresql-8.2.4, psycopg2-2.0.5.1 installed. Please let me know if you require any

Re: list_display with multiple url in admin , select item to change

2007-05-03 Thread Frank Singleton
Frank Singleton wrote: > Hi, > > Is it possible to embed hyperlinks in the list_display list for model ok read this in the docs.. If the string given is a method of the model, Django will HTML-escape the output by default. If you’d rather not escape the output of the method, give the method an

[django] Subject in posts

2007-05-03 Thread Andrés Martín
Hi, This mail, is for proposing that in tha all e-mail's that send to the group, contain the [django] subject. First, because the client mail can detect spam en it, and Second, for recognize each mail of mail-list. is a form of have mail organize, and know as it is as. Thanks for the attention a

Re: [django] Subject in posts

2007-05-03 Thread James Bennett
On 5/4/07, Andrés Martín <[EMAIL PROTECTED]> wrote: > This mail, is for proposing that in tha all e-mail's that send to the > group, contain the [django] subject. First, because the client mail can > detect spam en it, and Second, for recognize each mail of mail-list. is a > form of have mail org

Re: User and UserProfile

2007-05-03 Thread Mi Reflejo
Nevermind. Thank you Russ and BTW if someone is thinking "How can i make a generic callback function for that purpose?" http://www.djangosnippets.org/snippets/209/ Regards, -- Martín Conte Mac Donell http://www.catartico.com On 5/3/07, Russell Keith-Magee <[EMAIL PROTECTED]> wrote: > > > On 5/

How to change the size of input field from Django

2007-05-03 Thread Pythoni
One of the field in my model is defined Description=meta.TextField() When I use {{form.Description}} in my input form( template) the field is not as large as I would need. When I check HTML I can see But I would need at least rows="20" cols="70". Is there a way how to change the size from Dja

Re: [django] Subject in posts

2007-05-03 Thread M Harris
On Friday 04 May 2007 00:44, James Bennett wrote: > This has been proposed multiple times in the past (please search the > list archive at http://groups.google.com/group/django-users/), and it > was decided not to add a prefix to the subject line; any good mail > client, The reason it gets

Re: [django] Subject in posts

2007-05-03 Thread Kenneth Gonsalves
On 04-May-07, at 12:16 PM, M Harris wrote: >> This has been proposed multiple times in the past (please search the >> list archive at http://groups.google.com/group/django-users/), and it >> was decided not to add a prefix to the subject line; any good mail >> client, > The reason it gets

Re: loaddata issue

2007-05-03 Thread Russell Keith-Magee
On 5/4/07, Mark Jarecki <[EMAIL PROTECTED]> wrote: > > Hi, > > I've come across an issue trying to loaddata into my database, and am > wondering if anyone else has come across this too? and how to go about > fixing it. > > I have Apache2.2.4, mod_python3.3.1, Python-2.5.1, postgresql-8.2.4, > psyc

Re: IE6 is not accepting session cookies

2007-05-03 Thread omat * gezgin.com
No, the domain is "turkpop.com". I tried setting SESSION_COOKIE_DOMAIN to "turkpop.com", ".turkpop.com" and "www.turkpop.com". I also tried some combinations for the "localhost" and "127.0.0.1". Neither of them worked. I am running IE6 standalone version together with installed IE7 on the same ma