updating members of modelformset with unique fields

2015-05-25 Thread anentropic
http://stackoverflow.com/questions/30425468/django-updating-members-of-modelformset-with-unique-fields The situation - I have a model and inline formset like: class ProductImage(models.Model): product = models.ForeignKey('Product') display_order = models.PositiveSmallIntegerField(default=

Re: Reverse Lookup Failure on password change/reset views

2013-08-19 Thread anentropic
ntrib.auth.views.password_reset_done'.format(ns)) (admittedly this assumes you have imported all of the auth urls into the same namespace) On Monday, 19 August 2013 12:27:57 UTC+1, anentropic wrote: > > This seems a bug in Django... the `reverse` function is passed the name of

Re: Reverse Lookup Failure on password change/reset views

2013-08-19 Thread anentropic
This seems a bug in Django... the `reverse` function is passed the name of a view function, not a named url, so the fact that the url it's being asked to match is included under a namespace shouldn't matter? (here because I just hit the same problem myself) On Saturday, 27 July 2013 08:20:18 UT

Re: UnicodeDecodeError (ordinal not in range) when deleting an inline item - 1.2.1

2010-07-05 Thread anentropic
Awesome, I had exactly the same problem and by chance we're on Rackspace too. I added the two lines to that file exactly as shown in the Django docs, restarted httpd, and now Sorl can handle thumbnails with unicode chars in them. cheers On Jun 27, 4:44 pm, Federico Capoano wrote: > Thanks for y

signals and "weak reference"

2010-04-17 Thread anentropic
in the docs there is this paragraph: "Note also that Django stores signal handlers as weak references by default, so if your handler is a local function, it may be garbage collected. To prevent this, pass weak=False when you call the signal’s connect()." Can someone please explain to me what it m

Re: weird import errors in my middleware

2010-04-16 Thread anentropic
Well, it seems pretty clear from a few further tests that you can't import models at all from within a middleware. Would be nice if that limitation was documented On Apr 16, 9:12 pm, anentropic wrote: > if it helps, my exclusive_boolean_fields function looks like:

Re: weird import errors in my middleware

2010-04-16 Thread anentropic
if it helps, my exclusive_boolean_fields function looks like: def exclusive_boolean_fields(model, eb_fields=[], with_fields=[]): setattr(model, '_exclusive_boolean_fields', eb_fields) setattr(model, '_exclusive_boolean_with_fields', with_fields) post_save.connect(exclusive_boolean_hand

weird import errors in my middleware

2010-04-16 Thread anentropic
Hi, I tried to write my first middleware today and seem to have failed horribly. Basically I have made a view decorator almost identical to the csrf ones, that sets a flag on the view function. My middleware then checks this flag and if missing it runs another function (which deletes some session

Re: formset media

2010-02-22 Thread anentropic
{{ formset.media }} will output the script tags *and* the css link tags On Feb 22, 11:53 am, anentropic wrote: > A formset should have a 'media' attribute which should include all the > media from the widgets in the forms which make up the formset, so in > the template yo

Re: formset media

2010-02-22 Thread anentropic
A formset should have a 'media' attribute which should include all the media from the widgets in the forms which make up the formset, so in the template you should be able to just {{ name_of_formset_var.media }} in the head of your page to output the necessary script tags. On Feb 17, 3:13 pm, kker

Re: What exactly does order_with_respect_to do?

2009-11-30 Thread anentropic
I've been wondering this too, the docs aren't clear. On Nov 30, 12:50 am, Continuation wrote: > In the doc (http://docs.djangoproject.com/en/dev/ref/models/options/ > #order-with-respect-to) it is mentioned that  order_with_respect_to > marks an object as "orderable" with respect to a given field

many-to-many relation field__in - how to AND instead of OR?

2009-11-25 Thread anentropic
I have a query like: Product.objects.filter(categories__in=cat_ids).distinct() where categories is a m2m field. As I understand it this loads products which have belong to ANY of the categories in cat_ids How would I load only products which belong to ALL of the categories in cat_ids? (is this

Re: CommaSeparatedIntegerField - no suitable widget?

2009-11-18 Thread anentropic
18, 12:06 pm, anentropic wrote: > I am trying to use a CommaSeparatedIntegerField in one of my > models...  there doesn't seem to be a suitable widget for editing this > field though? > > Seems like one of the 'select multiple' widgets would be an obvious > choice.

CommaSeparatedIntegerField - no suitable widget?

2009-11-18 Thread anentropic
I am trying to use a CommaSeparatedIntegerField in one of my models... there doesn't seem to be a suitable widget for editing this field though? Seems like one of the 'select multiple' widgets would be an obvious choice. SelectMultiple seems the default widget for it in admin, but it renders an e

Re: syndication feed framework - how to reverse the urls?

2009-10-06 Thread anentropic
ok, thanks! On Oct 5, 12:09 pm, Russell Keith-Magee wrote: > On Mon, Oct 5, 2009 at 6:31 PM, anentropic wrote: > > > So I just have to hard-code the feed urls in my templates? > > In short, yes. > > The feeds framework predates the introduction of named URLs in Djang

Re: syndication feed framework - how to reverse the urls?

2009-10-05 Thread anentropic
So I just have to hard-code the feed urls in my templates? On Sep 30, 3:23 pm, anentropic wrote: > Anyone?  Is it possible to reverse those urls? > > The feeds framework implementation seems like a dirty hack to urls.py > (but otherwise works great!) > > On Sep 29, 4:57 pm,

Re: syndication feed framework - how to reverse the urls?

2009-09-30 Thread anentropic
Anyone? Is it possible to reverse those urls? The feeds framework implementation seems like a dirty hack to urls.py (but otherwise works great!) On Sep 29, 4:57 pm, anentropic wrote: > I've been setting up feeds using the syndication feed framework. > > I have a line like this

syndication feed framework - how to reverse the urls?

2009-09-29 Thread anentropic
I've been setting up feeds using the syndication feed framework. I have a line like this in my urls.py: (r'^feeds/(?P.*)/$', 'django.contrib.syndication.views.feed', {'feed_dict': feeds}), How do I avoid hard-coding the feed urls into my template? I want to {% url django.contrib.syndicati

extending comments views

2009-09-22 Thread anentropic
Hi, I am trying to extend the comments app so that I can use an alternate view for post_comment in some situations (i.e. posting via ajax...) This question is probably largely down to relative python ignorance on my part, but 1) I have made a new app in my project and set COMMENTS_APP in se

Re: custom tag - render() isn't called

2009-09-11 Thread anentropic
Any feedback on this? I have the same problem... I have some of my own custom tags working but the ones that come with django-tagging it seems like render does not get called I've tried moving things around, putting them in the same file as my tags that do work etc. __init__ of the custom tag i