lxml usage with django

2011-02-18 Thread Henrik Genssen
Hi, has anybody used lxml.objectify with Django? I am reading XML files and want to put the content into ORM. I have unicode problems as the default conversion of strings is str, not unicode. Of course I could convert it back to unicode again, but then objectify makes no real sense to me. Anyo

Re: ManyToMany problem

2011-02-18 Thread Amar
Thank you, it solved this problem :) Now, I've encountered another issue, which you can see below. When using only single item in annotation it works, but when using two, it returns the same result. I've added default ordering in all of my models, and as you can se, I've tried including it directl

Broken link emails

2011-02-18 Thread Peter Harley
Hi all, I recently turned on the broken link emails setting on my site, and I've got a couple that really confused me. I assume these emails get sent to me when a user gets a 404, and the referrer is internal. But here is one example I got: Referrer: http://www.example.com/photos/gallery/singap

confused about ModelForm Field validation

2011-02-18 Thread Roman Klesel
Hello guys, I'm running django on a legacy database and in some cases the values stored in the tables have to be converted before the can be displayed and also have to be converted bevore bein saved to the database. Example: A table for storing IP addresses: The address field contains values th

Re: confused about ModelForm Field validation

2011-02-18 Thread Piotr Zalewa
On 02/18/11 09:44, Roman Klesel wrote: > [..] in some cases the values > stored in the tables have to be converted before the can be displayed > and also have to be converted bevore bein saved to the database. > [...] > def clean(self,value): > "convert the literal value to the db rep

request in urls.py

2011-02-18 Thread galago
Is it possible to pass request.path in urls.py? I want to pass it as next parameter in logout declaration. -- 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 t

South - when to start?

2011-02-18 Thread Piotr Zalewa
Where is the best moment to start with south? 1. The very beginning, as the first app added to the project? 2. At the moment when more devs will be involved? 3. When real data will start to show? I'm building a new system, I think the current model progress is about 20%, where 100% is the moment

Re: South - when to start?

2011-02-18 Thread Tom Evans
On Fri, Feb 18, 2011 at 10:24 AM, Piotr Zalewa wrote: > Where is the best moment to start with south? > > 1. The very beginning, as the first app added to the project? > 2. At the moment when more devs will be involved? > 3. When real data will start to show? > > I'm building a new system, I think

Re: confused about ModelForm Field validation

2011-02-18 Thread Roman Klesel
Hello Piotr, 2011/2/18 Piotr Zalewa : > > I would use pre_save signal for data modification > hmm ... this sounds like a good idea. It would make the whole thing a lot more compact ... I'll give it a try. Thank's! Roman -- You received this message because you are subscribed to the Google Gro

list indices must be integers not unicode

2011-02-18 Thread balu
Hi all :) I'm processing a user submitted form. In that the user will answer a series of multiple choice questions. Depending on the question "id" which are submitted I'll find the compare the values and increment the score to count his marks. The question ids are keys from the dictionary reques

RE: list indices must be integers not unicode

2011-02-18 Thread Chris Matthews
Hi Balu, Numeric data from the form must be converted to int. I suspect you wanted to index data; not id_list. if request.method=="POST": data = request.POST temp_list = data.keys() id_list = [] for i in temp_list: id_list.append(id_li

RE: list indices must be integers not unicode

2011-02-18 Thread Chris Matthews
Oh and you probably wanted: if request.method=="POST": data = request.POST id_list = [int(x) for x in data.values()] questions = MyModel.objects.filter(id__in = id_list) From: django-users@googlegroups.com [mailto:django-users@googlegroups.com] On Behalf Of Chris

Re: Displaying a table and make its columns sortable

2011-02-18 Thread Arun K.Rajeevan
Thanks, very good community! On Feb 18, 3:49 am, Shawn Milochik wrote: > On Thu, Feb 17, 2011 at 4:44 PM, Arun K.Rajeevan wrote: > > Show me the django way to do this. > > The "Django" way to do this is to learn basic programming skills. You > originally asked a mess of random questions which di

Re: list indices must be integers not unicode

2011-02-18 Thread balu
Thank you Chris Matthews for your reply. I'm working on a online examination system. I could able to generate some random questions from a data base containg hundreds of questions. So when ever a user answer and submit those random questions a dictionary contating a "Question_id and Answer" pair w

RE: list indices must be integers not unicode

2011-02-18 Thread Chris Matthews
Then you probably want: id_list = [int(x) for x in data.keys()] -Original Message- From: django-users@googlegroups.com [mailto:django-users@googlegroups.com] On Behalf Of balu Sent: 18 February 2011 13:56 To: Django users Subject: Re: list indices must be integers not unicode Thank y

Re: South - when to start?

2011-02-18 Thread dave b
On 18 February 2011 21:24, Piotr Zalewa wrote: > Where is the best moment to start with south? > > 1. The very beginning, as the first app added to the project? > 2. At the moment when more devs will be involved? > 3. When real data will start to show? > now! (just start using it!) -- You recei

Messages framework is not showing messages in my templates

2011-02-18 Thread Gabriel Prat
Hi all, I'm trying to use messages framework, I've checked that middleware, context processor and app is well configured (I'm running django development version which a standard manage.py startproject includes all needed stuff) So, let me write a little bit of code, assume a model like: class MyM

Re: query set on a manytomany table

2011-02-18 Thread gladys bixly
Why would you want to query the table directly? I believe the only way you could access data from a ManyToManyField is through the Model in which it is related. On Fri, Feb 18, 2011 at 11:35 AM, Bobby Roberts wrote: > I have a Manytomanyfield in a model called "registrants" on a > fieldname cal

Re: South - when to start?

2011-02-18 Thread gladys
On Feb 18, 7:28 pm, Tom Evans wrote: > On Fri, Feb 18, 2011 at 10:24 AM, Piotr Zalewa wrote: > > Where is the best moment to start with south? > > > 1. The very beginning, as the first app added to the project? > > 2. At the moment when more devs will be involved? > > 3. When real data will start

Re: list indices must be integers not unicode

2011-02-18 Thread balu
now it is showing a ValueError. Exception Value: invalid literal for int() with base 10. 'csrfmiddlewaretoken' On Feb 18, 5:06 pm, Chris Matthews wrote: > Then you probably want: >     id_list = [int(x) for x in data.keys()] > > > > -Original Message- > From: django-users@googlegroups.co

Re: list indices must be integers not unicode

2011-02-18 Thread Burhan
You need to filter your search in request.POST for fields that match your forms. The post querydict will hold all fields submitted in the form, in your case the error is because you are trying to convert 'csrfmiddlewaretoken' (a key in POST) to an integer which is not possible. On Feb 18, 3:27 pm,

Re: request in urls.py

2011-02-18 Thread Burhan
urls.py doesn't do anything with GET or POST requests, its just regular expression to method mapping. So you can pass whatever you want to the link, and they will all work. For example, in your urls.py you have: (r'^logout$', logout_user) All these requests will be passed to your logout_user me

password_reset only for not loggedin

2011-02-18 Thread galago
is it possible, to deny access to django.contrib.auth.views.password_reset for users who are authenticated? I want to use it, and make it only for not logged in. I can't figure out how to do that. I have done all things with reset, but all users can enter it:/ -- You received this message beca

Re: list indices must be integers not unicode

2011-02-18 Thread balu
Can you please show the way to filter. Please... On Feb 18, 5:36 pm, Burhan wrote: > You need to filter your search in request.POST for fields that match > your forms. The post querydict will hold all fields submitted in the > form, in your case the error is because you are trying to convert > 'c

Re: South - when to start?

2011-02-18 Thread Grigoriy Petukhov
I have found nice way to do quick development on 1st and 2nd steps you have mentioned. I've put following instructions in reset.sh: * Drop database * Create new database * Run ./manage.py syncdb * Generate sample data When I change some model then I just run reset.sh. That works even for seve

Re: South - when to start?

2011-02-18 Thread Piotr Zalewa
I'm mostly looking for a solution which would work for front-end devs who start early in the process (some part of app is written and they may jump on the UI). I guess South before 2 is a must then. I heard it's dead simple, I guess a little practice in writing migrations will not kill me. Thanks

Re: list indices must be integers not unicode

2011-02-18 Thread balu
All my question Ids are integers only. Should I use regular expressions to filter them?? How to exclude the remaining keys. On Feb 18, 6:09 pm, balu wrote: > Can you please show the way to filter. Please... > > On Feb 18, 5:36 pm, Burhan wrote: > > > > > You need to filter your search in request

Re: list indices must be integers not unicode

2011-02-18 Thread balu
How to recognize a key. All the question Ids will be integers only. Should I have to use regular expressions to use that?? How to exclude the remaining keys On Feb 18, 6:09 pm, balu wrote: > Can you please show the way to filter. Please... > > On Feb 18, 5:36 pm, Burhan wrote: > > > > > You need

Just going to point this out ...

2011-02-18 Thread dave b
Hi I cannot see where in the django documentation it states that you shouldn't do something like this: ** (as an example of a potential attribute injection vector[0] - where you are not using a URLField or failure to call full_clean (on a URLField) ). That is I cannot see where django states that

Re: Just going to point this out ...

2011-02-18 Thread Shawn Milochik
I also didn't see the part where they state that you shouldn't put your database login information in a template. That's probably because Django is designed to allow Web developers to do their jobs more easily, not allow people who don't know what they're doing make Web applications. If you're

db_manager with add method

2011-02-18 Thread Leon Liu
Regarding the ticket13358, the status of it is fixed. Does this work for RelatedManager's add() method as well? I tried with all(), and it did pick the right database. But with add(), it doesn't seem to work. I am using django 1.2.5. -- You received this message because you are subscribed to the

Re: Just going to point this out ...

2011-02-18 Thread dave b
On 19 February 2011 00:57, Shawn Milochik wrote: > I also didn't see the part where they state that you shouldn't put your > database login information in a template. That's probably because Django is > designed to allow Web developers to do their jobs more easily, not allow > people who don't kn

Re: How to reinstall Python Interpreters?

2011-02-18 Thread CrabbyPete
I wouldn't reinstall python because of an unresolved import error. What's unresolved and what type of system are you on PC/Linux? On Feb 17, 7:48 pm, LJ wrote: > I installed the latest version of dajaxice, but I am still getting > Unresolved import errors. > My guess is that I need to remove and

Re: Just going to point this out ...

2011-02-18 Thread dave b
On 19 February 2011 01:19, Shawn Milochik wrote: > Don't take my comment as a personal attack. I was just pointing out that > injection attacks are one of those things we're all responsible for being > aware of and not opening ourselves up to. > > To the extent that Django protects us from such

Re: How to pivot a table?

2011-02-18 Thread Derek
On Feb 17, 10:52 pm, Phlip wrote: > Djangoists: > > I have a database table like this... > >   red, 1 >   red, 2 >   red, 15 >   blue, 18 >   blue, 20 > > ...and I want to read it into an array like this: > >   [ ['red', [1,2,15]], ['blue', [18,20]], ] > > Of course I can use values_list('color',

Re: list indices must be integers not unicode

2011-02-18 Thread gladys
Since the question ids are just positive integers, you might want to check them like this for i in temp_list: if i.is_digit():# this line determines whether the key is a positive integer or not # code goes here ... Your design is not very good. I would suggest

Re: Just going to point this out ...

2011-02-18 Thread dave b
On 19 February 2011 01:29, Shawn Milochik wrote: > By the way -- I realized what happened. You CC'd me on the e-mail to the > list. So when I replied it went directly to you. Ah sorry about the mix up then! Yeah :P My view on this is that documentation can always be improved ! -- You received

Re: Just going to point this out ...

2011-02-18 Thread Cal Leeming [Simplicity Media Ltd]
Dave, may I ask you to provide some proof of concept code in regards to this? It'll also make life a lot easier for you when submitting a bug report to the django devs. On Fri, Feb 18, 2011 at 2:22 PM, dave b wrote: > On 19 February 2011 01:19, Shawn Milochik wrote: > > Don't take my comment as

Re: Just going to point this out ...

2011-02-18 Thread Masklinn
On 2011-02-18, at 15:31 , dave b wrote: > On 19 February 2011 01:29, Shawn Milochik wrote: >> By the way -- I realized what happened. You CC'd me on the e-mail to the >> list. So when I replied it went directly to you. > > Ah sorry about the mix up then! > Yeah :P > > My view on this is that do

Re: Just going to point this out ...

2011-02-18 Thread dave b
On 19 February 2011 01:36, Masklinn wrote: > On 2011-02-18, at 15:31 , dave b wrote: >> On 19 February 2011 01:29, Shawn Milochik wrote: >>> By the way -- I realized what happened. You CC'd me on the e-mail to the >>> list. So when I replied it went directly to you. >> >> Ah sorry about the mix

Re: Just going to point this out ...

2011-02-18 Thread Tom Evans
On Fri, Feb 18, 2011 at 1:52 PM, dave b wrote: > Hi I cannot see where in the django documentation it states that you > shouldn't do something like this: >  ** (as an example of a potential > attribute injection vector[0] - where you are not using a URLField or > failure to call full_clean (on a

Re: Just going to point this out ...

2011-02-18 Thread dave b
> Which of course it can't - it is properly escaped. > > Cheers > > Tom > Yes. -- 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 dj

django book example HELP..

2011-02-18 Thread Dipo Elegbede
Hi all, i am currently reading the django book and following the examples step by step. I have a view defined as follows: from django.http import Http404, HttpResponse import datetime #def myhome(request): #message = """ #MY HOME # #

Re: confused about ModelForm Field validation

2011-02-18 Thread Roman Klesel
2011/2/18 Roman Klesel : >> I would use pre_save signal for data modification did not really work. In any case I need to use to_python so that the ModelForm displays the right value, and then I'm in *BEEP*, since to_python not only receives the values from the db but also get's passed the return

Re: django book example HELP..

2011-02-18 Thread Tom Evans
On Fri, Feb 18, 2011 at 3:04 PM, Dipo Elegbede wrote: > > Hi all, > i am currently reading the django book and following the examples step by > step. > I have a view defined as follows: > from django.http import Http404, HttpResponse > import datetime > #def myhome(request): > #    message = """

Re: db_manager with add method

2011-02-18 Thread beyond liu
Sorry I forgot to give the link to the ticket: http://code.djangoproject.com/ticket/13358 On Fri, Feb 18, 2011 at 9:16 PM, Leon Liu wrote: > Regarding the ticket13358, the status of it is fixed. > > Does this work for RelatedManager's add() method as well? I tried with > all(), and it did pick th

Re: django book example HELP..

2011-02-18 Thread Dipo Elegbede
Thumbs up Tom. I didn't even bother to open the links you sent, I just finished the tutorial. The name of the link said it all, capturing-text-in urls. I am most grateful. thanks all. I would have to read the links however to master these things. Regards. On Fri, Feb 18, 2011 at 4:20 PM, Tom

Re: South - when to start?

2011-02-18 Thread ShawnMilo
Just to add my tiny bit to this: I say start with South right away. But when you're ready to deploy for the first time, wipe it all and to another --initial. The reason is that South is awesome for letting you upgrade a production app that isn't allowed to stop working. So at first deployment,

Re: Admin - click through to parent / child

2011-02-18 Thread Alec
Thanks for the ideas, but those projects are more for arbitrary relationships. I'm thinking about just extending the basic functionality of the admin site like in this image: http://i53.tinypic.com/16h10m0.png On Feb 18, 2:03 am, Derek wrote: > On Feb 16, 7:22 pm, Alec wrote: > > > Hi, > > > I

Django pagination is repeating results

2011-02-18 Thread diogobaeder
Hi, I have this weird pagination bug in Django: using object_list as a return of a view, but passing a "paginate_by" argument to it, it's repeating some of the results; Otherwise, if I remove the argument or set as "paginate_by=None", the results are correct. If using pagination, the quantity of

Re: Just going to point this out ...

2011-02-18 Thread Mike Ramirez
On Friday, February 18, 2011 06:07:57 am dave b wrote: > On 19 February 2011 00:57, Shawn Milochik wrote: > > I also didn't see the part where they state that you shouldn't put your > > database login information in a template. That's probably because Django > > is designed to allow Web developer

Re: Django pagination is repeating results

2011-02-18 Thread David De La Harpe Golden
On 18/02/11 17:38, diogobaeder wrote: > Hi, > Any ideas of what might be happening? > Have you set a Meta.ordering on your Model (or applied an .order_by() to the QuerySet?) -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this gro

Re: Messages framework is not showing messages in my templates

2011-02-18 Thread Xavier Ordoquy
Hi, It's been some time I haven't used the messages framework but don't you see your messages with some lags ? Like try to submit twice your form and see if you don't get the messages after the second post (and don't go in the admin between those requests). When forms are valid, I usually redire

Re: Messages framework is not showing messages in my templates

2011-02-18 Thread Daniel Roseman
On Friday, February 18, 2011 10:56:54 AM UTC, Gabriel Prat wrote: > > Hi all, I'm trying to use messages framework, I've checked that > middleware, context processor and app is well configured (I'm running > django development version which a standard manage.py startproject > includes all needed

Re: Admin - click through to parent / child

2011-02-18 Thread Daniel Roseman
On Friday, February 18, 2011 5:02:43 PM UTC, Alec wrote: > > Thanks for the ideas, but those projects are more for arbitrary > relationships. I'm thinking about just extending the basic > functionality of the admin site like in this image: > > http://i53.tinypic.com/16h10m0.png > If you want

GeometryCollectionField with MultiPolygon

2011-02-18 Thread jordi
I have a class with a GeometryCollectionField, when I try to save a MultiPolygon object in the GeometryCollectionField I always get a NULL value in the GeometryCollectionField. Other types of objects saved in the GeometryCollectionField work fine. Somebody knows whats happening? from django.contr

Re: How to reinstall Python Interpreters?

2011-02-18 Thread LJ
I am on Ubuntu 10, using Python 2.6 and Django 1.2.3. Mike Ramirez suggested that I look at the site packages (in my case dist-packages) in my python lib dir. I did not see anything in there that references dajaxice. I may need to manually edit the PYTHONPATH once I figure out how and where. My e

How To Serve Javascript, CSS, Files

2011-02-18 Thread hank23
Let me preface the following information by saying that I’m trying to build this into the polls application that I built in the introductory django tutorial. The document I’m looking at is here: http://docs.djangoproject.com/en/1.2/howto/static-files/ And it says this: How to do it¶ Here’s the

Python's 20th Birthday (well, public release birthday) Extravaganza Lunch Party!

2011-02-18 Thread Gabriel Gunderson
What: Python's 20th Birthday (well, public release birthday) Extravaganza Lunch Party! When: Monday at 12:15 Where: Izeni. We're located at the Novell TCN, also known as the building formerly known as OSTC, also known as (but not really numbered as) building A. (Campus Map: http://bit.ly/Python

Re: How to reinstall Python Interpreters?

2011-02-18 Thread LJ
Just adding a note for anyone else struggling with a similar 'unresolved import' problem... This article explains in details how to modify the PYTHONPATH if you decide to go that route. http://www.stereoplex.com/blog/understanding-imports-and-pythonpath I don't prefer to use this method, but I no

Re: Just going to point this out ...

2011-02-18 Thread dave b
> > is this what you're looking for? > > http://www.owasp.org/index.php/OWASP_Application_Security_FAQ > > Mike Hi Mike. Well in this case the page would be http://www.owasp.org/index.php/XSS_%28Cross_Site_Scripting%29_Prevention_Cheat_Sheet but yes that link is a good starting point. I should c

Re: list indices must be integers not unicode

2011-02-18 Thread Burhan
id_list = [int(x) for x in data.keys() if x.isdigit()] -- 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 django-users+unsubscr...@go

Re: RE: 'str' object is not callable

2011-02-18 Thread Burhan
Where is 'deletion_time' defined, in reference to the urls.py? The error is that urls.py can't resolve deletion_time, which is why its saying that "I cannot call a string object". I would investigate that. Try qualifying it by giving it the module name. On another note, you can concatenate you

Using success_url with reverse() in class-based generic view

2011-02-18 Thread jnns
Hi users, I have a CreateView which I'd like to redirect to a custom success_url defined in my URLconf. As I want to stick to the DRY-principle I just did the following: success_url = reverse("my-named-url") Unfortunately, this breaks my site by raising an "ImproperlyConfigured: The included

Integer as select box and prepolutated field as foreignkey

2011-02-18 Thread Aimee
I'm creating a comic book database that will have something like this: Title (ForeignKey is title) Issue Writer Artist Cover Artist... etc Lots of comic book issues have the same writer, artist and cover artist, so for the issue #, I'd like to be able to select numbers - say, select numbers 1

Re: How to reinstall Python Interpreters?

2011-02-18 Thread lduros
Did you install dajaxice through apt-get? From the command line: sudo apt-get install python-django-dajaxice If not, you might want to try it it might do the trick of installing it in a much easier way than from the sources. On Feb 18, 5:04 pm, LJ wrote: > Just adding a note for anyone else strug

Constant signing out on production server - Django 1.2.5

2011-02-18 Thread Velian
Hello there I am having a frustrating issue: I'm running Apache/modpython with Django 1.2.5. It seems that every few seconds or so, when I try to load a page after logging in (either to the site or to the admin interface), I am bounced back to the login screen as if my session has expired. My lo

Re: Constant signing out on production server - Django 1.2.5

2011-02-18 Thread Shawn Milochik
By chance, is the client running Windows and using IE? If so, is their system time incorrect? I've had major problems with session timeouts myself, and ended up handling session expiration in custom middleware because I never could figure it out, and over a period of months this list was no help e

Bash autocompletion for django-admin.py/manage.py

2011-02-18 Thread Anurag
I just posted a simple script to autocomplete django-admin.py/manage.py commands in bash: https://github.com/agoel/django-bash-complete I hope it can save everyone some keystrokes. Best, Anurag -- You received this message because you are subscribed to the Google Groups "Django users" group.