Re: Unicode and localized characters in view

2010-03-03 Thread Daniel Roseman
On Mar 4, 6:45 am, Joakim Hove wrote: > About every once a year I am forced out on the internet to read about > "encodings and such"; while reading about it all makes sense, but when > actually trying to get things to work I always go through a period of > swearing and

Re: django vs tornado

2010-03-03 Thread Kenneth Gonsalves
On Thursday 04 Mar 2010 12:55:37 pm Continuation wrote: > > I have stopped using it and till I can get something else up am using > > nginx proxied to runserver - which is faster than tornado and handles the > > latest django svn ok. > > -- > > You are running the Django development server in

Re: django vs tornado

2010-03-03 Thread Continuation
> I have stopped using it and till I can get something else up am using nginx > proxied to runserver - which is faster than tornado and handles the latest > django svn ok. > -- You are running the Django development server in production? Why? Why not apache/mod_wsgi? -- You received this

Unicode and localized characters in view

2010-03-03 Thread Joakim Hove
About every once a year I am forced out on the internet to read about "encodings and such"; while reading about it all makes sense, but when actually trying to get things to work I always go through a period of swearing and frustration - I never really get it :-( Now, in a Django view I have a

Form Dummy Widget

2010-03-03 Thread Nasp
Hey all! I have a poll app which display Poll model in the admin with Choice model inlined. What I'm trying to do is to display vote percentage for those InlinedForm. I've been creating a dummy class which extends form.Widget and I'm trying to figure out how i can pass the Choice id or instance

Re: django vs tornado

2010-03-03 Thread Kenneth Gonsalves
On Thursday 04 Mar 2010 3:54:48 am Graham Dumpleton wrote: > On Mar 4, 9:08 am, gvkalra wrote: > > hi i have a presentation to make on django, wherein I have > > decided to include a section on Tornado I wish to show > > performance comparisons between django and

Re: best practices for creating a template/theming layer for users in a django app

2010-03-03 Thread Nick
It seems like this would be best handled at the view level, you could pass a url variable in the render_to_response portion, maybe something like def theme(request): # a bunch of view display stuff theme = ThemeModel.objects.get('template__name') if theme: render_to_response('%s'

Re: best practices for creating a template/theming layer for users in a django app

2010-03-03 Thread Nick
Ideally what you'd want to do is handle all of this On Mar 3, 6:12 pm, gdup wrote: > O crap! that sounds about right. I was thinking of media_url in terms > of only static files, didnt think of {{ templatename }} variable. > > As for the templating part in an app like shopify

ListField() wanted or how to use iterable fields in forms

2010-03-03 Thread coco
Hello, Is it possible to get some kind of ListField() for some django.forms.Form fields ? Here is a typical example problem involving this. Let's try to make the following kind of form (forms.py): class mytable(forms.Form): tags = forms.CharField() x = forms.FloatField() y =

Re: Passing message to 404

2010-03-03 Thread Wiiboy
Thanks for your reply. One question though: How would I pass the message itself from view to view (the view raising the error to my 404 view)? -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to

Re: Passing message to 404

2010-03-03 Thread Eugene Wee
Hi, On Thu, Mar 4, 2010 at 11:20 AM, Wiiboy wrote: > Is there a way to pass a message when I create a 404 error > programmatically (i.e. from a view)?  In my case, I'm using > get_object_or_404, and I'd like to say something like, "That user does > not exist" (this is for

Passing message to 404

2010-03-03 Thread Wiiboy
Hi, Is there a way to pass a message when I create a 404 error programmatically (i.e. from a view)? In my case, I'm using get_object_or_404, and I'd like to say something like, "That user does not exist" (this is for looking at user profiles). -- You received this message because you are

Multiple views files

2010-03-03 Thread Wiiboy
Hi guys, I'm thinking about making multiple views files. I'm just wondering whether: a. There's any problems with that b. many people do it. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to

Re: Templates sometimes load at bottom of page

2010-03-03 Thread Shawn Milochik
Dude, I have one word for you, and you've heard it already tonight: virtualenv I do everything on my Mac, and virtualenv and git make it a lot easier than I deserve. Let me know if you need help. Shawn On Mar 3, 2010, at 9:28 PM, timdude wrote: > I know I should do it. But I'm such a noob,

Re: Templates sometimes load at bottom of page

2010-03-03 Thread timdude
I know I should do it. But I'm such a noob, the idea scares the crap out of me. I've got half a dozen sites hanging off the same code base...which is all .96 dependant. I'll get the time and the guts up one of these days. Cheers, Tim On Mar 3, 5:47 pm, Atamert Ölçgen wrote: >

Re: "ImportError: No module named django" with MacPorts

2010-03-03 Thread Steven R. Elliott Jr
Hello Tim, I'm a fellow Mac user but I don't quite understand the problem that you are having installing Django on OS X 10.6. I installed Django today on a new Mac and it took all of 5 minutes and I downloaded the tarball, extracted it and threw it in my home directory. I believe that 10.6

Re: "ImportError: No module named django" with MacPorts

2010-03-03 Thread CLIFFORD ILKAY
On 03/03/2010 07:27 PM, Tim Jones wrote: So I tried specifying the site-packages path at the top of my script and it removed the ImportError. That makes it seem like my web-server's pythong is running with different pythonpath settings than my command-line's python. I think I can probably

Re: How to make django to handle multiple requests at the same time

2010-03-03 Thread Robert Mela
Daniel Roseman wrote: This isn't a question about Django, but about WSGI deployment. Although I must say I'm confused, you say you're using WSGI but you're printing something, so it seems like you're using the development server since that prints to the console? Is this right? If so, you can't

Re: "ImportError: No module named django" with MacPorts

2010-03-03 Thread Tim Jones
Sorry, I should clarify. When I wrote: > So I tried specifying the site-packages path at the top of my script... I meant that I added these lines: ~~ import sys sys.path.insert(0, "/opt/local/lib/python2.5/site-packages") ~~ =T= -- You received this message because you are subscribed to the

Re: "ImportError: No module named django" with MacPorts

2010-03-03 Thread Tim Jones
Aha, that is helpful. I think I've partially solved this now. If I run 'import django' at the command line, then it seems to import fine; there is no error message, and 'print sys.modules' now lists it. So I tried specifying the site-packages path at the top of my script and it removed the

Use a queryset as values for model insert

2010-03-03 Thread geraldcor
Hello all, I have a form for submitting samples. After the user submits a sample, I would like to give them a button that says "Use last form to fill in this form" or whatever. Basically, the way I have thought to do this is: last_sample = SSF.objects.filter(ssfvalue=request.user.id).order_by('-

Re: "ImportError: No module named django" with MacPorts

2010-03-03 Thread Shawn Milochik
Printing sys.modules won't show django unless you've imported Django. What are you trying to do, anyway? You don't normally import Django in a Python script. You usually start a Django project by using django-admin.py and letting it create a manage.py which uses the proper Python. Search your

Re: best practices for creating a template/theming layer for users in a django app

2010-03-03 Thread gdup
O crap! that sounds about right. I was thinking of media_url in terms of only static files, didnt think of {{ templatename }} variable. As for the templating part in an app like shopify , i am not familar with rails, but i assume it allows you to create custom template tags like django. I doubt

Re: "ImportError: No module named django" with MacPorts

2010-03-03 Thread Tim Jones
Thanks for the reply. "which python" returns: /opt/local/bin/python "python -V" returns: Python 2.5.5 I know I've got the OSX default Pythons installed as well, but I've done my best to avoid running those. Like I said in my first email, printing sys.path in the python prompt returns a big

Re: "ImportError: No module named django" with MacPorts

2010-03-03 Thread Shawn Milochik
Please post the results of these commands: which python python -V You can have different versions of Python installed (or even the same version) in multiple places on your Mac. The most likely situation is that when you're trying to actually run things you're using different version of

Re: "ImportError: No module named django" with MacPorts

2010-03-03 Thread Tones
I attempted installation via tarball instead of MacPorts. This had no effect on things. Same files in the same places, same error. =T= On Mar 3, 11:15 am, Tones wrote: > Hi -- > > I'm attempting to run Django on OSX 10.6. I've installed Python2.5 and > Py25-Django (Django

Django and WordPress together?

2010-03-03 Thread John Griessen
Does anyone run Django and WordPress together? I like the P2 theme of WordPress, so I'm wanting to use it with links to documents in a P2 blog, but I want it all searchable from Django apps. Anyone do that where Django is the main admin interface to a site's pages and WordPress is just for a

Restricting Access to Uploaded Files

2010-03-03 Thread Merrick
I wanted to give users who are authenticated the ability to upload files, that's the easy part that I can handle. What I cannot figure out is how to restrict the viewing/downloading of files. Links, tips, code are appreciated. Thanks -- You received this message because you are subscribed to

Re: best practices for creating a template/theming layer for users in a django app

2010-03-03 Thread Nick
If I'm understanding what you're asking, it should be as simple as adding an entry per user that designates the template/theme you'd like to use and then passing that as a variable (ex. {{ MEDIA_URL }} {{ templatename }} where template name would be the directory name of the template. Let me know

Re: Serializing objects with a many-to-many reference

2010-03-03 Thread Russell Keith-Magee
On Thu, Mar 4, 2010 at 1:36 AM, Jim N wrote: > I just came across manager methods in the docs: > > http://docs.djangoproject.com/en/dev/topics/db/managers/#adding-extra-manager-methods > > Could I have used these to create a seriallizable QuerySet, by > defining, say, a

best practices for creating a template/theming layer for users in a django app

2010-03-03 Thread gdup
Hello all, I would really aprreciate it if someone could point me in the right direction of creating a themeing and template layer for an application written in django, similar to what tumblar and shopify do. I can almost put my finger on the whole concept. I know u can somehow serve the

Please criticise this storage architecture...

2010-03-03 Thread Andy Robinson
I'm planning a self-service publishing/reporting system. Django will likely be the web framework. I am considering a rather unusual storage architecture, and would love to know where the pitfalls are. Users will be companies in a small vertical space. They want to let their clients

Re: HTML & Django (Google App Engine)

2010-03-03 Thread Jervis
On Mar 3, 3:51 pm, slenno1 wrote: > Hey everyone, >      I am currently working with a section of a site that takes user > input using Django forms: > >   description = forms.CharField(widget=forms.Textarea(attrs={'rows': > '10', 'cols': '80'})) > > The only problem however

Re: django static files css headache

2010-03-03 Thread mendes.rich...@gmail.com
Hello Justin, It's a bit hard to see what's wrong based on this info. The thing you should check is if you could access the css by navigating to it in the url bar. You could check if the following would work. @import {{media_url}}style.css; another thing that is different from the

ModelForms TextInput size= parameter

2010-03-03 Thread PaulM
In the documentation: "Creating forms from models" the "Field types" list states that the model field CharField converts to the form CharField with max_length set to the model field's max_length. However this max_length does not show up on the form's TextInput in the size attribute. If I say that

Re: django vs tornado

2010-03-03 Thread Graham Dumpleton
On Mar 4, 9:08 am, gvkalra wrote: > hi i have a presentation to make on django, wherein I have > decided to include a section on Tornado I wish to show > performance comparisons between django and tornado . how do I set > up the scenario ?? . what I intend

building a form with multiple filters

2010-03-03 Thread Nick
I am trying to build a search form with multiple filters/input objects. Basically, i want to be able to allow for a simple searhc based on one criteria or multiple. So if someone searches the name field(q) they can filter by political party, or city, etc. Also, I would like to be able to return

django vs tornado

2010-03-03 Thread gvkalra
hi i have a presentation to make on django, wherein I have decided to include a section on Tornado I wish to show performance comparisons between django and tornado . how do I set up the scenario ?? . what I intend to achieve is this graph:

Re: Send variable from view function to a templatetag

2010-03-03 Thread pjrhar...@gmail.com
On Mar 3, 4:52 pm, alecs wrote: > How can I send variable from my view function(which renders my > template) to a template tag library(which is {% load blah %} in this > template? I want to make my tag cloud independent from model: Your template tag has access to any

upgrade to released version 1.1.1 problems

2010-03-03 Thread mendes.rich...@gmail.com
Hello Django Users, I just tried to upgrade my django version towards the last official release Django 1.1.1 and ran into some trouble after the install. When i do a runserver first it complained about an AttributeError: 'Settings' that didn't have certain attributes. To solve this is added the

Django GeoRSS syndication feed

2010-03-03 Thread Wayne Dyck
Has anyone created an example of how to incorporate a GeoRSS feed they would be willing to share? I have seen this link, http://code.djangoproject.com/ticket/6547 and understand that "feed_extra_kwargs" and "item_extra_kwargs" were added to allow this but I am drawing a blank on exactly how to

cursor.execute '... field IN %s' problem

2010-03-03 Thread chumphries
I'm trying to pass a list of values as the args to a 'IN' statment in cursor.execute. When I pass integers, everything works fine, but when I pass strings, I get nothing: # should return same results # env is Py 2.6 / Django 1.1.1 / MySQL 5. # works ids = [1, 2, 3] id_sql = "select * from

"ImportError: No module named django" with MacPorts

2010-03-03 Thread Tones
Hi -- I'm attempting to run Django on OSX 10.6. I've installed Python2.5 and Py25-Django (Django v1.1) via MacPorts. But I am receiving the famed "ImportError: No module named django" error. Django is installed in this directory: /opt/local/lib/python2.5/site-packages/django/ To check my

Re: Struggling with Apache deployment

2010-03-03 Thread Karen Tracey
The traceback in the Apache log includes: # You need to create a 500.html template. You really need to do that. Django is trying to handle a server error but running into another exception along the way, because you have no 500.html template. When you fix that problem, and assuming you have

Struggling with Apache deployment

2010-03-03 Thread WBDenne
Dear All I have just deployed my django app (Django version 1.1) on Apache 2.2 using mod-wsgi. The App is running OK but i am having problems with the admin interface. The links into the admin interface work ok and my models show up correctly BUT I am unable to edit or modify or access the model

Cassandra back end for Django

2010-03-03 Thread Oshadha
Hia fellas, I'm kind of new to Django framework.as far as I know Django only supports four major database engines.I have a requirement to use Cassandra(http://incubator.apache.org(/cassandra/) as the database backend,but I couldn't find any good resources on the net that give a helping hand.So I

Re: Serializing objects with a many-to-many reference

2010-03-03 Thread Jim N
I just came across manager methods in the docs: http://docs.djangoproject.com/en/dev/topics/db/managers/#adding-extra-manager-methods Could I have used these to create a seriallizable QuerySet, by defining, say, a with_user() method inside the Questions model? -Jim On Mar 3, 10:21 am, Jim N

Re: how to check size of a dict or list in template

2010-03-03 Thread raj
To find whether a list/dict, say dd, is empty or not {% if dd %} is enough. It'll return False when there is no dd defined or if it's value can be False. Empty lists/dicts are evaluated to be False. Check built-in filters like length, length_is etc also. Rajeesh. -- You received this

Re: SQL Server 2008

2010-03-03 Thread David
Steven, I am involved in just such a project. We are Linux shop, but a lot of the data for one of our applications is stored in SQL Server 2008. In general, there are a couple OSS projects to support connecting Django with SQL Server 2008. 1. django-mssql is probably the best bet but

Send variable from view function to a templatetag

2010-03-03 Thread alecs
How can I send variable from my view function(which renders my template) to a template tag library(which is {% load blah %} in this template? I want to make my tag cloud independent from model: register = Library() @register.inclusion_tag("tags/cloud.html") def tag_cloud(request): """Takes

Re: verbose field names in admin

2010-03-03 Thread Adam Yee
Ok, take a look at this link... http://docs.djangoproject.com/en/dev/topics/db/models/#verbose-field-names If that isn't what you're looking for, then you can change it at the form level... http://docs.djangoproject.com/en/1.1/ref/forms/fields/#label Again, the more detail you give will help

Re: how to check size of a dict or list in template

2010-03-03 Thread Jirka Vejrazka
> In the template I want to show something like > > {%if not  len(objects_tatus ) %} # just to clarify the purpose..I know > But how can I check the size of the dictionary? If it was a Queryset I > could have used qset.count  ..but here it would not work. > Can somebody help? Hi there,

Re: what has to be changed after project.db deletion and new empty project.db file creation manually

2010-03-03 Thread Matt McCants
For sqlite3, you don't even need to create an empty db. Just put the desired filename in your settings.py for the database name and run python manage.py syncdb and the database will be created along with all the tables based on the models for all the installed apps. You don't actually need to

Re: Django custom types / DjangoUnicodeDecodeError:

2010-03-03 Thread Brandon
Thanks for the pointers, Karen. That change prevents the exception with Debug enabled, and lets us at least see the general queries that were run, though the Id's are mangled, as you'd expect. This should at least get me over the hump for now. Thanks again! On Mar 2, 9:02 pm, Karen Tracey

Re: Serializing objects with a many-to-many reference

2010-03-03 Thread Jim N
Thanks Russell, I ended up writing it myself - breaking the QuerySet into a dictionary, grabbing and plugging in the information from the other model, and then re-serializing it not using the serializer.serialize, but the simplejson.dumps. I'll check out DjangoFullSerializers for future

SQL Server 2008

2010-03-03 Thread Steven R. Elliott Jr
Hello, I have been asked to write a front-end for an accounting system that will allow business participating in certain benefits plans the ability to receive and pay their bill online, reconcile bills, and add/delete members. The problem is that the database is an existing SQL Server 2008 system

Re: ViewDoesNotExist

2010-03-03 Thread Ayush Sharma
Thanks..sometimes v just don't see small things..thanks.. On Mar 2, 5:10 am, Karen Tracey wrote: > On Tue, Mar 2, 2010 at 3:32 AM, Ayush Sharma > wrote: > > > i am getting the following error on the url > >http://127.0.0.1:8000/addartist/ > > >

Problems with js and http server's django

2010-03-03 Thread Servais Nabil
Hello, I use an Openlayers and jquery js application on an apache serveur. When I try to make a request from openlayers to django and I've got this damn error : Development server is running at http://127.0.0.1:8000/ Quit the server with CONTROL-C. Traceback (most recent call last): File

Re: open()

2010-03-03 Thread andreas schmid
zubin71 wrote: > >From a method defined in a view i need to get the source of an html > file in the templates directory. This is how i tried it out. An error > occurs at the line, > > f = open(os.path.join(os.getcwd(), '../templates/test.html'), 'r') ; > the output of your os.path.join is

Re: open()

2010-03-03 Thread Gonzalo Delgado
El 03/03/10 10:45, zubin71 escribió: > >From a method defined in a view i need to get the source of an html > file in the templates directory. This is how i tried it out. An error > occurs at the line, > > f = open(os.path.join(os.getcwd(), '../templates/test.html'), 'r') ; > > However, this

open()

2010-03-03 Thread zubin71
>From a method defined in a view i need to get the source of an html file in the templates directory. This is how i tried it out. An error occurs at the line, f = open(os.path.join(os.getcwd(), '../templates/test.html'), 'r') ; However, this causes an error, "File or directory not found". What

editing a ModelForm with extra fields

2010-03-03 Thread Kenneth Gonsalves
hi, I have a modelform to which I have added a bunch of extra fields by overriding __init__(). Adding a new instance works fine, I use fm=Myform(request.POST) and fm.save() saves the Model, and then I can access request.POST directly for the information in the extra fields and save them to

Re: how to check size of a dict or list in template

2010-03-03 Thread Alessandro Pasotti
2010/3/3 harryos > > I would try with > > > > {%if not object_status.0 %} > > > > > hi > thanks.That was quite new to me..can you tell me how that works? > > I also tried > {% if not objects_status.items|length_is:"0" %} > > Oops sorry, I just realize now that your

Re: how to check size of a dict or list in template

2010-03-03 Thread Alessandro Pasotti
2010/3/3 jimgardener > what exactly does object_status.0 mean? I got an error when I tried > it in python shell > jim > > On Mar 3, 1:10 pm, Alessandro Pasotti wrote: > > 2010/3/3 harryos > > > > > {%if not object_status.0

Re: how to check size of a dict or list in template

2010-03-03 Thread jimgardener
what exactly does object_status.0 mean? I got an error when I tried it in python shell jim On Mar 3, 1:10 pm, Alessandro Pasotti wrote: > 2010/3/3 harryos > >  {%if not  object_status.0 %} > > -- You received this message because you are

Re: reverse in settings.py, is it possible?

2010-03-03 Thread rebus_
On 3 March 2010 12:33, Aljosa Mohorovic wrote: > i would like to set LOGIN_URL = reverse('custom_url_name') so i'm > wondering if something like that is possible? > i've tried with reverse but it fails. any ideas? > > Aljosa Mohorovic > > -- > You received this message

Re: How to create connection pooling in django

2010-03-03 Thread Jirka Vejrazka
>  I am using Django1.1.1(Apache via mod_wsgi deployment) with MSSQL DB. I > found that the new DB connection is getting created for every request . But > i want to use connection pooling. > Can anyone provide me the link to achive connection pooling. > Thanks and Regards, vijay, first, pelase

reverse in settings.py, is it possible?

2010-03-03 Thread Aljosa Mohorovic
i would like to set LOGIN_URL = reverse('custom_url_name') so i'm wondering if something like that is possible? i've tried with reverse but it fails. any ideas? Aljosa Mohorovic -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this

Re: checking size of dict or list in template

2010-03-03 Thread Tom Evans
On Wed, Mar 3, 2010 at 7:52 AM, harryos wrote: > > hi > I am passing a dictionary to the template > say, > objects_status={obj1:True,   obj2:False,  obj3:True } > > In the template I want to show something like > > {%if not  len(objects.status ) %} # just to clarify the

TransactionMiddleware and 5xx responses

2010-03-03 Thread Dan Fairs
Hi there, Django's TransactionMiddleware only rolls back the transaction if an exception is raised in a view. If a view doesn't raise an exception, but returns (say) a 500 response directly, the transaction goes ahead and commits. I noticed this while using Piston, and there's a thread about

Re: how to check size of a dict or list in template

2010-03-03 Thread harryos
> I would try with > >  {%if not  object_status.0 %} > hi thanks.That was quite new to me..can you tell me how that works? I also tried {% if not objects_status.items|length_is:"0" %} thanks harry -- You received this message because you are subscribed to the Google Groups "Django users"

Re: how to check size of a dict or list in template

2010-03-03 Thread Alessandro Pasotti
2010/3/3 harryos > > hi > I am passing a dictionary to the template > say, > objects_status={obj1:True, obj2:False, obj3:True } > > In the template I want to show something like > > {%if not len(objects_tatus ) %} # just to clarify the purpose..I know > len will not