Problems with MultipleModelChoiceField

2010-10-07 Thread janedenone
Hi, I try to create an admin form field using both a custom label and the FilteredSelectMultiple widget: from django.contrib.admin.widgets import FilteredSelectMultiple class UserMultipleModelChoiceField(forms.ModelMultipleChoiceField): def label_from_instance(self, obj): return "%s

Re: Proxy models and object instantiation

2010-05-19 Thread janedenone
, } self.__class__ = subclasses[self.page_type.name] Thanks, Jan On 18 Mai, 21:40, janedenone <janeden...@googlemail.com> wrote: > Hi, > > I'd like to use proxy models to define different properties for > different kinds of pages in my Django CMS. Which

Proxy models and object instantiation

2010-05-18 Thread janedenone
Hi, I'd like to use proxy models to define different properties for different kinds of pages in my Django CMS. Which proxy model/class an object belongs to is based on a certain field's value. Before querying the database, my view cannot know which proxy model to use for instantiation. What is

Pass variable to all templates

2010-05-10 Thread janedenone
Hi, my Django project has several apps, and each app contains a constant named APPLABEL. This constant should be passed to all templates, but I'd like to avoid adding it to each rendering context manually. Is that possible? Thanks, Jan -- You received this message because you are subscribed to

Re: LOCALE_PATHS in settings.py required?

2010-05-04 Thread janedenone
On 4 Mai, 17:25, Baurzhan Ismagulov <i...@radix50.net> wrote: > On Tue, May 04, 2010 at 08:10:18AM -0700, janedenone wrote: > > according to > > >http://docs.djangoproject.com/en/1.1/howto/i18n/ > > > Django automatically looks for localizations in $PROJECTPATH/lo

Password reset email not sent

2010-05-04 Thread janedenone
Hi, when using Django's password reset mechanism, the confirmation email is not sent (although some of my custom views do send email successfully using the SMTP configuration from settings.py). Also, I understand that the reset link in the email contains the user ID, but it is based on the email

LOCALE_PATHS in settings.py required?

2010-05-04 Thread janedenone
Hi, according to http://docs.djangoproject.com/en/1.1/howto/i18n/ Django automatically looks for localizations in $PROJECTPATH/locale/ /LC_MESSAGES/django.(po|mo). When I installed language files in this location, however, they were found only after I added LOCALE_PATHS to settings.py. Did I

Re: Reverse filtering via ManytoManyField

2010-01-11 Thread janedenone
Solved (in Django 1.1): tags = Tag.objects.annotate(num_pages=Count('page')).filter (num_pages__gt=0) On 9 Jan., 19:50, janedenone <janeden...@googlemail.com> wrote: > I defined two models (Tag and Page), where the Page model links to the > Tag model: > > tags = models.ManyToMa

Reverse filtering via ManytoManyField

2010-01-09 Thread janedenone
I defined two models (Tag and Page), where the Page model links to the Tag model: tags = models.ManyToManyField(Tag, blank=True) For a single tag, I can refer to the pages linked to that tag like so: for page in tag.page_set: ... results = tag.page_set.count() But I cannot find a way to

Syndication: ttl attribute not working with Rss201rev2Feed?

2009-10-03 Thread janedenone
Hi, when using the ttl attribute for an RSS 2.0 feed, Django will throw an AttributeError ('int' object has no attribute 'replace'). This does not happen with Atom feeds. Is this a known issue? It can be easily reproduced with the following code: feed = Rss201rev2Feed(feed_object.title,

Syndication: Source of

2009-10-03 Thread janedenone
Hi, I wonder how the field for a feed is populated. For each item, I specify the pubdate upon initialization, but I don't see where Django grabs the feed-wide information. Grateful for any hint - Jan --~--~-~--~~~---~--~~ You received this message because you

Re: regex query delivering incorrect results

2009-09-29 Thread janedenone
Hi Karen, On 28 Sep., 22:49, Karen Tracey <kmtra...@gmail.com> wrote: > On Mon, Sep 28, 2009 at 4:00 PM, janedenone <janeden...@googlemail.com>wrote: > > > Hi, > > > this > > > pages = Page.objects.exclude(content__iregex=r'^[\n\r \t]*<') > >

regex query delivering incorrect results

2009-09-28 Thread janedenone
Hi, this pages = Page.objects.exclude(content__iregex=r'^[\n\r \t]*<') should deliver the same rows as this SELECT ... FROM pages WHERE (content NOT REGEXP '^[\n\r \t]*<') but it does not: The Django query delivers 468 rows, whereas the SQL query delivers 223. It could be that the Django

Re: Object attributes in change_form.html

2009-07-14 Thread janedenone
.app_label, > 870             } > > On Jul 14, 5:37 am, janedenone <janeden...@googlemail.com> wrote: > > > > > On Jul 13, 10:05 pm, janedenone <janeden...@googlemail.com> wrote: > > > > On Jul 13, 6:07 pm, Daniel Roseman <dan...@roseman.

Re: Object attributes in change_form.html

2009-07-14 Thread janedenone
On Jul 13, 10:05 pm, janedenone <janeden...@googlemail.com> wrote: > On Jul 13, 6:07 pm, Daniel Roseman <dan...@roseman.org.uk> wrote: > > > > > > > On Jul 13, 4:02 pm, janedenone <janeden...@googlemail.com> wrote: > > > > Hi, > > > &

Re: Object attributes in change_form.html

2009-07-13 Thread janedenone
On Jul 13, 6:07 pm, Daniel Roseman <dan...@roseman.org.uk> wrote: > On Jul 13, 4:02 pm, janedenone <janeden...@googlemail.com> wrote: > > > > > > > Hi, > > > I read the documentation on customizing admin templates, but I still &

Object attributes in change_form.html

2009-07-13 Thread janedenone
Hi, I read the documentation on customizing admin templates, but I still wonder how to access the object attributes in the change_form.html. I am capable of getting the id using {{ object_id }}: {% if change %}{% if not is_popup %} {% trans "View Calculation" %} ... but I need to access

Re: Using alternating url patterns

2009-06-04 Thread janedenone
On 3 Jun., 12:26, Tom Evans <tevans...@googlemail.com> wrote: > On Wed, 2009-06-03 at 02:56 -0700, janedenone wrote: > > Hi, > > > is it possible to use alternating url patterns without confusing the > > reverse lookup mechanism? > > > I'd like to do so

Using alternating url patterns

2009-06-03 Thread janedenone
Hi, is it possible to use alternating url patterns without confusing the reverse lookup mechanism? I'd like to do something like (r'^(authors|autoren)/(?P[_a-z]+)$', 'author_detail'), Kind regards, Jan --~--~-~--~~~---~--~~ You received this message because you

Sort order ascending/descending

2009-05-25 Thread janedenone
Hi, I just wrote the following to switch between ascending and descending sort order in a table view: view: columns = [ {'ABC' : u'abc'}, {'DEF' : u'def'}, {'GHI' : u'ghi'}, {'JKL' : u'jkl'} ] for column in columns: for column_title in column: if column[column_title] ==

Re: Ordering ForeignKey lists in admin change view

2009-01-01 Thread janedenone
Thanks a lot! - Jan --~--~-~--~~~---~--~~ 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 group, send email to

Validate uniqueness in forms

2008-12-30 Thread janedenone
Hi, I was looking for a way to customize the error message when trying to submit an existing value for a unique field (using a ModelForm). According to this request (http://code.djangoproject.com/ticket/8913), I am not the first one to look for such a feature, and I'm happy to wait for it. My

Ordering ForeignKey lists in admin change view

2008-12-30 Thread janedenone
Hi, this must be really simple, but all the references to ordering fields did not explain how to do this: How can I change the order of entries in foreign key lists in the admin change view? Kind regards, Jan --~--~-~--~~~---~--~~ You received this message

Re: 500 displayed instead of 404

2008-10-31 Thread janedenone
On 29 Okt., 14:00, Thomas Guettler <[EMAIL PROTECTED]> wrote: > > Thanks to all who answered, now I'll go looking for the person who > > messed with the development machine. > > Everybody can make mistakes. The root of the problem is (or was) > that you don't see tracebacks if

Re: 500 displayed instead of 404

2008-10-29 Thread janedenone
Hi all, I found the solution. Someone (not me!) changed the django.views.defaults.page_not_found(). The first line of the method definition read def page_not_found(request, template_name='404_default.html'): instead of def page_not_found(request, template_name='404.html'): Thanks to all who

Re: 500 displayed instead of 404

2008-10-28 Thread janedenone
ECTED]> wrote: > On Tue, Oct 28, 2008 at 2:58 PM, janedenone <[EMAIL PROTECTED]>wrote: > > > > > Hi, > > > it must be some kind of unhandled exception, but I fail to see where > > it might occur. I now boiled down the app to a single URL pattern and > >

Re: 500 displayed instead of 404

2008-10-28 Thread janedenone
Hi, it must be some kind of unhandled exception, but I fail to see where it might occur. I now boiled down the app to a single URL pattern and a single view: # urls.py: urlpatterns = patterns('myproject.myapp.views', (r'^test/$', 'test'), ) # views.py: def test(request): raise

500 displayed instead of 404

2008-10-28 Thread janedenone
Hi, I use the following simple view def index(request, page_id, current_subpage=1): try: current_page = get_object_or_404(Page, pk=page_id) except: # if anything else goes wrong, display the 404 anway raise Http404 In debug mode,

Re: Filtering QuerySet (exclude)

2008-10-28 Thread janedenone
Hi, On 28 Okt., 10:56, Daniel Roseman <[EMAIL PROTECTED]> wrote: > On Oct 28, 9:33 am, janedenone <[EMAIL PROTECTED]> wrote: > > > > > Hi, > > > I need to exclude certain elements from a QuerySet. My models look > > like this (simplified): > > &

Filtering QuerySet (exclude)

2008-10-28 Thread janedenone
Hi, I need to exclude certain elements from a QuerySet. My models look like this (simplified): class Author(models.Model): first_name = models.CharField(max_length=90, blank=True) last_name = models.CharField(max_length=90, blank=True) class Page(models.Model): author =

Restrict values for ForeignKey field (admin site)

2008-09-29 Thread janedenone
Hi, I intend to create a simple inventory app. There are two major tables/ models: software and hardware. Software can be installed on certain types of hardware (i.e. PCs and servers), but not on others (displays etc). How can I restrict the ForeignKey field displayed within the edit form for

Re: Custom SQL or database API?

2008-09-03 Thread janedenone
On 2 Sep., 23:14, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > On Tue, 2008-09-02 at 13:12 -0700,janedenonewrote: > > Hi, > > > I am in the process of moving my handmade website to a Django-based > > version. One of my SQL queries returns all articles by a certain > > author if this article is

Custom SQL or database API?

2008-09-02 Thread janedenone
Hi, I am in the process of moving my handmade website to a Django-based version. One of my SQL queries returns all articles by a certain author if this article is not a chapter or section of an article by the same author: SELECT pages.id, pages.author_id, motherpages.author_id AS motherauthor

Re: Set invalid error on exception SMTPSenderRefused

2008-08-26 Thread janedenone
Thank you! This works fine, although I need to use form.errors instead of form._errors. The latter does not seem to work in the development version I tried. - Jan On 22 Aug., 16:47, "Karen Tracey" <[EMAIL PROTECTED]> wrote: > On Fri, Aug 22, 2008 at 7:13 AM, janedenone <[

Set invalid error on exception SMTPSenderRefused

2008-08-22 Thread janedenone
Hi, I validate my contact form through Django's form validation framework. The SMTPSenderRefused exception, however, is not caught in the validation process. Now I would like to try: send_mail(form.cleaned_data['subject'], form.cleaned_data['message'],

Re: Custom error_class for formatting single errors?

2008-08-22 Thread janedenone
Sorry: Solved the issue by modifying my CSS for ul.errorlist. On 22 Aug., 11:57, janedenone <[EMAIL PROTECTED]> wrote: > Edit: > > I found the ErrorDict class in django/forms/util.py, but specifying a > custom error_dict parameter to a new form (error_dict=SpanErrorDict) > r

Re: Slash appended for URLs ending in .html?

2008-08-22 Thread janedenone
On 22 Aug., 12:12, julianb <[EMAIL PROTECTED]> wrote: > > It's not a bug. If you want URLs that end in .html you have to turn > > APPEND_SLASH off. > > This can't be true. I have APPEND_SLASH set to default (=True) and it > works with URLs ending in .htm, so there has to be something wrong > with

Re: Custom error_class for formatting single errors?

2008-08-22 Thread janedenone
Edit: I found the ErrorDict class in django/forms/util.py, but specifying a custom error_dict parameter to a new form (error_dict=SpanErrorDict) results in a TypeError (_init__() got an unexpected keyword argument 'error_dict'). How can I force my errors to use my custom SpanErrorDict when

Custom error_class for formatting single errors?

2008-08-22 Thread janedenone
Hi, I'd like to use a custom error_class for formatting errors like this: form = ContactForm(data, auto_id=False, error_class=SpanErrorList) This works fine as long as the template contains {{ form.as_p }} but if I want to use a more flexible output {% for field in form %} {{

Re: Slash appended for URLs ending in .html?

2008-08-22 Thread janedenone
d. So foo.com/bar is redirected to foo.com/bar/, but foo.com/bar/file.txt is passed through unchanged." Thanks, Jan On Aug 22, 10:17 am, "Matthias Kestenholz" <[EMAIL PROTECTED]> wrote: > Hi, > > On Fri, Aug 22, 2008 at 10:14 AM, janedenone <[EMAIL PROTECTED]>

Slash appended for URLs ending in .html?

2008-08-22 Thread janedenone
Hi there, I installed the current development version of Django about two weeks ago. APPEND_SLASH is set to true, and it appends a slash to all URLs, even the ones ending in .html. Is that a known bug? Kind regards, Jan --~--~-~--~~~---~--~~ You received this