Re: Automatic form submission and CSRF??

2010-09-26 Thread Joakim Hove
Thanks a lot - that did the trick! Joakim On Sep 27, 1:58 am, Russell Keith-Magee wrote: > On Mon, Sep 27, 2010 at 12:18 AM, Joakim Hove wrote: > > Hello, > > > I have a simple form which has method POST. When I view the form in > > the browser

Re: sql query: how to

2010-09-26 Thread akaariai
The most efficient? Exactly that using raw SQL. I think something along the following will also work: Foo.objects.only('fieldname').value_list().distinct().order_by('fieldname'). - Anssi On Sep 27, 5:49 am, Bobby Roberts wrote: > what is the most efficient way to do the

Re: Upload a File using the request.POST data

2010-09-26 Thread Danny Bos
There is no form, it's entirely Javascript. Spoke to the creator of the script, who has popped up script examples for PHP and ColdFusion he reckons: "You basically have to put the whole post contents into a file." Not altogether helpful, eh? d On Sep 27, 1:52 pm, Sam Lai

Re: Upload a File using the request.POST data

2010-09-26 Thread Sam Lai
Have you got the right attribute in the form? >From http://docs.djangoproject.com/en/dev/topics/http/file-uploads/ "Note that request.FILES will only contain data if the request method was POST and the that posted the request has the attribute enctype="multipart/form-data". Otherwise,

Re: Upload a File using the request.POST data

2010-09-26 Thread Danny Bos
Can it even be done? It seems pretty ordinary but everything I'm trying expects it to be a request.FILE. Frustrating stuff. d On Sep 27, 11:24 am, Danny Bos wrote: > Heya, > > I'm using the 'Valums File Uploader' which passes the file in the > request.POST as you can

Re: In admin, is there a post-commit hook that is executed after all models and inlines are saved?

2010-09-26 Thread jonathan.morgan
Update: Well, I cobbled together a few things to accomplish most of what I needed to accomplish, and figured I'd write it down here so I can look it up later and so others can learn from it (the doc on m2m_changed, in particular, is not incomplete, but not detailed or particularly precise, and I

sql query: how to

2010-09-26 Thread Bobby Roberts
what is the most efficient way to do the following sql command in django? select distinct fieldname from table order by fieldname -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to

Upload a File using the request.POST data

2010-09-26 Thread Danny Bos
Heya, I'm using the 'Valums File Uploader' which passes the file in the request.POST as you can see below. I'm wondering how to get that data into an actual file. Any ideas would be great as things like "for chunk in f.chunks()" only works on request.FILES which in this case is empty. Thanks,

Need access to http basic authentication from request object inside view

2010-09-26 Thread mortenlp
Dear reader I have been fighting this really simple problem for 12 straight hours now. I just really can't seem to gain access to the simple http authorization string from my view-functions. e.g: "Basic bWF4bTpwYXNzd29yZA==" Here is my simple test function inside my views.py: def

Re: Automatic form submission and CSRF??

2010-09-26 Thread Amao Zhao
Hi, I think you should add the 'django.middleware.csrf.CsrfResponseMiddleware' into your MIDDLEWARE_CLASSES in the settings model. Yours, BR On Mon, Sep 27, 2010 at 7:58 AM, Russell Keith-Magee < russ...@keith-magee.com> wrote: > On Mon, Sep 27, 2010 at 12:18 AM, Joakim Hove

Re: JavaScript with Dango

2010-09-26 Thread Axel Bock
I gotta say this is the kind of answer which usually upsets me for obvious reasons, although I gotta admit the question surely is not very well phrased, too :) But well. I just discovered dajaxproject.com from another thread - maybe you could start from there. It seems to be a framework which

Re: Automatic form submission and CSRF??

2010-09-26 Thread Russell Keith-Magee
On Mon, Sep 27, 2010 at 12:18 AM, Joakim Hove wrote: > Hello, > > I have a simple form which has method POST. When I view the form in > the browser and fill it normally everything works fine. However; the > plan is to submit this form automagically from a client program - I

Re: Vim for Python and Django

2010-09-26 Thread Tran Cao Thai
@flebber: try this http://tortoisehg.bitbucket.org/ On Mon, Sep 27, 2010 at 9:28 AM, Mathieu Leduc-Hamel wrote: > Anybody know of there's the same kind of resources for emacs ? > > On Sun, Sep 26, 2010 at 7:22 PM, flebber wrote: >> Do the instructions

Re: JavaScript with Dango

2010-09-26 Thread CrabbyPete
Yes. On Sep 26, 7:48 am, aug dawg wrote: > Does Django work with JavaScript? If so, how can I use JavaScript in my > Django projects? -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to

Re: Vim for Python and Django

2010-09-26 Thread Mathieu Leduc-Hamel
Anybody know of there's the same kind of resources for emacs ? On Sun, Sep 26, 2010 at 7:22 PM, flebber wrote: > Do the instructions here http://code.google.com/p/trespams-vim/wiki/readme > only work on linux ? I tried to follow it on Windows as i wanted to > download and

Re: Vim for Python and Django

2010-09-26 Thread flebber
Do the instructions here http://code.google.com/p/trespams-vim/wiki/readme only work on linux ? I tried to follow it on Windows as i wanted to download and try your version but received this error. C:\>hg clone https://trespams-vim.googlecode.com/hg/ trespams-vim 'hg' is not recognized as an

Re: problem with saving a form

2010-09-26 Thread Marc Aymerich
On Sun, Sep 26, 2010 at 10:15 PM, Marc Aymerich wrote: > > > On Sun, Sep 26, 2010 at 8:51 PM, Marc Aymerich wrote: > >> I'm trying to make a ModelForm in order to edit an existing object of the >> class 'member'. So I followed this documentation: >> >>

Re: problem with saving a form

2010-09-26 Thread Marc Aymerich
On Sun, Sep 26, 2010 at 10:34 PM, Karen Tracey wrote: > On Sun, Sep 26, 2010 at 4:15 PM, Marc Aymerich wrote: > >> It seems that the condition request.method == 'POST' is never true :( >> whyy?? > > > What does the template that contains the form look

Re: problem with saving a form

2010-09-26 Thread Karen Tracey
On Sun, Sep 26, 2010 at 4:15 PM, Marc Aymerich wrote: > It seems that the condition request.method == 'POST' is never true :( > whyy?? What does the template that contains the form look like? Karen -- http://tracey.org/kmt/ -- You received this message because you are

Re: problem with saving a form

2010-09-26 Thread Marc Aymerich
On Sun, Sep 26, 2010 at 8:51 PM, Marc Aymerich wrote: > I'm trying to make a ModelForm in order to edit an existing object of the > class 'member'. So I followed this documentation: > > > http://docs.djangoproject.com/en/dev/topics/forms/modelforms/#the-save-method > > > #

Re: reverse ForeignKey

2010-09-26 Thread ionut cristian cucu
2010/9/25 Daniel Roseman : > > > On Sep 25, 9:51 am, ionut cristian cucu wrote: >> I've tried to do something like that: >> class Pacienti_manager(models.Manager): >>   def get_visible(self): >>     return(super(Pacienti_manager, >>

Re: Problem testing a view decorated with @login_required

2010-09-26 Thread Brandon Taylor
Sorry, the second test is the one that fails. On Sep 26, 2:01 pm, Brandon Taylor wrote: > Hi Everyone, > > I'm having an issue testing a page protected with @login_required. I'm > loading a user via a fixture. I can call > self.client.login(**credentials) successfully

Problem testing a view decorated with @login_required

2010-09-26 Thread Brandon Taylor
Hi Everyone, I'm having an issue testing a page protected with @login_required. I'm loading a user via a fixture. I can call self.client.login(**credentials) successfully and get True back. I can retrieve a User object using the _auth_user_id key held in session from the call to

problem with saving a form

2010-09-26 Thread Marc Aymerich
I'm trying to make a ModelForm in order to edit an existing object of the class 'member'. So I followed this documentation: http://docs.djangoproject.com/en/dev/topics/forms/modelforms/#the-save-method # Create a form to edit an existing Article. >>> a = Article.objects.get(pk=1) >>> f =

Re: Patterns / Best practice for automated data refreshes

2010-09-26 Thread ALJ
Hi Shawn, Thanks for that. I'll have a look at using models then. Cheers ALJ On Sep 26, 7:32 pm, Shawn Milochik wrote: > If you're updating a database created by Django, I recommend that your import > script import your Django models and update them with the data.

Re: Patterns / Best practice for automated data refreshes

2010-09-26 Thread Shawn Milochik
If you're updating a database created by Django, I recommend that your import script import your Django models and update them with the data. Otherwise you run the risk of running SQL that breaks your Django app (or worse, causes it to run with corrupted data and no errors). I'd do something

Re: [Announcement] Vim for Python and Django

2010-09-26 Thread ionut cristian cucu
Very helpful, thanks alot! 2010/9/26 Piotr Zalewa : >  Hi Antoni, > > Thanks for that! > > zalun > > On 09/26/10 10:36, Antoni Aloy wrote: >> Hello all! >> >> In this list we have a recurrent thread: "What'ts the best IDE for >> Django and Python development?" trespams-vim is my

Automatic form submission and CSRF??

2010-09-26 Thread Joakim Hove
Hello, I have a simple form which has method POST. When I view the form in the browser and fill it normally everything works fine. However; the plan is to submit this form automagically from a client program - I have currently tried with the Python script: #!/usr/bin/python import urllib params

Patterns / Best practice for automated data refreshes

2010-09-26 Thread ALJ
We have an extranet web application (using sqlite) that is hosted outside our network. One of the tables it uses is an excel report from our main accounting system that contains a list of our customers. To begin with this was imported manually but now I want to set up an automated monthly refresh

Re: JavaScript with Dango

2010-09-26 Thread Felix Dreissig
Yep, sure you can use AJAX/Javascript in Django projects. http://www.b-list.org/weblog/2006/jul/02/django-and-ajax/ might be a good read. Regards, Felix On 26.09.2010 13:48, aug dawg wrote: > Does Django work with JavaScript? If so, how can I use JavaScript in my > Django projects? > > -- >

Re: JavaScript with Dango

2010-09-26 Thread Daniel Roseman
On Sep 26, 12:48 pm, aug dawg wrote: > Does Django work with JavaScript? If so, how can I use JavaScript in my > Django projects? What a strange question. Django creates web pages, and you can use JavaScript in the pages it produces just as you would with any other

JavaScript with Dango

2010-09-26 Thread aug dawg
Does Django work with JavaScript? If so, how can I use JavaScript in my Django projects? -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send

Re: [Announcement] Vim for Python and Django

2010-09-26 Thread Piotr Zalewa
Hi Antoni, Thanks for that! zalun On 09/26/10 10:36, Antoni Aloy wrote: > Hello all! > > In this list we have a recurrent thread: "What'ts the best IDE for > Django and Python development?" trespams-vim is my try to answer this > question for people who likes to have a very powerful editor and

[Announcement] Vim for Python and Django

2010-09-26 Thread Antoni Aloy
Hello all! In this list we have a recurrent thread: "What'ts the best IDE for Django and Python development?" trespams-vim is my try to answer this question for people who likes to have a very powerful editor and needs to have an editor which is able to run in the desktop as well as in a remote

Re: Django on Apache

2010-09-26 Thread Vincent den Boer
On Saturday 25 of September 2010 20:36:52 Derek wrote: > Can someone briefly explain the difference between PHP apps -- which > run your code "as is" without need for refreshing the server -- and > Django? The difference is that Django starts once, loads all modules it needs and then starts