After sending HttpResponse

2009-03-17 Thread Ramashish Baranwal
Hi, I need to do some cleanup after sending a response to the client. That means I want to send response without returning a response object. Something like- def handler(request): # ... resp = HttpResponse(data) # send response in some way (?) # clean up, log, etc.. I know its u

Re: After sending HttpResponse

2009-03-17 Thread Malcolm Tredinnick
On Tue, 2009-03-17 at 00:12 -0700, Ramashish Baranwal wrote: > Hi, > > I need to do some cleanup after sending a response to the client. That > means I want to send response without returning a response object. > Something like- > > def handler(request): > # ... > resp = HttpResponse(dat

Re: Django forms and relationships

2009-03-17 Thread Yaniv Haber
You can do it in the same save. After you have the user object created, use it to create a UserProfile object: new_profile = UserProfile.objects.create(, user_fk=new_user,...) If you don't own the form (it comes from some package you don't want to change) then you can always inherit it and a

Re: Creating objects with references

2009-03-17 Thread Yaniv Haber
Solved it by changing from: prod = Product(name=self.cleaned_data['name'], description=self.cleaned_data['description']) prod.save() . . to: prod = Product.objects.create(name=self.cleaned_data['name'],... . . On Mar 17, 2:55 am, nivhab wrote: > hi, > > I ne

Re: After sending HttpResponse

2009-03-17 Thread Graham Dumpleton
On Mar 17, 6:19 pm, Malcolm Tredinnick wrote: > On Tue, 2009-03-17 at 00:12 -0700, Ramashish Baranwal wrote: > > Hi, > > > I need to do some cleanup after sending a response to the client. That > > means I want to send response without returning a response object. > > Something like- > > > def

Re: After sending HttpResponse

2009-03-17 Thread Ramashish Baranwal
> > I need to do some cleanup after sending a response to the client. That > > means I want to send response without returning a response object. > > Something like- > > > def handler(request): > >     # ... > >     resp = HttpResponse(data) > >     # send response in some way (?) > >     # clean

Re: How to say Hello "Somebody" in a Django form. Displaying data context values as non-input.

2009-03-17 Thread NoviceSortOf
Looking at the django document ref-forms-api Brian mentioned above from the python command line its clearly explicit that data passed as form = FormClass(data) only creates input fields. I get that but what I don't get is why the same value passed in render_to_response is passable as a string. (I

Re: How to say Hello "Somebody" in a Django form. Displaying data context values as non-input.

2009-03-17 Thread NoviceSortOf
Thanks everybody, the discussion has been very helpful. I've double checked my code, and have found passing the variable to render_to_response has different behaviour depending on how if the data is passed as data via form_class(data) or if passed directly in render_to_response. ie. in views.py

static files protect access

2009-03-17 Thread alain31
Hello, if I use pictures in a django project, that only some users can see (based on django's authentification middleware and special attributes), I cannot use static files as anybody could browse http://mediaurl/(...).jpg and access private photos. I thought to write a django view that returns

Username Blacklist

2009-03-17 Thread Andrew Turner
Hi, I have overridden my absolute urls like thus:- ABSOLUTE_URL_OVERRIDES = { 'auth.user': lambda o: "/%s/" % o.username, } so that users can access their profiles via http://mydomain.com/username However, if someone creates a user called, say, 'admin' or 'blog', it will conflict with othe

Re: Django critter helps us code at the speed of light.

2009-03-17 Thread Bro
It's so sweet and sincere :) Thank to your daughter :) --~--~-~--~~~---~--~~ 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

User, Auth, Group

2009-03-17 Thread Bro
Hi, I am using the User model with additional information. This model is called : MyUser. I try to use permission with group in admin but I have 'can add', 'can change', 'can delete'. When I give a 'can change' permission, a MyUser login, he can change every MyUser. My question is how do I give

Can't Internationalized

2009-03-17 Thread Eric
Hi, Now , I face a problem about Internationalization, I have used Django + python + extJs to created a log in html page. In the page , the user can select the language which will be shown in the next page . For instance, when you open the log in page , it was showed in English . Now , I just wa

My web page can not be Internationalized

2009-03-17 Thread Eric
Hi, Now , I face a problem about Internationalization, I have used django + python + extjs to created a log in html page. And my browser is Firefox. In the page , the user can select the language which will be shown in the next page . For instance, when you open the log in page , it was showed i

Guys, anyone get working Firebird database backend?

2009-03-17 Thread brawaga
Guys, who even got Django-to-Firebird database backend working, or knows how to, tell me please, how I can retrieve valid one? Maybe, there is guru who knows a common structure of the backend? In this case I can write it myself, maybe. I am finally tired out making cripplings to existing backend,

Poll Tutorial regarding __unicode__

2009-03-17 Thread TP
I am currently running through the first tutorial on the django projects site. When I have added the __unicode__() method to my models I don't see any change in how they're represented. I am using Django 1.0.2 So an old version is not the problem. My models.py looks like this: from django.db i

Re: User, Auth, Group

2009-03-17 Thread Dougal Matthews
The permission system doesn't understand the concept of users 'owning' things. Therefore, the permissions apply to everything. Can all, can change any or can delete any. This is something you need to implement yourself. You can do things to filter the admin so they only see models they edited. I wr

Re: Switching database backends at runtime?

2009-03-17 Thread Oliver Beattie
Thanks for your quick reply :) Basically, what I want to do has to apply to every query made to the database, not just one query. Basically, I want to do a dry-run of some things before doing them. Since MySQL doesn't support schema alterations inside a transaction, I can't do it that way. I'm s

Re: Poll Tutorial regarding __unicode__

2009-03-17 Thread Oliver Beattie
__unicode__ is called when unicode(ModelInstance) is called. __str__ is called when str(ModelInstance) is called. Internally, if you only define __unicode__, then Django will provide __str__ for you (see http://code.djangoproject.com/browser/django/trunk/django/db/models/base.py#L277 for the nit

Re: Starting custom settings with django-admin.py failed

2009-03-17 Thread Alex Robbins
Hmm, try opening up a python interpreter and importing "portal.settings". Does that work? If not there are two likely candidates: 1. It isn't enough for 'portal' to have an __init__.py file, it needs to be on your pythonpath. Check your pythonpath (import sys;print sys.path) 2. There is a syntax

Re: Username Blacklist

2009-03-17 Thread Alex Gaynor
On Tue, Mar 17, 2009 at 6:28 AM, Andrew Turner wrote: > > Hi, > > I have overridden my absolute urls like thus:- > > ABSOLUTE_URL_OVERRIDES = { >'auth.user': lambda o: "/%s/" % o.username, > } > > so that users can access their profiles via http://mydomain.com/username > > However, if someone

Re: Poll Tutorial regarding __unicode__

2009-03-17 Thread TP
Right I have now changed to use __unicode__ This looks like: from django.db import models class Poll(models.Model): question = models.CharField(max_length=200) pub_date = models.DateTimeField('date published') def __unicode__(self): return self.question def was_publishe

Re: Poll Tutorial regarding __unicode__

2009-03-17 Thread TP
>>> from mysite.polls.models import Poll, Choice >>> Poll.objects.all() [] Is my output. The desired output is: >>> Poll.objects.all() [] --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To po

Re: Poll Tutorial regarding __unicode__

2009-03-17 Thread Ramiro Morales
On Tue, Mar 17, 2009 at 9:20 AM, TP wrote: > > Right I have now changed to use __unicode__ > > This looks like: > > > from django.db import models > > class Poll(models.Model): >    question = models.CharField(max_length=200) >    pub_date = models.DateTimeField('date published') >    def __unico

Re: beginner model question - two tables without foreign keys (myslq - myisam)

2009-03-17 Thread Alex Robbins
The docs talk about models here: http://docs.djangoproject.com/en/dev/topics/db/models/ foreign keys here: http://docs.djangoproject.com/en/dev/ref/models/fields/#foreignkey and queries here: http://docs.djangoproject.com/en/dev/topics/db/queries/#retrieving-objects This advice isn't tested, so i

Re: Poll Tutorial regarding __unicode__

2009-03-17 Thread TP
When I try to run the Python shell again I get this: python manage.py shell Traceback (most recent call last): File "manage.py", line 4, in import settings # Assumed to be in the same directory. File "/home/cserv2_a/ug/scs5tdp/Desktop/mysite/mysite/settings.py", line 79 'mysite.poll

Re: User, Auth, Group

2009-03-17 Thread Bro
Thanks for your help, it works and filter nicely. But if in the url I change de ID from /1/ to /2/, I can access to others MyUser and modify everythings. The auth module can't be used for this kind of authentification ? If I have to implement myself, should I implement this outside the admin par

Re: Poll Tutorial regarding __unicode__

2009-03-17 Thread Alex Gaynor
On Tue, Mar 17, 2009 at 8:29 AM, TP wrote: > > When I try to run the Python shell again I get this: > > python manage.py shell > Traceback (most recent call last): > File "manage.py", line 4, in >import settings # Assumed to be in the same directory. > File "/home/cserv2_a/ug/scs5tdp/Desk

Re: Username Blacklist

2009-03-17 Thread Andrew Turner
2009/3/17 Alex Gaynor : > One way is to actively validate these, another is to just list that URL > pattern after your other ones, so that if someone goes to /admin/ it goes to > your admin, no they're profile. > > Alex Thanks for your reply. I do have the other url patterns listed before the pro

Re: Poll Tutorial regarding __unicode__

2009-03-17 Thread TP
This relates to the first tutorial on django project. My models.py file: from django.db import models import datetime class Poll(models.Model): question = models.CharField(max_length=200) pub_date = models.DateTimeField('date published') def __unicode__(self): return self.que

Re: How to say Hello "Somebody" in a Django form. Displaying data context values as non-input.

2009-03-17 Thread Karen Tracey
On Tue, Mar 17, 2009 at 5:33 AM, NoviceSortOf wrote: > > Looking at the django document > ref-forms-api Brian mentioned above from > the python command line its clearly explicit > that data passed as form = FormClass(data) > only creates input fields. I get that but > what I don't get is why the s

Setting up Facebook Connect for your test environment

2009-03-17 Thread Roboto
Hey guys, I'm trying to get facebook connect to work on my django site. I've hit a little snag where I imagine many of you just walked passed, but I'm clueless right now. My runserver runs on localhost:8000 --- but when I setup facebook connect the app is looking for http:///xd_receiver Any i

Re: Username Blacklist

2009-03-17 Thread Alex Gaynor
On Tue, Mar 17, 2009 at 8:35 AM, Andrew Turner wrote: > > 2009/3/17 Alex Gaynor : > > One way is to actively validate these, another is to just list that URL > > pattern after your other ones, so that if someone goes to /admin/ it goes > to > > your admin, no they're profile. > > > > Alex > > Tha

Re: User, Auth, Group

2009-03-17 Thread Dougal Matthews
Indeed, the admin doesn't really enforce this. The admin is for trusted users and thus the filter just helps people out but isn't for security. You would be better building your custom admin I think. If you start using model forms etc. its not really that hard. Dougal --- Dougal Matthews - @d0uga

Re: Setting up Facebook Connect for your test environment

2009-03-17 Thread Dougal Matthews
I don't really know much about Facebook Connect... but I assume the xd_reciever is called by Facebook? As in they make requests to it? Well then they will need access to it so localhost wont work. If you have set up your network to allow it, they could access you via your IP address? http://123.123

Re: Username Blacklist

2009-03-17 Thread Andrew Turner
2009/3/17 Alex Gaynor : > django-registration's views take a custom formclass, just subclsas the > default form and add a clean_username function to do the validation as > usuall.  If you want to get really clever about how you do it you could > import the Django resolver, test if "/%s/" % usernam

A distributed DB

2009-03-17 Thread Julián C . Pérez
Hi again Another questions circling my head... Anyone know any distributed DB system to engaged with Django/python?? I'm developing an storage application (uploading files into an account) and it'd be useful What about something like Cassandra, or Project Voldemort?? - opensource alternatives to A

More than one DB configuration in settings.py

2009-03-17 Thread Julián C . Pérez
Hi everyone I need some help here I'm in a rush, so I don't took first the time to explore the board and solve this doubt... How can I make two different DB configurations on the settings.py?? I mean... I manage my project through svn, but i make changes all over it on two enviroments... Yes, you

Re: More than one DB configuration in settings.py

2009-03-17 Thread Daniel Hepper
There is a page on the wiki which list several possible solutions to this problem: http://code.djangoproject.com/wiki/SplitSettings Regards, Daniel On Mar 17, 1:59 pm, Julián C. Pérez wrote: > Hi everyone > I need some help here > I'm in a rush, so I don't took first the time to explore the boa

Re: Django critter helps us code at the speed of light.

2009-03-17 Thread jwickard
Best group thread ever. On Mar 17, 6:19 am, Bro wrote: > It's so sweet and sincere :) > Thank to your daughter :) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send em

Re: Poll Tutorial regarding __unicode__

2009-03-17 Thread Oliver Beattie
Below that there will be an error. I'm guessing it may be a SyntaxError or NameError, since it looks like you have python after 'mysite.polls' (probably by accident) — that is if that traceback is right. On Mar 17, 12:36 pm, TP wrote: > This relates to the first tutorial on django project. > My

Re: Poll Tutorial regarding __unicode__

2009-03-17 Thread TP
I have fixed this error: now when I comes to view the admin site I get the error: AttributeError at /admin/ 'AdminSite' object has no attribute 'urls' On the webpage. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Group

Re: Poll Tutorial regarding __unicode__

2009-03-17 Thread Oliver Beattie
You're probably using the tutorial for the development (trunk) version of Django, but you're running 1.0.x — you should be following this tutorial: http://docs.djangoproject.com/en/1.0//intro/tutorial02/#activate-the-admin-site On Mar 17, 1:21 pm, TP wrote: > I have fixed this error: > > now wh

Re: Django forms and relationships

2009-03-17 Thread tdelam
Hi Yaniv, Thanks, I did give that a try before posting here since it just made sense but I always received a invalid keyword argument for this function when doing so. Is there something else I should be doing? On Mar 17, 4:44 am, Yaniv Haber wrote: > You can do it in the same save. After you ha

Re: delete in formset by clearing fields instead of checkbox

2009-03-17 Thread akaihola
Just in case anyone decides to use the code I posted earlier in this thread, there's one bug: the str() call needs to be replaced with a unicode() call to prevent failure with non-ASCII input. --~--~-~--~~~---~--~~ You received this message because you are subscribe

Re: override render_to_response

2009-03-17 Thread matehat
I think the closest you could get to a painless implementation of what you need, for existing apps, could be to create a method named something like "render_to_json_response", that behave the way you want and have the appropriate "views" modules in each app import it as "render_to_response" (indee

Re: Setting up Facebook Connect for your test environment

2009-03-17 Thread Chris Scott
On Mar 17, 2009, at 8:43 AM, Roboto wrote: > > Hey guys, > > I'm trying to get facebook connect to work on my django site. I've > hit a little snag where I imagine many of you just walked passed, but > I'm clueless right now. > > My runserver runs on localhost:8000 --- but when I setup faceboo

Re: Username Blacklist

2009-03-17 Thread Andrew Turner
Just for the record, I have created the following class (subclassing RegistrationFormUniqueEmail):- class RegistrationFormNonBlacklisted(RegistrationFormUniqueEmail): def clean_username(self): if self.cleaned_data['username'] in settings.BLACKLISTED_USERNAMES: raise forms.

Re: Username Blacklist

2009-03-17 Thread P M
why don't you use ABSOLUTE_URL_OVERRIDES = { 'auth.user': lambda o: "/*user*/%s/" % o.username, } so username will not collide with application name !!! Greetings. Puneet On Tue, Mar 17, 2009 at 3:14 PM, Andrew Turner wrote: > > Just for the record, I have created the following class (subc

Re: Username Blacklist

2009-03-17 Thread Andrew Turner
2009/3/17 P M : > why don't you use > ABSOLUTE_URL_OVERRIDES = { >    'auth.user': lambda o: "/user/%s/" % o.username, > } > > so username will not collide with application name !!! > Greetings. > Puneet Because I wanted the user's home page to be of the form http://mydomain.com/username !! --~-

Re: Username Blacklist

2009-03-17 Thread Dougal Matthews
and that would just to be too easy! You could use subdomains for the other parts of the site? would also be an easy/clean solution. or just have the other pages above the users in the url conf and register the other usernames yourself so nobody else can and they wont be viewable anyway. Dougal -

Re: Username Blacklist

2009-03-17 Thread Andrew Turner
2009/3/17 Dougal Matthews : > or just have the other pages above the users in the url conf and register > the other usernames yourself so nobody else can and they wont be viewable > anyway. > Dougal Yep, that's what I was doing originally, but I like the complicated way! Cheers, Andrew --~--~--

Re: User, Auth, Group

2009-03-17 Thread Bro
I go for it :) I hope I will manage :) Thanks Dougal for your help --~--~-~--~~~---~--~~ 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 unsubscr

Re: Poll Tutorial regarding __unicode__

2009-03-17 Thread TP
Help was much appreciated, thanks ;) On Mar 17, 1:26 pm, Oliver Beattie wrote: > You're probably using the tutorial for the development (trunk) version > of Django, but you're running 1.0.x — you should be following this > tutorial:http://docs.djangoproject.com/en/1.0//intro/tutorial02/#activate

Editing base_site.html

2009-03-17 Thread TP
How would people recommend me to do this? By editing the base_site.html file in text editor? By creating my own html page called base_site.html and putting it in the right Dir? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Goog

Re: best way to organize models that store businesses/hours?

2009-03-17 Thread luxagraf
Alex- Thanks for the suggestions... the 14 fields is definitely an option, but like you said it feels awkward and would make it hard to adapt should things change down the road. Darryl - > Darryl Ross wrote: > The first issue that comes to mind with that idea is what if the business has > mult

Re: static files protect access

2009-03-17 Thread Rajesh Dhawan
alain31 wrote: > Hello, > if I use pictures in a django project, that only some users can see > (based on django's authentification middleware and special > attributes), > I cannot use static files as anybody could browse http://mediaurl/(...).jpg > and access private photos. > I thought to wr

Re: Django forms and relationships

2009-03-17 Thread tdelam
Ah nevermind I got it worked out now. Thanks for the reply Yaniv On Mar 17, 9:39 am, tdelam wrote: > Hi Yaniv, > > Thanks, I did give that a try before posting here since it just made > sense but I always received a invalid keyword argument for this > function when doing so. Is there something e

Deployment error with apache/modpython

2009-03-17 Thread elm
I have a project which works OK on my development environment. In the production server (apache2, python 2.3, django 1.0) I get the following 2 errors: 1) After reloading apache I get a "ViewDoesNotExist" error the first few times I access the page. But after a few attempts (rloading the browse

Problem with formsets and uploading of files

2009-03-17 Thread Stefan Tunsch
Hi! I am having trouble getting a formset to work and handling the uploaded files. First of all, let me say that it's the first time I'm working with formsets. I've also never before tried to upload files. It is possible that I might be misunderstanding some basic stuff... My scenario is the f

Modify value of a Django form field during clean()

2009-03-17 Thread Ben Gerdemann
I am adding custom validation to my forms and custom fields in my Django app. I would like to be able to modify the value of a field when triggering an error. For example, if there is an error, the form should be redisplayed with the field value corrected by clean() and an error message "Data has

Re: Poll Tutorial regarding __unicode__

2009-03-17 Thread TP
Still working through this tutorial. I have got the problem: TemplateDoesNotExist at /polls/ polls/index.html Traceback: Environment: Request Method: GET Request URL: http://localhost:8060/polls/ Django Version: 1.0.2 final Python Version: 2.5.1 Installed Applications: ['django.contrib.auth'

Re: Django critter helps us code at the speed of light.

2009-03-17 Thread Ariel Mauricio Nunez Gomez
I already have my critter magic wallpaper on 3 out of my 4 desktops. He is truly a helpful little fellow. Ariel. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send emai

TemplateDoesNotExist

2009-03-17 Thread TP
I have an error in my traceback saying the index.html file does not exist, but it has been created in the correct DIR. This is my traceback, help would be appreciated: have got the problem: TemplateDoesNotExist at /polls/ polls/index.html Traceback: Environment: Request Method: GET Request

Re: best way to organize models that store businesses/hours?

2009-03-17 Thread Alex Gaynor
On Tue, Mar 17, 2009 at 10:56 AM, luxagraf wrote: > > Alex- > > Thanks for the suggestions... the 14 fields is definitely an option, > but like you said it feels awkward and would make it hard to adapt > should things change down the road. > > Darryl - > > > Darryl Ross wrote: > > The first issu

Re: Problem with formsets and uploading of files

2009-03-17 Thread Alex Gaynor
On Tue, Mar 17, 2009 at 11:09 AM, Stefan Tunsch wrote: > > Hi! > > I am having trouble getting a formset to work and handling the uploaded > files. > > First of all, let me say that it's the first time I'm working with > formsets. > I've also never before tried to upload files. > It is possible t

Re: Port in use Error

2009-03-17 Thread gordyt
TP I don't know if this applies to your situation or not, but... On an app I'm currently writing I'm using UUID primary keys for some of the models. When creating a new instance of one of those models, say through the admin interface, the development server will start up an instance of a process

Re: Port in use Error

2009-03-17 Thread TP
gordyt Thanks this does help, I managed to overcome this problem yesterday, but was still slightly confused as to why I had the error in the first place, this helps me understand! Thanks --~--~-~--~~~---~--~~ You received this message because you are subscribed to

Re: Many to Many is empty when saving parent object

2009-03-17 Thread Brandon Taylor
Ah, gotcha, so my signal is attached to the wrong sender. I was thinking I would have access to the categories during the Entry's save operation due to the m2m relationship on the field, but obviously not. I'll move the signal and see what happens. Thank you, Brandon On Mar 16, 6:53 pm, Malcolm

Re: multiple python versions

2009-03-17 Thread TheIvIaxx
I tried do the whole 64 bit thing but ran into several headaches with compiling the modules for AMD64 on vista. I've never done it before and i kept having to download this and that sdk just to find it not working. So i just left everything 32 bit and got to work on the django app. I'll try lau

Re: Problem with formsets and uploading of files

2009-03-17 Thread motard
This is an error of mine that happened when transcribing my code to the mail. I DO call is_validate() The issue here seems to be something I miss regarding the use of file uploads together with formsets... Regards, Stefan On Mar 17, 5:06 pm, Alex Gaynor wrote: > On Tue, Mar 17, 2009 at 11:09

How can i access UserProfile from User in the views?

2009-03-17 Thread Paolo Corti
Hi I know is easy to access to the UserProfile, like here: from django.contrib.auth.models import User u = User.objects.get(pk=1) # Get the first user in the system user_address = u.get_profile().home_address but is there a way to access to UserProfile in the view? supposing the UserProfile mode

Numbering of items in template

2009-03-17 Thread Jesse
Hello, I've finally gotten pagination to work. Now I would like to add a sequential number to the beginning of each record in the output. In previous languages I used something like count=count+1 and then placed count at the beginning of each record output in the template. How is a record coun

Re: static files protect access

2009-03-17 Thread alain31
Got it, thanks. For Apache, I found a clear tutorial : http://codeutopia.net/blog/2009/03/06/sending-files-better-apache-mod_xsendfile-and-php/ Alain. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users"

Re: Numbering of items in template

2009-03-17 Thread Alex Koshelev
You can use `forloop.counter` with `sum` filter. Or use `ol` html tag with proper `start` attribute. On Tue, Mar 17, 2009 at 7:47 PM, Jesse wrote: > > Hello, > > I've finally gotten pagination to work.  Now I would like to add a > sequential number to the beginning of each record in the output.

Re: TemplateDoesNotExist

2009-03-17 Thread TP
Still stuck on this. The tutorial says: Put the following code in that template: {% if latest_poll_list %} {% for poll in latest_poll_list %} {{ poll.question }} {% endfor %} {% else %} No polls are available. {% endif %} by the template does it meant the index.h

Re: Problem with formsets and uploading of files

2009-03-17 Thread motard
I found the error in this post: http://groups.google.com/group/django-users/browse_thread/thread/adf591a15786ca98 Feel a bit embarrassed... Wasn't setting the enctype attribute in my form html tag... Regards, Stefan On 17 mar, 17:06, Alex Gaynor wrote: > On Tue, Mar 17, 2009 at 11:09 AM, Stef

Re: FIXED: Can't run django on Apache

2009-03-17 Thread Bro
The result is : SetHandler python-program PythonHandler django.core.handlers.modpython SetEnv DJANGO_SETTINGS_MODULE mysite.settings PythonOption django.root /home/rex/django/mturk PythonDebug On PythonPath "['/home/rex/django/'] + sys.path"

Re: How can i access UserProfile from User in the views?

2009-03-17 Thread Andy Mckay
On 17-Mar-09, at 9:46 AM, Paolo Corti wrote: > from django.contrib.auth.models import User > u = User.objects.get(pk=1) # Get the first user in the system > user_address = u.get_profile().home_address > > but is there a way to access to UserProfile in the view? Do you mean in the template? The

Re: How can i access UserProfile from User in the views?

2009-03-17 Thread Paolo Corti
Hello Andy > > Do you mean in the template? yes, sorry... > > I don't use Django templating but have you tried: > > user.get_profile.home_address > if i use this in the template i get this error: Caught an exception while rendering: Cannot resolve keyword 'user' into field thanks anyway

Django book mostly done?

2009-03-17 Thread waltbrad
I happened to visit the Django Book site 2.0 It still says that it's not complete, but it seems to cover everything the 1.0 did except for deployment and the Appendices. Could a person get a pretty good grounding in django now by reading 2.0? I guess what I mean is that for the past few months

Re: Numbering of items in template

2009-03-17 Thread Jesse
I'm please to know of such a tag. Do you know of a good example of how it is used with the sum filter? Otherwise, I will try. Thanks! On Mar 17, 9:51 am, Alex Koshelev wrote: > You can use `forloop.counter` with `sum` filter. Or use `ol` html tag > with proper `start` attribute. > > On Tue, M

Re: Numbering of items in template

2009-03-17 Thread Jacob Kaplan-Moss
On Tue, Mar 17, 2009 at 12:46 PM, Jesse wrote: > I'm please to know of such a tag.  Do you know of a good example of > how it is used with the sum filter?  Otherwise, I will try. I don't know why you'd need the sum filter; the for tag does everything you'd want. See http://docs.djangoproject.com

Re: Numbering of items in template

2009-03-17 Thread Alex Gaynor
On Tue, Mar 17, 2009 at 1:48 PM, Jacob Kaplan-Moss < jacob.kaplanm...@gmail.com> wrote: > > On Tue, Mar 17, 2009 at 12:46 PM, Jesse wrote: > > I'm please to know of such a tag. Do you know of a good example of > > how it is used with the sum filter? Otherwise, I will try. > > I don't know why y

Re: Django book mostly done?

2009-03-17 Thread Alex Gaynor
On Tue, Mar 17, 2009 at 1:47 PM, waltbrad wrote: > > I happened to visit the Django Book site 2.0 It still says that it's > not complete, but it seems to cover everything the 1.0 did except for > deployment and the Appendices. Could a person get a pretty good > grounding in django now by readi

Re: FIXED: Can't run django on Apache

2009-03-17 Thread Bro
Hi I've installed Django 1.02 on my dedibox. I'm trying to make .py file readable and executable. Apache, Python, Django are installed. We have many website : /var/www/mysite1 /var/www/mysite2 /var/www/mysite3 we have : /var/django/mysite1 /var/django/mysite2 We configure in /etc/apache2/site-a

Re: How can i access UserProfile from User in the views?

2009-03-17 Thread Andy Mckay
On 17-Mar-09, at 10:36 AM, Paolo Corti wrote: > if i use this in the template i get this error: Caught an exception > while rendering: Cannot resolve keyword 'user' into field So it has no variable user, that has nothing to do with the rest of your problem. If you use request context the

Re: Django critter helps us code at the speed of light.

2009-03-17 Thread Eric Walstad
On Mar 16, 11:00 am, Klowner wrote: > Quick and dirty 3D version done in blender > :)http://img.skitch.com/20090316-82bsdnfjm15xarx3t9c1e4a7q9.png Oooh, very cool! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Dj

Re: Django critter helps us code at the speed of light.

2009-03-17 Thread Eric Walstad
On Mar 16, 5:29 pm, Scott Lyons wrote: > Based on mrts' drawings, I made two backgrounds. I'm open to > suggestions or requests. > > http://www.flickr.com/photos/damagedgenius/3361587194/ > > and > > http://www.flickr.com/photos/damagedgenius/3361587300/in/photostream/ Excellent! A version withou

Re: Django critter helps us code at the speed of light.

2009-03-17 Thread Eric Walstad
On Mar 15, 8:56 am, mrts wrote: > I takes a brave man to identify himself with the grrly Pony, so thumbs > up to everybody who have that much bravado in themselves :) > > I don't, therefore I'm all for the critter and my (styled) take is > here:http://mrts-foo.appspot.com/ > > (Created with Inksc

Re: Conditional row coloring in django-admin changelist --SOLVED

2009-03-17 Thread bsisco
ok...i figured it out. i added the following to the change_llist_results.html template and it worked like a charm: {% for result in results %} $(document).ready(function(){ var column = 12 $('img[alt="1"]').parent().filter('td:nth-child('+ (column) +')').parent().css("background",

Select multiple db items and print

2009-03-17 Thread bsisco
i know that this is probably a RTFM situation but i've been through it and can't seem to find what i'm looking for. i would like to be able to have a table very similar to the change_list in the admin. within that table i would like to be able to select multiple records via checkboxes then print

Re: Django bug that should be addressed: Idle timeouts do not clear session information

2009-03-17 Thread Paulo Köch
Taking the lead from http://www.artfulcode.net/articles/threading-django/ I would sugest you use a Timer object (http://www.python.org/doc/2.5.2/lib/timer-objects.html). DISCLAIMER: Careful! I haven't tested this! A Timer object uses a thread internally. Be careful with synchronization and relate

Re: Lookup across relations

2009-03-17 Thread 3xM
On Mar 16, 5:29 pm, Matías Costa wrote: > BTW,  this is Django 1.0, I had to rename your maxlength field parameter to > max_length. Are you using 0.96? Yes I am... 0.96 is what comes with Ubuntu 8.04 LTS. I'll upgrade to Ubuntu 8.10 (with django 1.0) as soon as possible and get back to tell if

Re: Django bug that should be addressed: Idle timeouts do not clear session information

2009-03-17 Thread Huuuze
Paulo, thank you for the link, but I don't see how that will help. To help articulate the problem, here is a post I included on StackOverflow.com: >> I would like to audit when a user has experienced an idle timeout in my >> Django application. In other words, if the user's session cookie's >>

nested dereferencing of values within value calls in templates

2009-03-17 Thread Jay Deiman
Ok, I'm wondering if there is any way to do this. Let me give a couple of ***simplified*** examples to clarify what I'm talking about here. I make "simplified" previously apparent because what I'm actually trying to do is much more complicated than these examples. View code:

objects.filter (calling a method) ?

2009-03-17 Thread arbi
Hi, I would like to do something like that, but I don't know if I can (I didn't find it on djangoproject.com) : Here is myClass : myClass: def __init__(self) : ... def similiarity_to(other_object) : return an integer And somewhere in my view I want to do : MyClass.o

RelatedObject Cache

2009-03-17 Thread Andrew Fong
Hello all, Quick question. Given these models ... class A(models.Model): pass class B(models.Model): model_a = models.ForeignKey(A) ... getting the model_a attribute on an instance of B will result in that related object being cached. So the question: given an instance of B, how do I know wh

Re: objects.filter (calling a method) ?

2009-03-17 Thread Alex Gaynor
On Tue, Mar 17, 2009 at 5:06 PM, arbi wrote: > > Hi, > > I would like to do something like that, but I don't know if I can (I > didn't find it on djangoproject.com) : > > Here is myClass : > > myClass: > def __init__(self) : > ... > > def similiarity_to(other_object) : > re

Models and select

2009-03-17 Thread Juan Hernandez
Hi there: I have this model for example class Categories(models.Model): name = models.CharField(max_length=30) which holds this data on the DB ++--+ | id | name | ++--+ | 1 | Musica | | 2 | Programacion | | 3 | Libros | | 4 | Politica

  1   2   >