Re: Static images for use in admin widget

2011-09-07 Thread Micky Hulse
Hi Tomas, Thanks again for your tips and code samples, I really appreciate it. I really liked that technique of using __init__.py to add a constant to the settings.py file. Very cool! I get what you mean now when you say "I think hardcoding the 'app/' directory is the usual way to do this, you s

Re: Pagination of more than one field

2011-09-07 Thread OC
also attaching relevant parts of view.py: movpagin = Paginator(movies, 12) page = int(request.GET.get('page','1')) try: moviesp = movpagin.page(page) except PageNotAnInteger: # If page is not an integer, deliver first page. moviesp = movpagin.page(1) exc

Re: intercept calls to reverse(..) in tests

2011-09-07 Thread Daniel Roseman
On Wednesday, 7 September 2011 07:49:00 UTC+1, Reikje wrote: > > Hi, I have a bunch of WebTest's which are using the reverse method > from django.core.urlresolvers to resolve a URL which the test should > call. Example: > > url = reverse('webapp_home') > form = self.app.get(url).form > > Now I

Re: Pagination of more than one field

2011-09-07 Thread bruno desthuilliers
On Sep 6, 4:41 pm, Yaşar Arabacı wrote: > I think your question can be solved with javascript and ajax, rather than > with django. How is your knowledge in that area? This can definitly be resolved with Django, and it's always better to have something working without js / ajax when possible (you

Re: Session value persistence between views

2011-09-07 Thread bruno desthuilliers
On Sep 6, 10:42 am, alaric wrote: > Hi: > I am very new to Django but I am trying to authenticate using Django's > session framework. > Problem is: I need the raw password to ssh as that user to retrieve > data on another machine. I haven't gotten it to work however. > > I have a login view that l

django comments: CSRF failure (randomly)

2011-09-07 Thread Alessandro Pasotti
Hi, this issue is driving me mad, I'm using Django 1.2 with the 'django.contrib.comments' applications, randomly I get 'CSRF token missing or incorrect' 'request_csrf_token': u'c22473c9626677f09a64c751df4bfa8a', 'META': {'HTTP_COOKIE': 'csrftoken=c04574f981417a4667db264bb527239d; there is a m

Re: Pagination of more than one field

2011-09-07 Thread Malcolm Box
On 7 September 2011 08:25, OC wrote: > also attaching relevant parts of view.py: > > > movpagin = Paginator(movies, 12) > >page = int(request.GET.get('page','1')) >try: >moviesp = movpagin.page(page) >except PageNotAnInteger: ># If page is not an integer, deliver firs

Re: django and thrift

2011-09-07 Thread Malcolm Box
On 7 September 2011 07:18, leon wrote: > Hi, > > I have one question. Is it possible to use Django to write thrift > (http://thrift.apache.org/) formated web service? If it is possible, > is there any sample? > > Possible, maybe. But almost certainly the wrong thing to do. Thrift is a binary pr

Re: Pagination of more than one field

2011-09-07 Thread OC
Thank you very much for your reply, I changed it but I guess Im doing something wrong cause it still doesnt work: It tries to go to the right page now, but provides nothing although I know there's more than one page: in views.py movies_page= int(request.GET.get('page','1')) try: movies

Re: Pagination of more than one field

2011-09-07 Thread Malcolm Box
On 7 September 2011 14:57, OC wrote: > Thank you very much for your reply, > I changed it but I guess Im doing something wrong cause it still > doesnt work: > It tries to go to the right page now, but provides nothing although I > know there's more than one page: > > in views.py > movies_page= in

Re: Extending admin's index view

2011-09-07 Thread Иван Иванов
So... На Fri, 2 Sep 2011 10:24:03 +0300 Ivan Ivanov написа: > Hallo everybody! > > I've got problem exteding the admin's index view. I need to pass > extra_context to the index of the admin, after the administrator > logged in, that's why I'm trying to extend the view. So... > > What I've got

Re: Session value persistence between views

2011-09-07 Thread alaric
Hi: Thanks for the reply. Actually, really dumb mistake, of course. I was using the default django login view to authenticate, which means that my view called "login" was never storing the session value! Once I used my own login view, I was able to store my values correctly. On Sep 7, 5:11 am, bru

In unitTest, GET Formset returns 302 instead of 200

2011-09-07 Thread MATHIEU
Hi, I want to test the GET method for an inline formset. The view in which the inline formset is created is as follows: @login_required def patron_edit_phone(request, *args, **kwargs): patron = request.user PhoneNumberFormSet = inlineformset_

django-nani usage

2011-09-07 Thread Janis Meiers
Hello, Does anyone use django-nani for model translations? I'm a newbie to django, and my question is: How do you switch languages in after you've set up your translations with django-nani? Do I have to set up a url in urls.py with language codes in it, and then in corresponding view filter my data

Streamlining DJango Deployment — Novel idea from the world of CMSs

2011-09-07 Thread Alec Taylor
Good morning, I have just recently starting migrating over from WordPress and Drupal to the world of DJango. First of all, let me say that yes, I am aware that DJango is not a CMS!!! Now, onto my suggestions on how to streamline DJango deployment. = What's wrong with the current method? =

Re: In unitTest, GET Formset returns 302 instead of 200

2011-09-07 Thread Malcolm Box
On 7 September 2011 11:52, MATHIEU wrote: > For the GET method, I have tried the following code: > >def test_patron_phone_get_form(self): >self.client.login(usernamer='alex...@e.com', > password='alex') >response = self.client.get(rever

Re: Streamlining DJango Deployment — Novel idea from the world of CMSs

2011-09-07 Thread Donald Stufft
We talked a little on IRC, but just thought i'd reiterate my thoughts. This should not be in core, and I don't believe it ever has a chance of being in core. That being said, I think that an external "installer" app like this wouldn't be the worst thing in the world, and could help to make a

Re: Authorization workflow model

2011-09-07 Thread Mario8k
On 5 sep, 17:27, Shawn Milochik wrote: > You could use a model with three fields: >     A generic foreign key to the instance to be modified. >     A char field containing the fieldname on that instance. >     The new value. > > Of course you'd need another field to store the user (assuming the

Re: In unitTest, GET Formset returns 302 instead of 200

2011-09-07 Thread Xinlei CHEN
@Malcolm, Sorry It should be some bad pastes :( Finally, I have solved the problem using the following 2 lines: c = Client() c.login(username='alex...@e.com', password='alex') In fact, I can't login in with the following code self.client.login(username='alex...@e.com', password='alex') I don't

Re: Authorization workflow model

2011-09-07 Thread Mario8k
On 6 sep, 00:55, Mike Dewhirst wrote: > On 6/09/2011 5:46am, Mario8k wrote: > > > Hello, > > > Does anyone knows some solution (reusable app, snippet or any idea) to > > model an authorization workflow of data? > > > That is... supose that a user have restricted some model field, ie, > > cannot

Re: Authorization workflow model

2011-09-07 Thread Mario8k
On 6 sep, 06:31, Julien Castets wrote: > Hi, > > I faced to the same problem than you a few weeks ago, and I found this > :https://github.com/dominno/django-moderation#readme > It seems to be what you're searching. > This reusable app seems to work for me. I will try it. Thanks. > Julien Caste

Re: Pagination of more than one field

2011-09-07 Thread OC
works as a charm thanks On 7 ספטמבר, 17:05, Malcolm Box wrote: > On 7 September 2011 14:57, OC wrote: > > > > > > > Thank you very much for your reply, > > I changed it but I guess Im doing something wrong cause it still > > doesnt work: > > It tries to go to the right page now, but provides

psycopg2 and Binary

2011-09-07 Thread Jonathan S
Hi django users, Not sure whether this is a bug or configuration issue. I have a postgres with postgis setup. It works perfect on a postgres 8.4 machine, but it doesn't on a postgres 9.1 machine. The problem is when constructing GIS queries. django.contrib.gis relies on psycopg2.Binary for encod

Re: psycopg2 and Binary

2011-09-07 Thread Jonathan S
So, it works if I patch django.contrib.gis.db.backends.postgis.adapter. But that's obviously *not* the way to go... class PostGISAdapter(object): ... def getquoted(self): "Returns a properly quoted string for use in PostgreSQL/ PostGIS." # Want to use WKB, so wrap with psy

Re: How to group models month by month.

2011-09-07 Thread Matteius
I would suggest trying not to break up the date and simply use a DateField and a separate IntegerField (or BigIntegerField). Of course you avoid using a DateTimeField since the time would be irrelevant, and if you think the day is irrelevant think again. Assign a meaning to the date and your logi

Re: Streamlining DJango Deployment — Novel idea from the world of CMSs

2011-09-07 Thread Doug Ballance
I would agree with Donald, and expand on that to say that an installer would probably be best written in php for widest compatibility. A php based installer would run outof the box on most webservers, and be able to give a guided overview of the python/web environment setup. It would easily be abl

Re: Streamlining DJango Deployment — Novel idea from the world of CMSs

2011-09-07 Thread Calvin Spealman
Can you explain to those of us to whom it is not obvious, what is the point of this proposal? I don't understand what problem it would solve. On Wed, Sep 7, 2011 at 10:41 AM, Alec Taylor wrote: > Good morning, > > I have just recently starting migrating over from WordPress and Drupal to > the wor

Django Projects in Gedit

2011-09-07 Thread Micah Carrick
For those of you working in GNOME 3 on Linux, I just put a new plugin up on GitHub for managing django projects from within Gedit. I haven't done much testing yet, so watch that repo for commits over the next few weeks while I'm working on a large Django project. https://github.com/Quixotix/gedit-

Re: Django Projects in Gedit

2011-09-07 Thread Joseph Slone
Slick, I use gedit, when I'm not in vim. I'll have to try that out. On Wed, Sep 7, 2011 at 5:16 PM, Micah Carrick wrote: > For those of you working in GNOME 3 on Linux, I just put a new plugin up on > GitHub for managing django projects from within Gedit. I haven't done much > testing yet, so

Re: Django Projects in Gedit

2011-09-07 Thread Felipe Lopez
2011/9/7 Micah Carrick > For those of you working in GNOME 3 on Linux, I just put a new plugin up on > GitHub for managing django projects from within Gedit. I haven't done much > testing yet, so watch that repo for commits over the next few weeks while > I'm working on a large Django project. >

Re: django and thrift

2011-09-07 Thread Li Lirong
Hi, Thank you for your comments. I am new to both django and thrift. I am hosting my service with a shared web hosting server. That's why I want to use django to expose a thrift API. Basically, what I want is to have a web service that can be consumed by both python and c++. Do you think this

Re: automatic type conversion from URL parameters

2011-09-07 Thread joshjdevl
> One solution to your problem could be to write a decorator that takes a > list of types (plus something like None for "don't care") and > automatically converts argument N to thetypein the N-th element of the > list before calling your function. How would one write a decorator to take a list of

RE: automatic type conversion from URL parameters Options

2011-09-07 Thread joshjdevl
> One solution to your problem could be to write a decorator that takes a > list of types (plus something like None for "don't care") and > automatically converts argument N to thetypein the N-th element of the > list before calling your function. Is there an example or tutorial showing how to wri

Re: multiple filters on the same (reversed) foreignkey leads to multiple join

2011-09-07 Thread Peter of the Norse
That is expected behavior. The filter should be read as “there is a child with flag1 equals true”. Another example where this is the desired behavior would be Band.objects.filter(member__name='John', member__name='Paul', member__name='George', member__name='Ringo') . In this case you are looking

Re: Streamlining DJango Deployment — Novel idea from the world of CMSs

2011-09-07 Thread Alec Taylor
Looks like the initial mockup for the final display didn't Ctrl+V properly, here it is: http://i55.tinypic.com/s5fivd.png The problem I'm trying to solve is one of deployment (and minimalist overvie

Re: intercept calls to reverse(..) in tests

2011-09-07 Thread Reikje
Excellent Daniel, thanks a lot. On Sep 7, 10:23 am, Daniel Roseman wrote: > On Wednesday, 7 September 2011 07:49:00 UTC+1, Reikje wrote: > > > Hi, I have a bunch of WebTest's which are using the reverse method > > from django.core.urlresolvers to resolve a URL which the test should > > call. Exam