Re: 'HttpResponse' object has no attribute 'rindex' error on 0.96

2008-04-18 Thread Malcolm Tredinnick
On Fri, 2008-04-18 at 23:15 -0700, Ryan Vanasse wrote: [...] > My urls.py looks like this (I'm just getting started on this project.) > > from django.conf.urls.defaults import * > from theremnant.eventcalendar.views import upcomingEvents > > urlpatterns = patterns('', > # Example: > # (

Re: ProgrammingError with PostgreSQL: operator does not exist: integer ~~* unknown

2008-04-18 Thread Merrick
I understand what you are saying the problem is. In my case here is what sets this off: class Meta: unique_together = ('city', 'title',) where city is a foreign key and now I see the mixed types. On Apr 18, 8:58 pm, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > On Fri, 2008-04-18

'HttpResponse' object has no attribute 'rindex' error on 0.96

2008-04-18 Thread Ryan Vanasse
Thank you in advance for helping a beginning django user. I'm getting an unexpected exception that is pointing me towards the urlresolvers.py file. It confuses me. I read a couple of other posts with a similar error (specifically "HttpResponse' object has no attribute 'rindex'") but the solution

Re: OS X install help --I think I broke something...

2008-04-18 Thread codercotton
fizbans symlink trick from svn trunk works fine though. I looked briefly at setup.py and don't know why it's not copying those dirs over... On Apr 12, 8:32 am, fizban <[EMAIL PROTECTED]> wrote: > On 12 Apr, 18:10, superavit <[EMAIL PROTECTED]> wrote: > > > I have the same issues with my Leopard

Re: OS X install help --I think I broke something...

2008-04-18 Thread codercotton
I have the same issue as above doing a default django install on Leopard 10.5.2, Python 2.5.1. The django/admin/templates directory is simply not installed. Cotton On Apr 12, 8:32 am, fizban <[EMAIL PROTECTED]> wrote: > On 12 Apr, 18:10, superavit <[EMAIL PROTECTED]> wrote: > > > I have the sam

Re: Is there a better way to strip CharFields?

2008-04-18 Thread Rishabh Manocha
You could just write a clean_mycharfield() (assuming mycharfield is your field name) and just return self.cleaned_data['mycharfield'].strip(). Check http://www.djangoproject.com/documentation/newforms/#custom-form-and-field-validation for more details. On Sat, Apr 19, 2008 at 2:37 AM, Peter Row

Re: Form Processing

2008-04-18 Thread [EMAIL PROTECTED]
Hi vamsi - try reading the Django book (available at http://www.amazon.com/Definitive-Guide-Django-Development-Right/dp/1590597257 or djangobook.com), see if you still have questions. Good luck On Apr 18, 1:44 am, Jeff Anderson <[EMAIL PROTECTED]> wrote: > gvkreddy wrote: > > HI, > > > This is va

Re: Model structure advice for "shared" relation between class

2008-04-18 Thread Malcolm Tredinnick
On Fri, 2008-04-18 at 19:27 -0700, Benoit Caron wrote: > Hello, > > I'm working on my first "not-only-a-toy-for-learning" Django project. > > I'm building an app where my model have two objects that I want to > have a "notes" related object: a "Host" and a "Network" object, where > both could h

Re: MultiValueField Question

2008-04-18 Thread James Snyder
OK, so I've somewhat answered my own question here and gotten things figured out. I do, however, have another question. What would be the proper/clean way to do inline editing with newforms? In the end I did some extremely hackish things to get the multiwidget/ multivaluefields to render with e

Re: Does the ORM support eager fetches?

2008-04-18 Thread Malcolm Tredinnick
On Fri, 2008-04-18 at 17:57 -0700, meppum wrote: > I read that to mean that it follows foreign key relationships "up" > from the child to the parent. Meaning that if you load > Parent.select_related() that parent.child_set() will not yet have been > loaded. Or did I read it wrong? See a post fro

Re: ProgrammingError with PostgreSQL: operator does not exist: integer ~~* unknown

2008-04-18 Thread Malcolm Tredinnick
On Fri, 2008-04-18 at 17:26 -0700, Merrick wrote: > I get the same problem as described here: > > #6523 > http://code.djangoproject.com/ticket/6523 > > There is a diff file which says it fixes the problem, how should I > proceed? If implement the diff, anyone care to tell me how please. We had

Re: Sending emails with special characters

2008-04-18 Thread Malcolm Tredinnick
On Fri, 2008-04-18 at 16:18 -0700, Julien wrote: > Hi, > > We have a newsletter app which sends a bulk of a thousand emails every > fortnight to our subscribers. Subscribers can choose to receive the > newsletter in HTML of plain text format. The name of each subscriber > is added at the top of

Re: Can I make it so that I get an error if a template accesses something that does not exist?

2008-04-18 Thread [EMAIL PROTECTED]
I don't know if TEMPLATE_STRING_IF_INVALID can be set to raise an error, but you could write a simple filter that raises an error if the variable is empty or just returns it as is if not. On Apr 18, 2:48 pm, yml <[EMAIL PROTECTED]> wrote: > hello, > > Here it is what you are looking for : > """ >

Re: urls stumping me

2008-04-18 Thread jeffself
No, I don't think thats it. Like I said, if I reverse the elections and precincts url in the urls.py file (the main one), it happens exactly opposite. Whichever one is listed first in the urls.py file works, while the other one doesn't. On Apr 18, 9:05 pm, blis102 <[EMAIL PROTECTED]> wrote: > P

Re: Can I print out the context from within a template?

2008-04-18 Thread Malcolm Tredinnick
On Fri, 2008-04-18 at 11:49 -0700, Salim Fadhley wrote: > yml, > > If I want to disable this behavior, is it possible? When a template > tries to reference an invalid object (e.g. a context variable which > has not been defined) I'd like to throw an exception. I do not want to > invent a value.

Re: users and profiles - model structure question

2008-04-18 Thread Malcolm Tredinnick
On Fri, 2008-04-18 at 11:02 +0100, andy baxter wrote: [...] > Has anyone dealt with this problem in practice, and do people have any > thoughts about what is the best way of doing things here, from the point > of view of keeping the code simple, and also minimising the time spent > doing datab

Re: APPEND_SLASH trouble (ticket 6167)

2008-04-18 Thread Malcolm Tredinnick
On Fri, 2008-04-18 at 10:49 -0700, Giovanni Giorgi wrote: > Hi I have the bug related to the > Ticket #6167 (new) > Flat pages do not honour APPEND_SLASH > http://code.djangoproject.com/ticket/6167 > > This bug was fixed, as far as I can understand from the track database Not correct. If the

Re: Does the ORM support eager fetches?

2008-04-18 Thread [EMAIL PROTECTED]
No, you are correct, it does not follow reverse foreign keys, at least not yet, there was a discussion about this a few days ago, if this is of importance to you, you could either held write the code for django to support following reverse foreign keys in select_related() or you could write the SQ

Image upload path different between Windows & Mac

2008-04-18 Thread Brandon Taylor
Hi everyone, I've noticed that when uploading images when running an app from Windows, file paths are stored using backslashes: images\my_image.jpg when running on Mac, they are forward slashes: images/my_image.jpg I've seen where there is a hook into the save method on a model. I'm assuming

Re: How to Patch

2008-04-18 Thread [EMAIL PROTECTED]
Thank you very, very much On Apr 18, 5:28 pm, "Chris Czub" <[EMAIL PROTECTED]> wrote: > Follow the instructions on the Django website > athttp://www.djangoproject.com/download/and run `svn > cohttp://code.djangoproject.com/svn/django/trunk/` > > After that, you should be able to `svn up` to get

Model structure advice for "shared" relation between class

2008-04-18 Thread Benoit Caron
Hello, I'm working on my first "not-only-a-toy-for-learning" Django project. I'm building an app where my model have two objects that I want to have a "notes" related object: a "Host" and a "Network" object, where both could have a "Notes" object tied to it (so I could add notes about this Host

Re: urls stumping me

2008-04-18 Thread blis102
Possibly what you have set for get_absolute_url in your models.py file? On Apr 18, 1:14 pm, jeffself <[EMAIL PROTECTED]> wrote: > My project contains two apps, elections and precincts. My main > urls.py file looks like this: > > from django.conf.urls.defaults import * > > urlpatterns = patterns(

ProgrammingError with PostgreSQL: operator does not exist: integer ~~* unknown

2008-04-18 Thread Merrick
I get the same problem as described here: #6523 http://code.djangoproject.com/ticket/6523 There is a diff file which says it fixes the problem, how should I proceed? If implement the diff, anyone care to tell me how please. --~--~-~--~~~---~--~~ You received this

Re: London Django User Group

2008-04-18 Thread Dan Ellis
I would be interested, but I'm in Cambridge so it's unlikely I'd attend every month. --~--~-~--~~~---~--~~ 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

Re: Best practices sending out http requests from within django code

2008-04-18 Thread Peter Rowell
> I've been using urllib2 very effectively - do be careful with it though I second this (both halves). Very easy to use. The only gotcha I encountered was making sure I correctly handled various failure modes for the connection. This was the backend credit card handshake for a membership site an

Re: ModelForm, Foreign key and blank value in choices

2008-04-18 Thread Phil Davis
On 17/04/2008, eXt <[EMAIL PROTECTED]> wrote: [...] > 'object_category' is represented by django.newforms.ModelChoiceField > and is rendered as a 'Select'. The field has 'required = True'. The > problem is that the 'Select' always contains a blank value: ' value="">-'. > > ModelForm d

Re: Does the ORM support eager fetches?

2008-04-18 Thread Peter Rowell
Take a look at select_related(), it may be of some help, depending on how you define "parent" and "child". http://www.djangoproject.com/documentation/db-api/#select-related "Returns a QuerySet that will automatically “follow” foreign-key relationships, selecting that additional related-object dat

Re: Sending emails with special characters

2008-04-18 Thread Louis Orenstein
It sounds like you will need to encode those characters in something like UTF-8 or some other character set. I'm not sure how you would go about doing that, but maybe the smtp object you create has a field or option specifying the character set with which to encode the email? Louis Julien wr

Sending emails with special characters

2008-04-18 Thread Julien
Hi, We have a newsletter app which sends a bulk of a thousand emails every fortnight to our subscribers. Subscribers can choose to receive the newsletter in HTML of plain text format. The name of each subscriber is added at the top of the message (e.g. "Dear Mr. Smith, blabla"). One of our subsc

Re: Missing a column out

2008-04-18 Thread Tim Chase
> I have a table full of articles. I want to select the article names (and > some > other related info) but not the actual text of the article, because I'm just > outputting a list on my web page. Is there a way to supress a single field > from the result model objects? Sounds like you're l

Re: Memory Usage on a VPS

2008-04-18 Thread Tim Sawyer
On Apr 18, 7:58 am, Tim Sawyer <[EMAIL PROTECTED]> wrote: > Hi Folks, > > I'm having trouble with Apache/Django memory usage on a Virtual Private > Server. I only have 150Mb memory. -snip- Thanks for your input folks, looks like I have some configuring to do! Ta, Tim. --~--~-~--~---

Missing a column out

2008-04-18 Thread Tim Sawyer
Hi, I have a table full of articles. I want to select the article names (and some other related info) but not the actual text of the article, because I'm just outputting a list on my web page. Is there a way to supress a single field from the result model objects? ta, Tim. --~--~-

Re: How to Patch

2008-04-18 Thread Chris Czub
Follow the instructions on the Django website at http://www.djangoproject.com/download/ and run `svn co http://code.djangoproject.com/svn/django/trunk/` After that, you should be able to `svn up` to get the latest version. On Fri, Apr 18, 2008 at 5:09 PM, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wro

A dynamic MultipleChoiceField with m2m and each option be one of those objects

2008-04-18 Thread Raisins
I am trying to create a dymanic MultipleChoiceField with the CheckboxSelectMultiple widget. The thing I want different, is the all the list for the Choice field I want to be references to that object. c = Model1.objects.get(id=temp_id) i = [ ['-','-']] for x in c.m2mModel2.all(): i.append

How to Patch

2008-04-18 Thread [EMAIL PROTECTED]
Hey guys and gals I want to update my current version of Django .96.1 by adding patches instead of downloading the current dev version. So basically I was wondering how do you go about applying patches to this framework, I ask because I am very used to applying patches by launching an executable.

Is there a better way to strip CharFields?

2008-04-18 Thread Peter Rowell
I have an author who doesn't understand that a space is not nothing. He persists in *sometimes* putting a leading space at the beginning of a 'name' field. This name shows up in a ForeignKey drop down in the admin interface. As a result, we often end up with two records. He creates one named " Foo

Re: Need help DRYing up urls.py

2008-04-18 Thread Brandon Taylor
In this case, I think I'll be fine, as the templates that would match any of these patterns just contain public, static content, nothing dynamic. However, I will definitely keep the code snippet for future use! Thank you to all who have replied, I really appreciate your help and guidance as I get

Re: Need help DRYing up urls.py

2008-04-18 Thread Marty Alchin
Just a quick word of warning: You're now essentially passing unfiltered user input directly into the template loader. Depending on what content you have in your templates, this may imply a security risk. For instance, if you have a template that hard-codes any secure information, such as system ac

London Django User Group

2008-04-18 Thread siudesign
Hi all, For over a year now i've wanted to set up a London Django User Group to get more involvement in Django from the UK community. For now i'm just looking to see how many people would be interested in a monthly meeting where (as is typical in user groups) people interested in django would mee

Re: Best practices sending out http requests from within django code

2008-04-18 Thread Joseph Heck
I've been using urllib2 very effectively - do be careful with it though - assuming you're planning on using it in view code - the time it spends waiting for something is the time that your user spends waiting. -joe On Thu, Apr 17, 2008 at 4:31 PM, Russell Keith-Magee <[EMAIL PROTECTED]> wrote: >

urls stumping me

2008-04-18 Thread jeffself
My project contains two apps, elections and precincts. My main urls.py file looks like this: from django.conf.urls.defaults import * urlpatterns = patterns('', (r'^precincts/', include('precincts.urls')), (r'^elections/', include('elections.urls')), (r'^admin/', include('django.cont

Re: Need help DRYing up urls.py

2008-04-18 Thread Brandon Taylor
Gotcha. Very, very cool. Here's what I did. Please tell me if there's a better way: #in views.py def return_template(request, template): return direct_to_template(request, (template + '.html')) #in urls.py from django.conf.urls.defaults import * from rdk.pages.views import return_template u

Re: Need help DRYing up urls.py

2008-04-18 Thread [EMAIL PROTECTED]
That wouldn't be return template((template))), it should be just the view's name, not actually calling it, and your wrapper function needs to take request, and pass it along to dire3ct_to_template On Apr 18, 3:51 pm, Brandon Taylor <[EMAIL PROTECTED]> wrote: > Sorry, forgot to say that I have imp

Re: Need help DRYing up urls.py

2008-04-18 Thread Brandon Taylor
Sorry, forgot to say that I have imported the view into urls.py from rdk.pages.views import return_template On Apr 18, 2:39 pm, Brandon Taylor <[EMAIL PROTECTED]> wrote: > I understand the concept of that, but I'm having an issue with > importing the view function into my urls.py. Here's what I

Re: PostreSQL "psql" problem

2008-04-18 Thread Phil Davis
On 18/04/2008, Nikhil <[EMAIL PROTECTED]> wrote: [...] > $su - postgres > and running: > $/usr/local/pgsql/bin/initdb -D /usr/local/pgsql/data > $/usr/local/pgsql/bin/postgres -D /usr/local/pgsql/data > > I get the following: > LOG: database system was shut down at 2008-04-16 ... > LOG: dat

Re: Need help DRYing up urls.py

2008-04-18 Thread Brandon Taylor
I understand the concept of that, but I'm having an issue with importing the view function into my urls.py. Here's what I have so far: #in views.py from django.views.generic.simple import direct_to_template def return_template(template): return direct_to_template(template % '.html') #in url

Re: Can I print out the context from within a template?

2008-04-18 Thread Norman Harman
Salim Fadhley wrote: > yml, > > If I want to disable this behavior, is it possible? When a template > tries to reference an invalid object (e.g. a context variable which > has not been defined) I'd like to throw an exception. I do not want to > invent a value. In my test_settings.py file I put

Re: Need help DRYing up urls.py

2008-04-18 Thread [EMAIL PROTECTED]
Yes, instead of having it use a generic directly in the urlconf, you would have it go to the view, the view would do what you need(specifically doing that simple substitution), and then have it return django.views.generic.simple.direct_to_template, remember views are just functions, if you need an

Re: Need help DRYing up urls.py

2008-04-18 Thread Brandon Taylor
Hi Alex, Thanks for the advice. Still being new to Django, where would such a wrapper function need to exist? In the views.py? models.py? I'm guessing it would need to be something along the lines of: def replace_template_var(template): return template % '.html' ? Please advise, Brandon O

Re: users and profiles - model structure question

2008-04-18 Thread andy baxter
andy baxter wrote: > Alex Koshelev wrote: > >> I usually make link to User model not profile. And have no problems >> with usage. >> >> >> > I just tried switching to this way of doing it, and have come up against > a problem with getting the profile data into the template. If I create

Re: users and profiles - model structure question

2008-04-18 Thread andy baxter
Alex Koshelev wrote: > I usually make link to User model not profile. And have no problems > with usage. > > I just tried switching to this way of doing it, and have come up against a problem with getting the profile data into the template. If I create a list of all users in the view, then pa

Re: Dictionary access within a template

2008-04-18 Thread [EMAIL PROTECTED]
There is no current way to do this(there was a thread on django-dev a few weeks ago and there was no consensus on syntax), what I would do is create a very simple filter, if will be all of 3 lines long and will accomplish what you need. On Apr 18, 2:47 pm, Salim Fadhley <[EMAIL PROTECTED]> wrote:

Re: mod_python error

2008-04-18 Thread Aaron Fay
You could have also used: urlpatterns = patterns('', (r'^$', 'qsm.recs.views.matrix'), (r'^users/', include('qsm.recs.urls')), because (as you know now) the python path was looking up to your project directory, but not as far as your application directory... Aaron bcurtu wrote:

Re: Can I print out the context from within a template?

2008-04-18 Thread Salim Fadhley
yml, If I want to disable this behavior, is it possible? When a template tries to reference an invalid object (e.g. a context variable which has not been defined) I'd like to throw an exception. I do not want to invent a value. My application prints financial reports - it's important to make a d

Re: Can I make it so that I get an error if a template accesses something that does not exist?

2008-04-18 Thread yml
hello, Here it is what you are looking for : """ If you use a variable that doesn’t exist, the template system will insert the value of the TEMPLATE_STRING_IF_INVALID setting, which is set to '' (the empty string) by default """ It is extracted from the documentation. --yml On Apr 18, 6:23 pm,

Dictionary access within a template

2008-04-18 Thread Salim Fadhley
In my example "reportdatedate" is a datetime object. "result" is a dict of dicts. The lines that attempt to access the dict cause a template syntax error ( because I invented the syntax myself ) - is there an alternative that means the same thing? I note that Django templates give me an obvious

Re: Can I print out the context from within a template?

2008-04-18 Thread yml
Hello, Here it is an extract form the documentation : """ If you use a variable that doesn’t exist, the template system will insert the value of the TEMPLATE_STRING_IF_INVALID setting, which is set to '' (the empty string) by default """ It looks like it does what you want. --yml On Apr 18, 8:34

Re: Can I print out the context from within a template?

2008-04-18 Thread [EMAIL PROTECTED]
You could write a simple template tag that did this. On Apr 18, 12:26 pm, Salim Fadhley <[EMAIL PROTECTED]> wrote: > I'm trying to debug the context that is passed into the template. When > I render the template I use a command like: > > return HttpResponse( render_to_string('mtmreport/index.html

Re: Need help DRYing up urls.py

2008-04-18 Thread [EMAIL PROTECTED]
Direct_to_template does not substitute the template var in to the template param, you will need to write a simple wrapper to do something like this. On Apr 18, 12:35 pm, Brandon Taylor <[EMAIL PROTECTED]> wrote: > Ah. I see now. It's matching the first part of the URL, but it doesn't > seem to wa

Re: Looping....

2008-04-18 Thread [EMAIL PROTECTED]
Here's the code for the range tag I wrote: http://dpaste.com/45711/ I haven't tested it at all, but I think it should work, if anyone can provide feedback I'll post it on django snippets. On Apr 18, 2:00 pm, "Erik Vorhes" <[EMAIL PROTECTED]> wrote: > Or you can add something to your view to take

Re: mod_python error

2008-04-18 Thread Tim Sawyer
The way I've done this, the include needs the full path. Have you tried: (r'^users/', include('qsm.recs.urls')), ? Tim On Friday 18 Apr 2008, bcurtu wrote: > Not exactly. The directory tree is: > > ws-python/ > qsm/ > recs/ > others/ > > Where qsm is the project that contains t

Re: Looping....

2008-04-18 Thread Erik Vorhes
Or you can add something to your view to take care of this: def your_view(request): ... some_subset = Model.objects.all()[:10] ... Add it to 'extra_context' and you won't need to do anything trickier than this: {% for model in some_subset %} some stuff {% endfor %} On Fri, Ap

Re: Looping....

2008-04-18 Thread [EMAIL PROTECTED]
The way I would do it is to create a tag that creates a list object using range as a template var and then use a simple for loop, the usage would be: {% range 1 10 as my_range %} {% for i in my_range %} {{ i }}, {% endfor %} would return 1, 2, 3, 4, 5, 6, 7, 8, 9, I'm going to write this up and

Re: Django en Dreahost

2008-04-18 Thread Juanjo Conti
Brett Parker escribió: > On 18 Apr 08:24, Kenneth Gonsalves wrote: >> >> On 18-Apr-08, at 5:01 AM, Juanjo Conti wrote: >> 2. Download, Compile and install Python 2.5. DH default is 2.3 and 2.4. >>> Why this? Does not Django run with Python <= 2.3? >> afaik no > > I assume that you

APPEND_SLASH trouble (ticket 6167)

2008-04-18 Thread Giovanni Giorgi
Hi I have the bug related to the Ticket #6167 (new) Flat pages do not honour APPEND_SLASH http://code.djangoproject.com/ticket/6167 This bug was fixed, as far as I can understand from the track database I have updated to the last subversion revision (7435) on http://code.djangoproject.com/svn/

Re: mod_python error

2008-04-18 Thread bcurtu
I got it! It was my apache config, I have included the path to the root of the project: PythonPath "['/home/bcurtu/ws-python','/home/bcurtu/ws-python/qsm'] + sys.path" Now it works, thanks! On 18 abr, 19:17, "Michael Wieher" <[EMAIL PROTECTED]> wrote: > i guess the relative path is the questi

Re: mod_python error

2008-04-18 Thread bcurtu
Not exactly. The directory tree is: ws-python/ qsm/ recs/ others/ Where qsm is the project that contains the main urls.py, and recs and others are applications with own urls.py files. Thanks! On 18 abr, 19:17, "Michael Wieher" <[EMAIL PROTECTED]> wrote: > i guess the relative pat

Re: mod_python error

2008-04-18 Thread Michael Wieher
i guess the relative path is the question i assume ws-python is the directory your main urls file is in and the recs directly lives in it, with an __init__.py file ? On Fri, Apr 18, 2008 at 12:15 PM, bcurtu <[EMAIL PROTECTED]> wrote: > > Hi, > > I have set up my apache with mod_python. When I

mod_python error

2008-04-18 Thread bcurtu
Hi, I have set up my apache with mod_python. When I call my main page on /, it works fine. However, when I try to access to other applications (/users/23) I get this error: ImproperlyConfigured: Error while importing URLconf 'recs.urls': No module named recs.urls My main urls.py code is: urlpa

Re: Multiple threads writing on session object

2008-04-18 Thread bcurtu
Thanks Shane, Sure i will move to memcache, but i'm still on early developing stage. Anyway, it's a good idea the dict on session, i'll try it. On 18 abr, 18:31, "Shane Spencer" <[EMAIL PROTECTED]> wrote: > I don't know the answer to your code issue, maybe you should define a > global dict or li

Re: Looping....

2008-04-18 Thread Eric Abrahamsen
I think what people are saying here is that your number, the iteration limit, has to be coming from somewhere or something. Chances are, that something is an iterable, or can be made into an iterable very easily, and thus can be used in a for loop. Where is the number coming from? On Apr 18

Re: Decoupling the URLconfs Tutorial 3 Problem

2008-04-18 Thread garazy
Thanks Karen. On Apr 14, 11:33 pm, "Karen Tracey" <[EMAIL PROTECTED]> wrote: > On Mon, Apr 14, 2008 at 3:03 AM, garazy <[EMAIL PROTECTED]> wrote: > > > Hi, > > > I am going through the tutorial and have come to Decoupling the > > URLconfs @http://www.djangoproject.com/documentation/tutorial03/

Re: Need help DRYing up urls.py

2008-04-18 Thread Brandon Taylor
Ah. I see now. It's matching the first part of the URL, but it doesn't seem to want to substitute the named parameter as (template) as such: (r'(?P[-\w]+)/$', direct_to_template, {'template' : '% (template)s.html'}), Thanks, Brandon On Apr 18, 11:25 am, "Marty Alchin" <[EMAIL PROTECTED]> wrote

Re: Multiple threads writing on session object

2008-04-18 Thread Shane Spencer
I don't know the answer to your code issue, maybe you should define a global dict or list to handle the variables and change how you access them a bit? In another light, Is it a possibility for you to change your middleware product to take advantage of the cache middleware or be reworked a bit to

Can I print out the context from within a template?

2008-04-18 Thread Salim Fadhley
I'm trying to debug the context that is passed into the template. When I render the template I use a command like: return HttpResponse( render_to_string('mtmreport/index.html'), myContext ) Is it possible to write something in the template that simply prints out the myContext object? --~--~-

Re: Need help DRYing up urls.py

2008-04-18 Thread Marty Alchin
On Fri, Apr 18, 2008 at 12:17 PM, Brandon Taylor <[EMAIL PROTECTED]> wrote: > (r'?P[-\w]+/$', direct_to_template, {'template' : '% > (template)s.html'}), > > ...and received an error saying: > Error while importing URLconf 'rdk.pages.urls': nothing to repeat You're missing parentheses around

Re: users and profiles - model structure question

2008-04-18 Thread Alex Koshelev
I usually make link to User model not profile. And have no problems with usage. On Apr 18, 2:02 pm, andy baxter <[EMAIL PROTECTED]> wrote: > Hello, > > I have built a data model for a virtual library, which contains the > following classes (among others): > > User - the built in user class from d

Can I make it so that I get an error if a template accesses something that does not exist?

2008-04-18 Thread Salim Fadhley
I have some templates which attempt to access non-existent attributes of the context. For example supposing the template references {{ foo }} but foo does not exist - can I force djgango to throw an error? Thanks --~--~-~--~~~---~--~~ You received this message bec

Need help DRYing up urls.py

2008-04-18 Thread Brandon Taylor
Hi everyone, Coming from Rails, I've been naming my templates according to their corresponding URLs. But, since Django's routing is RegEx based, I'm sure there's a better way to do this: urlpatterns = patterns('', (r'^$', direct_to_template, {'template':'home.html'}), (r'^contact/$', dir

Multiple threads writing on session object

2008-04-18 Thread bcurtu
Hi, I'm running django with database (mysql) based session middleware. When the user logs in, there is a process that have to perform some heavy calculations. In order not to block the response, what i do is opening several threads: if not 'f1' in request.session: thread.start_new_thr

PostreSQL "psql" problem

2008-04-18 Thread Nikhil
I'm trying to set up a database for Django, and I'm having trouble connecting with the databases I create (PostgreSQL 8.3.1). After creating a $su - postgres and running: $/usr/local/pgsql/bin/initdb -D /usr/local/pgsql/data $/usr/local/pgsql/bin/postgres -D /usr/local/pgsql/data I get the follo

Re: Need help understanding generic detail view

2008-04-18 Thread Brandon Taylor
Hi Malcolm, Everything's working. I'm still getting used to setting up routes in Django, but overall I'm extremely impressed with this framework! Thanks for your help, Brandon On Apr 18, 10:18 am, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > On Fri, 2008-04-18 at 08:11 -0700, Brandon Taylor

MultiValueField Question

2008-04-18 Thread James Snyder
Hi - I've been attempting to put together a website to use for keeping track of information for a wedding, and I'm wanting to use multiple inline lists of invitees within each group that has been sent an invite. Basically I want something like the admin interface where one can do tabular inline

Re: Looping....

2008-04-18 Thread Kip Parker
I needed something like this to repeat a part of the template x times, but I couldn't get this to work, the filter repeatedly returned the range(0,10) so gave a recursion depth error. I may have set it up wrong. I ended up making a repeat tag: def do_repeat(parser, token): try:

Calling a template from a template

2008-04-18 Thread Salim Fadhley
I'm trying to write a view & template collection that will render arbitrary objects in a database. I cannot change these objects and make them more view-friendly, so I have written a class which identifies the object and selects which of a collection of templates is most likely to be able to rende

Re: 'for' statements with five words should end in 'reversed': for key, value in obj.items

2008-04-18 Thread Salim Fadhley
Great - I upgraded to dev - it works fine. On Apr 18, 12:02 pm, Dan Ellis <[EMAIL PROTECTED]> wrote: > You can't do "key, value" in Django 0.96. You need to do "for item in > obj.items" and then use item.0 and item.1, or use a development > version. --~--~-~--~~~---~--

Re: Need help understanding generic detail view

2008-04-18 Thread Malcolm Tredinnick
On Fri, 2008-04-18 at 08:11 -0700, Brandon Taylor wrote: [...] > urlpatterns = patterns('staff', This "prefix" has nothing to do with the prefix of the URL. It's something that is used when you specify the view function as a string (it's the prefix put at the start of the import path in that cas

Re: Calling a template from a template

2008-04-18 Thread Alex Koshelev
http://www.djangoproject.com/documentation/templates/#include On Apr 18, 1:29 pm, Salim Fadhley <[EMAIL PROTECTED]> wrote: > I'm trying to write a view & template collection that will render > arbitrary objects in a database. I cannot change these objects and > make them more view-friendly, so I

Need help understanding generic detail view

2008-04-18 Thread Brandon Taylor
Hello everyone, Here is my urls.py: from django.conf.urls.defaults import * from django.views.generic import list_detail from rdk.staff.models import * groups = { 'queryset' : Group.objects.all().select_related().order_by('name'), 'template_name' : 'staff.html', } employee

'for' statements with five words should end in 'reversed': for key, value in obj.items

2008-04-18 Thread Salim Fadhley
When rendering this template: {% block objcontent %} {% for key, value in obj.items %} {{ key }} {{ repr(value) }} {% endfor %} {% endblock objcontent %} I get this error: 'for' statements with five words should end in 'reversed': for key, value in obj.items Any idea what is going on here?

custom form on admin interface page

2008-04-18 Thread Andre Meyer
hi all so, here is my plan: i want to add a simple form on one of the admin pages. this should allow the admin to import data (read a file, parse and fill the database). the problem is now that it is unclear to me where to add this form. which admin template to use? how to figure out whether the

Re: Why does one work but not the other

2008-04-18 Thread phillc
Ahh that makes a ton of sense, that lead me to a solution each of my calls to self.question.options() returns a new instance of the model instance that i am referring to, and therefor i created two of them, assigned a value to one and saved the other. thanks a ton! =) On Apr 17, 11:19 pm, Mal

Re: mail in base64

2008-04-18 Thread leonel
Malcolm Tredinnick wrote: > On Fri, 2008-04-18 at 06:58 -0600, leonel wrote: > >> Malcolm Tredinnick wrote: >> >>> On Thu, 2008-04-17 at 11:52 -0600, leonel wrote: >>> >>> Hello I need to send mail and I'm using send_mail from django.core.mail All works but

Re: mail in base64

2008-04-18 Thread Malcolm Tredinnick
On Fri, 2008-04-18 at 06:58 -0600, leonel wrote: > Malcolm Tredinnick wrote: > > On Thu, 2008-04-17 at 11:52 -0600, leonel wrote: > > > >> Hello > >> > >> I need to send mail and I'm using send_mail from django.core.mail > >> All works but the mail gets base64 encoded > >> > >> Am I missing

Re: Feel free to test queryset-refactor branch

2008-04-18 Thread Chris Hoeppner
I wonder if anyone has tried coming up with some sort of wannabe-backend for the GAE Datastore? ~ Chris El dom, 13-04-2008 a las 21:23 +1000, Malcolm Tredinnick escribió: > We're getting pretty close to merging queryset-refactor into trunk and > would like to do this as soon as practical. There

Re: mail in base64

2008-04-18 Thread leonel
Malcolm Tredinnick wrote: > On Thu, 2008-04-17 at 11:52 -0600, leonel wrote: > >> Hello >> >> I need to send mail and I'm using send_mail from django.core.mail >> All works but the mail gets base64 encoded >> >> Am I missing some configuration so the send_mail sends the mail not encoded >>

Re: Memory Usage on a VPS

2008-04-18 Thread Graham Dumpleton
On Apr 18, 7:58 am, Tim Sawyer <[EMAIL PROTECTED]> wrote: > Hi Folks, > > I'm having trouble with Apache/Django memory usage on a Virtual Private > Server. I only have 150Mb memory. > > I've turned KeepAlive off. I think I'm using prefork (how do I tell?) and > it's set at the following: > > >

Re: Cannot register custom filters - Template thinks they are invalid

2008-04-18 Thread Malcolm Tredinnick
On Fri, 2008-04-18 at 05:18 -0700, Salim Fadhley wrote: > I want to define the simplest possible filter and then invoke it from > my simplest possible template, however I am beset by some problems: > > I'm defining filters thus - this code is at the top of the same .py > file as where I invoke t

Cannot register custom filters - Template thinks they are invalid

2008-04-18 Thread Salim Fadhley
I want to define the simplest possible filter and then invoke it from my simplest possible template, however I am beset by some problems: I'm defining filters thus - this code is at the top of the same .py file as where I invoke the register_to_string method. @register.filter @stringfilter def t

Re: 'for' statements with five words should end in 'reversed': for key, value in obj.items

2008-04-18 Thread Dan Ellis
You can't do "key, value" in Django 0.96. You need to do "for item in obj.items" and then use item.0 and item.1, or use a development version. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To

  1   2   >