Re: user.is_authenticated

2009-06-02 Thread Jarek Zgoda
Wiadomość napisana w dniu 2009-06-01, o godz. 18:50, przez Tim Sawyer: > > You need a RequestContext for the user object to be available in > templates > > http://lincolnloop.com/blog/2008/may/10/getting-requestcontext-your-templates/ > > I use a render_auth method instead of render_to_response

Re: Internationalization and Apache

2009-06-02 Thread Damien MATHIEU
So that is what I have in os.environ with Apache : LANG = en TZ = France/Paris DJANGO_SETTINGS_MODULE = setting.production SHLVL = 1 APACHE_RUN_USER = www-data APACHE_PID_FILE = /var/run/apache2.pid PWD = /home/git/pyki/public APACHE_RUN_GROUP = www-data TMPDIR = /tmp/passenger.31221/var HOME = /v

Re: extending django-registration ( MixIn ModelForm and Form)

2009-06-02 Thread Marco Bazzani
yes the problem using this method is that DRY principle is broken, because you redefine the fields that are already defined I was thinking of MixIn the 2 Forms to keep the whole thing reusable but nevermind, if this is the only way, I'll do it like this. thanks On Tue, Jun 2, 2009 at 05:57, Risha

Django with ajax

2009-06-02 Thread Aldo
Hey, I have some ajax running on my pages. I want to have it pass back some objects. However, I am unsure if I can pass a list of objects back. So far I have only ever passed back raw xml or text. Can objects be passed and then iterated via the html template? Thanks --~--~-~--~~

Re: Django with ajax

2009-06-02 Thread Jorge Bastida
Hello Marc, You can render a template into an string. from django.template.loader import render_to_string my_template = render_to_string('template.html',{'some':'data'}) If you want to send the list of objects to the browser you can use serialization into json: http://docs.djangoproject.com/en/d

Re: ModelForm problems, Programming Error 1146

2009-06-02 Thread Robocop
Well i only say the e.save() line causes social mayhem as when doing a line by line debug of that section, that's the command that causes all the trouble. I suspected there's a problem with my dispatch.cgi script, as if i were to manually add the table i get the same behavior (though adding the r

Re: Internationalization and Apache

2009-06-02 Thread Graham Dumpleton
On Jun 2, 6:03 pm, Damien MATHIEU <4...@dmathieu.com> wrote: > So that is what I have in os.environ with Apache : > LANG = en > TZ = France/Paris > DJANGO_SETTINGS_MODULE = setting.production > SHLVL = 1 > APACHE_RUN_USER = www-data > APACHE_PID_FILE = /var/run/apache2.pid > PWD = /home/git/pyki

Using Request Info in Generic Views

2009-06-02 Thread Keyton Weissinger
I know I'm in the minority, but I'm still having some trouble grokking the details of generic views. I keep thinking I should be using them but keep running into the same issue. Here's my problem: I am building a mgmt site for schools in which schools sign up for a monthly service fee. Most of my

Re: Using Request Info in Generic Views

2009-06-02 Thread Keyton Weissinger
http://groups.google.com/group/django-users/browse_thread/thread/bde817d4620fdfec On Tue, Jun 2, 2009 at 7:33 AM, Keyton Weissinger wrote: > I know I'm in the minority, but I'm still having some trouble grokking > the details of generic views. I keep thinking I should be using them > but keep ru

Re: Django with ajax

2009-06-02 Thread Aldo
Thanks Jorge, Dajax looks very useful. Ill do it with Json though until Dajax becomes mainstream. Thanks. On Jun 2, 10:47 am, Jorge Bastida wrote: > Hello Marc, > > You can render a template into an string. > > from django.template.loader import render_to_string > my_template = render_to_string

Re: request.session in template tag?

2009-06-02 Thread BluMarble
On Jun 1, 7:53 pm, "bax...@gretschpages.com" wrote: > I'm trying to write a template tag that accesses the user's > request.session. My problem is, I don't know how to get the request. > > Googling around, I saw references to including > TEMPLATE_CONTEXT_PROCESSORS in settings, but I'm still no

Re: Using Request Info in Generic Views

2009-06-02 Thread Sieker Adi Jörg
Hi, you can use this: http://docs.djangoproject.com/en/dev/topics/auth/#authentication-data-in-templates to add the user to the template context. Then you cold write template tags to actually get the data you need using the user template variable. http://docs.djangoproject.com/en/dev/how

Tastiest show-off Django template filters

2009-06-02 Thread Daniele Procida
I'm doing a demo of some of our Django work soon. Partly, it'll be a showcase for Django. One thing I'd like to do is demonstrate Django's template filters, to show how powerful it is and how it can make a a contribution to the quality of web output. So far I have: * typogrify * humanize Are th

Re: request.session in template tag?

2009-06-02 Thread BluMarble
If you just need the request obj passed to all pages. I use this in my URLs: # Custom Direct to template - carrys the request object def direct_to_template(request, template): from django.shortcuts import render_to_response from django.template import RequestContext return render_to_r

Re: Markdown Encoding Problem

2009-06-02 Thread Waylan Limberg
On Jun 1, 7:11 pm, Karen Tracey wrote: > > That comment, specifically, includes the same exception and traceback as you > are showing. I read subsequent discussion in the ticket to be saying that > the problem here is the markdown version, it's some pre-Unicode support > level that you likely d

proxy table filtering

2009-06-02 Thread Gord Allott
Hi, I have been a Django user for a long time now but only recently ran into a position where have needed to use Generic relationships, I need to be able to do something similar to filtering on a GenericForeignKey. Essentially I have a media management app that looks something similar to the foll

Utilizing Admin Views but with custom subset

2009-06-02 Thread malexs
I have successfully created a little app and i would like to leverage the already existing admin interface rather than reinvent the wheel and create my own table listings I have managed to do this fine for simple models but in this case i have a custom queryset that i would like to use. Essen

Re: Having trouble authenticating/validating

2009-06-02 Thread gsnyder2007
Had the same issue and the info below allowed me to resolve the issue, i.e. is_valid() is now returning True on a valid username/password combination. Seemed to me that the key was setting the test cookie and assigning the POST data into the 'data' variable. The former makes sense to me. The latte

Search in one table, order by a field in another table

2009-06-02 Thread Larry
Hi, Here is what I want to do: I have one table A with two columns: user_id, msg_id (ManyTOMany) and other table B with two column: msg_id, msg_time Now I want to search for msg_id's of a certain user_id in table A, and display the msgs ordered by the msg_time. Could anyone tell me how to do t

inline model's choices field empty in admin

2009-06-02 Thread ryan
When I edit a User in the admin, the sales_team and user_class dropdowns are empty. If anyone can point out my error or point me to the django core code that ignores the choices, I would greatly appreciate it. #models.py SALES_TEAM_CHOICES = enumerate(('CLS','CCS','TPS')) USER_CLASS_CHOICES = en

Re: Markdown Encoding Problem

2009-06-02 Thread bfrederi
Yes. I completely missed that ticket, but I had switched to importing markdown normally instead of through Django, and it solved my problems. But I noticed on Ubuntu that the repository version of python-markdown is still 1.6. So I will switch to a newer version of Markdown. Thank you both for yo

Re: inline model's choices field empty in admin

2009-06-02 Thread Karen Tracey
On Tue, Jun 2, 2009 at 10:59 AM, ryan wrote: > > When I edit a User in the admin, the sales_team and user_class > dropdowns are empty. > > If anyone can point out my error or point me to the django core code > that ignores the choices, I would greatly appreciate it. > > [snip code] I cannot rec

Re: Having trouble authenticating/validating

2009-06-02 Thread Karen Tracey
On Tue, Jun 2, 2009 at 9:42 AM, gsnyder2007 wrote: > > Had the same issue and the info below allowed me to resolve the issue, > i.e. is_valid() is now returning True on a valid username/password > combination. Seemed to me that the key was setting the test cookie and > assigning the POST data int

Re: inline model's choices field empty in admin

2009-06-02 Thread ryan
This additional model, which uses the same choices is emptying the choices dropdown of both User with inline UserProfile and UserProfile itself. Add it prior to UserProfile in models.py of your test app: class Person(models.Model): sales_team = models.IntegerField(choices=SALES_TEAM_CHOICES)

Re: inline model's choices field empty in admin

2009-06-02 Thread Daniel Roseman
On Jun 2, 4:53 pm, ryan wrote: > This additional model, which uses the same choices is emptying the > choices dropdown of both User with inline UserProfile and UserProfile > itself.  Add it prior to UserProfile in models.py of your test app: > > class Person(models.Model): >     sales_team = mode

Re: Search in one table, order by a field in another table

2009-06-02 Thread Daniel Roseman
On Jun 2, 3:04 pm, Larry wrote: > Hi, > > Here is what I want to do: > > I have one table A with two columns: user_id, msg_id (ManyTOMany) > and other table B with two column: msg_id, msg_time > > Now I want to search for msg_id's of a certain user_id in table A, and > display the msgs > ordered

Do you use a skeleton for new django sites?

2009-06-02 Thread Aaron Maxwell
Hi all, When creating a new django based website, my first step used to be to invoke "python manage.py startproject". The files created would be the first or second commit into version control for that project. I found, however, that I would always make a similar set of changes right after:

Re: inline model's choices field empty in admin

2009-06-02 Thread ryan
Thank you sir. I got this from "Python Web Dev. w/ Django". An unforseen side effect. ryan On Jun 2, 12:05 pm, Daniel Roseman wrote: > On Jun 2, 4:53 pm, ryan wrote: > > > This additional model, which uses the same choices is emptying the > > choices dropdown of both User with inline UserProf

Possible memory leak moving to Django 1.1 from 1.0.2 in mixed use test.

2009-06-02 Thread proteus...@gmail.com
We've got an application that is running behind apache, mod_wsgi and front ending a postgres 8.3 db. We needed to upgrade our Satchmo to the latest version which requires Django 1.1. After the upgrade the system starts eventually running out of memory until it thrashes and locks up the machine un

overriding model field defaults in inherited model class with static methods

2009-06-02 Thread herr.klein...@googlemail.com
Hi. I'm trying to override the defaults of an text field in an subclass. I thought i could accomplish that by the following code, but models.TextField(default = default('flags')... wouldn't find default (). I cant reference it by self.__class__.default() as the is no self at the field initializat

Automatically creating auth.models.group for an application

2009-06-02 Thread eric.frederich
In an application I'm writing I have a model that stores admins by location in a model called LocationAdmin. So in this model I have a foreign key to User and a foreign key to a Location object. I would like to override the save() method so that when an Admin is created they are assigned to a sp

Problem with startproject

2009-06-02 Thread Technicalbard
OK - newb here (in more ways than one). I'm trying to get going on an Ubuntu VM (inside VirtualBox) and I installed Django via synaptic. The problem comes when I try to start the tutorial: mor...@morgan-laptop:~/www$ django-admin startproject mysite Error: [Errno 13] Permission denied: '/home/m

Re: Problem with startproject

2009-06-02 Thread James Bennett
On Tue, Jun 2, 2009 at 12:46 PM, Technicalbard wrote: > The problem comes when I try to start the tutorial: > > mor...@morgan-laptop:~/www$ django-admin startproject mysite > Error: [Errno 13] Permission denied: '/home/morgan/www/mysite' Quoting the tutorial: "you may see the message “permissio

Re: Problem with startproject

2009-06-02 Thread TechnicalBard
django-admin is executable. The problem appears to be that django- admin doesn't have rights to the target directory... On Jun 2, 11:52 am, James Bennett wrote: > On Tue, Jun 2, 2009 at 12:46 PM, Technicalbard wrote: > > The problem comes when I try to start the tutorial: > > > mor...@morgan-l

Re: Problem with startproject

2009-06-02 Thread Jochem Berndsen
Technicalbard wrote: > OK - newb here (in more ways than one). I'm trying to get going on an > Ubuntu VM (inside VirtualBox) and I installed Django via synaptic. > > The problem comes when I try to start the tutorial: > > mor...@morgan-laptop:~/www$ django-admin startproject mysite > Error: [Er

Re: HOW DO YOU ACCESS SESSION AND COOKIES DATA W/O USING THE REQUEST OBJECT ?

2009-06-02 Thread akaariai
On 1 kesä, 22:38, Rami wrote: > I'm trying to access Session's (logged in) user id info from a py > function that does not have 'request' object. You could write up something similar to get_language() in utils.translation or use threadlocals. I don't know if this is actually a good idea. --~--

Re: Automatically creating auth.models.group for an application

2009-06-02 Thread Daniel Hilton
2009/6/2 eric.frederich : > > In an application I'm writing I have a model that stores admins by > location in a model called LocationAdmin.  So in this model I have a > foreign key to User and a foreign key to a Location object. > > I would like to override the save() method so that when an Admin

Re: Search in one table, order by a field in another table

2009-06-02 Thread Larry
Yes, this exactly what I want. Thanks a lot! -Larry On Jun 2, 12:11 pm, Daniel Roseman wrote: > On Jun 2, 3:04 pm, Larry wrote: > > > > > > > Hi, > > > Here is what I want to do: > > > I have one table A with two columns: user_id, msg_id (ManyTOMany) > > and other table B with two column: msg_i

django-reversion with recent svn django

2009-06-02 Thread Tim Sawyer
Hi, I'm using django svn 10784, and I've just added django-reversion, latest svn version from trunk (198). I'm using the middleware option for django- reversion. It's not working, and I'm getting the following error. I've tried with the same django version and the tagged 1.1.1 release of dja

Re: django-reversion with recent svn django

2009-06-02 Thread Tim Sawyer
Fixed it. I was assigning a string to a date field. Django is ok with this, django- reversion isn't. Changed: lDate = '%s-%s-%s' % (lYear, lMonth, lDay) lContestEvent.date_of_event = lDate to: lContestEvent.date_of_event = date(int(lYear), int(lMonth), int(lDay)) and all appears fine. Tim.

learning django

2009-06-02 Thread virgo
I am very new to this field..got a job as python programmer and was asked to use django for web developmentHow do u think I should start learning...I dont have much time left before they kick me out!! --~--~-~--~~~---~--~~ You received this message because

Test client DoesNotExists exception

2009-06-02 Thread SlafS
Hi! Im trying to test my app with django test Client. When I try to do 'get' to the '/accounts/' which in my urls.py is equiv to generic login view I get DoesNotExists exception and a traceback. check it here http://dpaste.com/50688/ . Can You tell me what am I doing wrong ? PS. when Im 'get'ing

Error/Warning/Info reporting from field class possible?

2009-06-02 Thread Marek Blažek
Hi all, is there any possibility to inform user in a Django admin about anything from field class? Let's have some custom field on a model. And I would like to inform user about anything after he pushes save button in Django admin form. class SomeField(models.FileField): . .

Accesing cliente devices

2009-06-02 Thread educonstantin
need to know the standard way that Django offers access to devices such as printers and scanners on the client side --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send em

Re: Accesing cliente devices

2009-06-02 Thread Alex Gaynor
On Tue, Jun 2, 2009 at 4:46 PM, educonstantin wrote: > > need to know the standard way that Django offers access to devices > such as printers and scanners on the client side > > > > Django doesn't. It's a server side web framework. It neither a) knows about the client side, nor b) handles print

Re: learning django

2009-06-02 Thread Hernan Olivera
2009/6/2 virgo : > > I am very new to this field..got a job as python programmer and was > asked to use django for web developmentHow do u think I should > start learning...I dont have much time left before they kick me > out!! You must follow the tutorial, and the django book, first. It

Where to configure this view

2009-06-02 Thread David
Hello, I added a "telephone_number = models.CharField(max_length=15)" in the "User" class in Django-1.0.2-final/django/contrib/auth/models.py. Now I need to add/update telephone numbers on admin page. Which file should I configure so that I can see this "telephone_number" on the admin page? Ca

Re: Where to configure this view

2009-06-02 Thread Alex Gaynor
On Tue, Jun 2, 2009 at 4:56 PM, David wrote: > > Hello, > > I added a "telephone_number = models.CharField(max_length=15)" in the > "User" class in Django-1.0.2-final/django/contrib/auth/models.py. Now > I need to add/update telephone numbers on admin page. Which file > should I configure so th

Re: Test client DoesNotExists exception

2009-06-02 Thread Karen Tracey
On Tue, Jun 2, 2009 at 4:30 PM, SlafS wrote: > > Hi! > > Im trying to test my app with django test Client. > When I try to do 'get' to the '/accounts/' which in my urls.py is > equiv to generic login view I get DoesNotExists exception and a > traceback. check it here http://dpaste.com/50688/ . >

Re: select template for adminform based on type of user

2009-06-02 Thread Sergio A.
any hint on this issue? Thanks, Sergio On May 29, 12:51 am, "Sergio A." wrote: > Dear all, > > Is it possible to select the template to be applied to an admin form > based on the logged user? > In particular, I've two cases: > > - if super user, a certain template should be used > - if not a su

Re: Where to configure this view

2009-06-02 Thread David
Thanks Alex David On Jun 2, 3:00 pm, Alex Gaynor wrote: > On Tue, Jun 2, 2009 at 4:56 PM, David wrote: > > > Hello, > > > I added a "telephone_number = models.CharField(max_length=15)" in the > > "User" class in Django-1.0.2-final/django/contrib/auth/models.py.  Now > > I need to add/update te

Re: Test client DoesNotExists exception

2009-06-02 Thread Slafs
Thanks a lot! That was it! Regards On 3 Cze, 00:21, Karen Tracey wrote: > On Tue, Jun 2, 2009 at 4:30 PM, SlafS wrote: > > > Hi! > > > Im trying to test my app with django test Client. > > When I try to do 'get' to the '/accounts/' which in my urls.py is > > equiv to generic login view I get D

Managers to aggregate child object values?

2009-06-02 Thread Streamweaver
I'm pretty new to Django still and I know much is still escaping me. In particular I'm having trouble still with how to query subsets of related objects. In this case I have two Models. class Project(models.Model): title = models.CharField(max_length=141) ... class Release(models.Model)

Re: Do you use a skeleton for new django sites?

2009-06-02 Thread Kenneth Gonsalves
On Tuesday 02 June 2009 22:09:03 Aaron Maxwell wrote: > Over time, I'll discover something new I'll want to add to all my django > sites.  So I just make that change to django-skel and forget about it. > > Does anyone else follow this technique? yes - I have only used the startproject startapp th

Re: HOW DO YOU ACCESS SESSION AND COOKIES DATA W/O USING THE REQUEST OBJECT ?

2009-06-02 Thread Rami
I know but, then again the set value for the language is only retrievable from a request obj. Thanks. On Jun 2, 1:03 pm, akaariai wrote: > On 1 kesä, 22:38, Rami wrote: > > > I'm trying to access Session's (logged in) user id info from a py > > function that does not have 'request' object. > >

Django Registration templates not talking to my other pages. Sometimes.

2009-06-02 Thread Matt
This is a weird one. It's so weird, I'm positive I'm making a very dumb mistake somewhere. This is my MO. Anyway, I am trying to use django-registration to do some very basic login, logout stuff. I'm using RequestContext to make usernames available to all of my templates, like so: //views.py fro

How would I do this ...

2009-06-02 Thread tsop
I have a small problem, fairly new to django: I currently am building a small CMS application, and its all handled by a Page model. The url for this is: --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users"

Re: Problem with startproject

2009-06-02 Thread Aaron Maxwell
On Tuesday 02 June 2009 10:46:03 am Technicalbard wrote: > OK - newb here (in more ways than one). I'm trying to get going on an > Ubuntu VM (inside VirtualBox) and I installed Django via synaptic. > > The problem comes when I try to start the tutorial: > > mor...@morgan-laptop:~/www$ django-admi

How would I do this ...

2009-06-02 Thread tsop
Hello! I have hit a small road block in designing a fairly simple CMS application: My url pattern is: url(r'^(?P[A-Za-z-_//]+)/$', page_handler, name='page_handler') I'm capturing whatever URL handing it off to a page handler view function that matches up a Page by slug and returns it .. this w

Django 1.1 to be in future Google App Engine release

2009-06-02 Thread Kegan
Just for everyone information, I believe Guido just said that Django 1.1 will be in future Google App Engine release once it (Django 1.1) is out of beta. Looking forward to this Django 1.1 final! Link here: http://code.google.com/p/googleappengine/issues/detail?id=872&colspec=ID%20Type%20Status

dumpdata and loaddata as simple DB migration tool?

2009-06-02 Thread Kegan
Hi, About Django database migration. I know there's a couple of tools available (South, evolution, dmigration, etc), but I am pondering an alternative here. Hope good discussion entails. This is what I am doing manually now for my database migration needs. 1. Use Django's management command "du

Newbie pls help with stored values

2009-06-02 Thread adelaide_mike
I am a newbie with Django and web stuff, but have long experience with desktop databases. In Django my user runs through a series of template.htmls choosing a particular great great grandchild object, a house. Then she must select a sales agent object. Just in general, how do I arrange for the

Re: dumpdata and loaddata as simple DB migration tool?

2009-06-02 Thread Russell Keith-Magee
On Wed, Jun 3, 2009 at 12:06 PM, Kegan wrote: > > Hi, > > About Django database migration. I know there's a couple of tools > available (South, evolution, dmigration, etc), but I am pondering an > alternative here. Hope good discussion entails. > > This is what I am doing manually now for my data