How to check which view got called by a request

2007-12-29 Thread shabda
Using the testing framework how can we make sure that the correct view got called. Documentation at http://www.djangoproject.com/documentation/testing/#testcase says that (django.test.client can be used to) "Test that the correct view is executed for a given URL.", but I can't figure out how.

Re: how to deal with inherited template context variables?

2007-12-29 Thread Sam Lai
Thanks, Panos. Just took a quick look - the settings context processor is useful, but still requires explicit addition into each view using that template. The generic_content tags fit my examples, and probably for most use- cases, but I don't know... I'm not comfortable in putting logic that

Re: Page not showing correct data

2007-12-29 Thread jeffhg58
Just wanted to let you know that fixed the problem. Thanks so much. Jeff -- Original message -- From: "Karen Tracey" <[EMAIL PROTECTED]> On Dec 25, 2007 9:18 PM, <[EMAIL PROTECTED]> wrote: After reloading the page the browser does not show the new data. Here is the

Re: non-root URL django installation

2007-12-29 Thread hedronist
> Is it possible to get the "/subDir/djangoApp" prefix removed from the > URL before the rest of django handles the URLs !? Yes, at least I think you can. (Note: I haven't actually tested this, and it feels a bit kludgey, but it's where I would start.) In

Re: get_foo_display doesn't work with integers?

2007-12-29 Thread Florian Apolloner
I found the issue (or non issue, whatever you like ;)) get_test_char_display() calls the field's choices with a string (of course it is a CharField), which results in the following call (stripped down talen from django/db/models/base.py: dict(choices).get(value,value) Now accesing it with a

non-root URL django installation

2007-12-29 Thread sebhaase
Hi, I have developped a small django app and I like it a lot. I have tested it on a local setup using "manage.py runserver" on a custom port. Now I wanted to move this to our apache2 based web site and got my sys admin convinced to install mod_python and I got a httpd.conf like this: .

Re: get_foo_display doesn't work with integers?

2007-12-29 Thread Florian Apolloner
> Error is in the way you use it. Please write full model and usage > example. As you wish :) blubb/models.py: from django.db import models # Create your models here. MY_CHOICES = ( (1, '11'), (2, '12') ) class TestModel(models.Model): test_blubb =

Re: Django (SVN-Version) doesn't execute raw sql-queries

2007-12-29 Thread James Bennett
On Dec 29, 2007 7:18 AM, beewee <[EMAIL PROTECTED]> wrote: > it works now when calling the connection._commit() function (which is > completely undocumentated) after executing the query. (I know that you > shouldn't call functions starting with _ in general) Were you doing anything to disable

Re: get_foo_display doesn't work with integers?

2007-12-29 Thread Alex Koshelev
Error is in the way you use it. Please write full model and usage example. On 29 дек, 23:54, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > apollo13 pointed this out on the IRC channel: > If your choices use an integers, get_foo_display returns the integer > and not the "human readable"

get_foo_display doesn't work with integers?

2007-12-29 Thread [EMAIL PROTECTED]
apollo13 pointed this out on the IRC channel: If your choices use an integers, get_foo_display returns the integer and not the "human readable" option. For example, reworking this from the docs: YEAR_IN_SCHOOL_CHOICES = ( (1, 'Freshman'), (2, 'Sophomore'), (3, 'Junior'), (4,

Re: 'WSGIRequest' object has no attribute 'user'

2007-12-29 Thread hedronist
> After that I restart the server and get AttributeError at /admin/ > 'WSGIRequest' object has no attribute 'user', with traceback > athttp://dpaste.com/29308/. Don't see the admin login screen. Huh. This smells vaguely like a problem we ran into when we were changing the way login

Re: how to deal with inherited template context variables?

2007-12-29 Thread Panos Laganakos
Check out Django Template Utils[1], it will probably fit your needs. [1] http://code.google.com/p/django-template-utils/ On Dec 29, 5:42 pm, Sam Lai <[EMAIL PROTECTED]> wrote: > Thanks Alex and hedronist. I'm leaning towards creating a generic > template tag that loads template context

Re: 'WSGIRequest' object has no attribute 'user'

2007-12-29 Thread Alex Koshelev
Is there 'django.contrib.auth.middleware.AuthenticationMiddleware' in your MIDDLEWARE_CLASSES ? On 29 дек, 18:10, Chris Haynes <[EMAIL PROTECTED]> wrote: > Thanks a lot, syncdb now works with the admin stuff, and > I entered the superuser account stuff when requested. > > After that I restart

Re: how to deal with inherited template context variables?

2007-12-29 Thread Sam Lai
Thanks Alex and hedronist. I'm leaning towards creating a generic template tag that loads template context processors to do this (I don't have the complicated needs you had hedronist... as far as I know). I was just wondering if there was a 'best-practice' way of doing this; looks like creating

Re: newforms tricks

2007-12-29 Thread Todd O'Bryan
On Dec 29, 2007 4:39 AM, David Larlet <[EMAIL PROTECTED]> wrote: > > Thanks for those useful tricks. Here are some typo corrections, hope > it helps: > > > [4]: http://code.djangoproject.com/wiki/CookBookNewFormsDynamicFields > > [4]:

'WSGIRequest' object has no attribute 'user'

2007-12-29 Thread Chris Haynes
Thanks a lot, syncdb now works with the admin stuff, and I entered the superuser account stuff when requested. After that I restart the server and get AttributeError at /admin/ 'WSGIRequest' object has no attribute 'user', with traceback at http://dpaste.com/29308/. Don't see the admin login

using queryset and extra_context

2007-12-29 Thread Florian Lindner
Hello, I have this urls.py: info_dict = { "queryset": Entry.objects.all().order_by("- creationDate"), } urlpatterns = patterns("", (r'^(?P\d+)/$', 'django.views.generic.list_detail.object_detail', { info_dict, 'extra_context':{'CommentForm':CommentForm} } ) My problem is that I want

Re: editing an image with ModelForm

2007-12-29 Thread akaihola
Wouldn't it make sense to use the same mechanism as in the Admin interface of the newforms-admin branch? It seems to show the current file path as static text and somehow ignore an empty file field if the object already has a file. --~--~-~--~~~---~--~~ You

Re: Django (SVN-Version) doesn't execute raw sql-queries

2007-12-29 Thread beewee
Hi! it works now when calling the connection._commit() function (which is completely undocumentated) after executing the query. (I know that you shouldn't call functions starting with _ in general) --~--~-~--~~~---~--~~ You received this message because you are

Problem with media_root, OLDPHOTO template

2007-12-29 Thread eat
Hi i downloaded and installed app from source code via - > http://www.djangosites.org/s/www-lzpian-com/ it should be like-> http://www.lzpian.com/ in english version -> use : http://babelfish.altavista.com/babelfish/tr i changed database settings i synchronised database and the app works ,

Re: what would be the best model for a friend network ?

2007-12-29 Thread Russell Keith-Magee
On Dec 29, 2007 3:56 PM, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > In case of such a user profile, would the recursive m2m relation be > defined on the UserProfile model ? Yes. Unless you are planning to use a customized version of contrib.auth, you don't have any control over the User

Re: How to create an "iffirst" tag?

2007-12-29 Thread Malcolm Tredinnick
Hey Ned, On Sat, 2007-12-29 at 08:27 +1100, Malcolm Tredinnick wrote: [...] > def render(self, context): >if context[self.varname] == id(context['forloop']): > return self.nodelist_false.render(context) >context[self.varname] = id(context['forloop'])

Re: newforms tricks

2007-12-29 Thread David Larlet
Le 29 déc. 07 à 05:25, Todd O'Bryan a écrit : > > After wrestling with newforms to get it to do things I thought it was > never intended to do, I decided that either it was really intended to > do such things or it's just such a clean design that getting it to do > weird things isn't that hard.

Make Django admin edit return to custom page?

2007-12-29 Thread Ulf Kronman
Hi all, I'm using Django to build a repository of scientific publications at my university. Now we need to edit publication records that have been supplied by our departments and imported into the database. I would like to be able to use the excellent Django admin interface for this editing,

TypeError: Cannot resolve keyword '' into field. Choices are: ...

2007-12-29 Thread sector119
Request Method: GET Request URL:http://127.0.0.1:8000/people/person/ Exception Type: TypeError Exception Value:Cannot resolve keyword '' into field. Choices are: organizationdatabase, meterreadings, transaction, id, pid, location, street, building, corpus, block,