Re: RSS Aggregator

2010-05-13 Thread Michael Elsdörfer
I'm working on a Universal Feed Parser-based library to create aggregators. The idea is that the process of parsing a feed and syncing it's items with a database can be customized by various addins: http://github.com/miracle2k/feedplatform It mostly works already, though it lacks the polishing

Re: Stuck trying integrate jinja2 - need compatibility extensions

2009-12-09 Thread Michael Elsdörfer
Todd, I recommend that you have a look at Coffin: http://github.com/dcramer/coffin It comes with a {% url %} that should work out of the box. The snippets you linked are not tags, but functions, that is, you would do something like: {{ url('my_view') }} You need the pass the functions in

Re: ModelForms

2008-06-17 Thread Michael Elsdörfer
> form.category.queryset = > Category.objects.filter(blog__exact=request.user.author_set.all() > [0].blog) print form.category.queryset I am somewhat surprised that this would work at all. The field objects should be accessible via FormClass.base_fields['fieldname'] or form_instance.fields['fi

Re: Django and Services

2008-05-01 Thread Michael Elsdörfer
> So I guess I'm just curious to hear how other members of the > community have solved this. Are people slipping business logic into > the model classes for the most part? If what I need to write doesn't really fit in any of the common "places" (models, managers, views, middleware etc.), then I

Re: At what point does a model get its own app? Wigging as I try to adjust to the Django way.

2008-04-23 Thread Michael Elsdörfer
On Apr 23, 10:29 pm, Jay <[EMAIL PROTECTED]> wrote: > In the django docs I see that you can easily make a foreign key by > referencing the model: > > manufacturer = models.ForeignKey('production.Manufacturer') > > ...but it feels like maybe stepping outside the "django way." You can also just i

Re: Creating password protected RSS feeds

2008-02-11 Thread Michael Elsdörfer
> How can I create passwords protected feeds with Django? I guess I > will have to go beyond the contrib.feeds framework, but if some one > has any recipes/links to how to do this, it would be most helpful! Use your own custom view to render the feed, and just wrap HTTP auth around it. There

Re: query.filter(some_foreignKey_field__exact=None)

2008-02-07 Thread Michael Elsdörfer
> subtasks = tasks.exclude(part_of__exact='None') > returns the correct subset, with the "top" tasks omitted. Why? 'None' is a string, so if anything, you'd have to use: part_of__exact=None However, what you're looking for is probably: subtasks = Task.objects.filter(part_of__isnull=True) Mic

Re: RSS escaping, {{ autoescape }} and |safe

2008-02-02 Thread Michael Elsdörfer
> I'm sure I'm not the only person who has come across > this problem I ran into this yesterday: http://code.djangoproject.com/ticket/6533 Might be related? Michael --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Grou

Re: User permissions

2008-01-31 Thread Michael Elsdörfer
> gallery application, and I have several uses who can post their > galleries to this application. Is there a way to create permission on > a per-user basis. There apparently was some work on a per-object permissions branch in the past, but it looks pretty dead: http://code.djangoproject.co

Re: Any way to know if a value has changed before saving?

2008-01-31 Thread Michael Elsdörfer
> I'd like to override the save() method and within it I'd like to test > if a value has changed, that is, if that value as stored in the > object (in memory) is different from what is actually stored in > database. Another approach is using __getattr__ to monitor changes. It saves you a qu

Re: Trying to dynamically generate labels in newforms

2008-01-30 Thread Michael Elsdörfer
> There's no other way to set it? Just set the labels *before* calling super(). Michael --~--~-~--~~~---~--~~ 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@googl

Re: How to know if an object is being created in the save() method?

2008-01-30 Thread Michael Elsdörfer
> def save(self): if self.pk: ...=> being created else: ...=> being > updated > > I vaguely remember seeing a parameter for the save method which would > do that, but I can't find it. Any thoughts? That's the correct way to do it, unless you want to use signals: http://www.martin-geber.com

Re: How to know if an object is being created in the save() method?

2008-01-30 Thread Michael Elsdörfer
>> There is 'post_save' signal with 'created' parameter. But, >> unfortunately, this feature is undocumented... > > It's something related with "dispatcher" class? Please let me know if > there is more about signals than the code below. I simply just use > this; If you use post_save instead

Re: How can I parse and process the contents of an URL?

2008-01-28 Thread Michael Elsdörfer
> but the page seems to load forever and I'm stuck! I'm pretty sure I ran into this before, and IIRC it's because Django's runserver, which I assume you are using, can only handle one request at a time - try a different test url. Michael MariusB schrieb: > I'm trying to take a link as an arg

Re: Modifing User.__unicode__

2008-01-08 Thread Michael Elsdörfer
I'd probably put it in my models file. Michael Thomas Guettler schrieb: > Hi, > > our customer wants to display the username as 'username: firstname > lastname' > > The easiest way would be to overwrite User.__unicode__. But where > should you put code like this? Up to now I put it in our mid

Re: Templates, filesystem, caching?

2007-12-18 Thread Michael Elsdörfer
James Bennett schrieb: > Manually call get_template() or select_template(), and stuff the > resulting Template object into a module-global variable somewhere. > Then just re-use it, calling render() with different contexts, each > time you need it. Is there anything speaking against building that

Re: Templates, filesystem, caching?

2007-12-17 Thread Michael Elsdörfer
Rob Hudson schrieb: > If I understand correctly, these cache the templates after they have > been rendered. What I'm curious about is if there is a way to cache > templates before they are rendered so you can provide different > contexts to them. It seems like there would still be some gains

Re: Is it possible to create a related model from within another save() method?

2007-12-16 Thread Michael Elsdörfer
Andrew schrieb: > That's a good thought, but unfortunately that's not the way multiple > inheritance works... only the first method in the chain gets called. > > On Dec 15, 6:54 am, Michael Elsdörfer <[EMAIL PROTECTED]> > wrote: >>> class Description(ChangeImple

Re: Is it possible to create a related model from within another save() method?

2007-12-15 Thread Michael Elsdörfer
> class Description(ChangeImplementor, models.Model): I might have a flaw in my logic, but if you were to switch the bases, inherit from models.Model first, and implemented a save() in ChangeImplementor, models.Model.save() should be called first, create the row, and by the time ChangeImpleme

Dynamically adding methods to Widget instance

2007-12-01 Thread Michael Elsdörfer
I just spent the last 5 hours debugging this, what a nightmare ;) I recently updated from around rev. ~5600 to the latest trunk. Before the update, I was doing this: # wrap render method MyFormClass.base_fields['fieldname'].widget.render = new.instancemethod() ... myform = MyFormClass() ..

Re: NodeList.render() and SafeString

2007-11-30 Thread Michael Elsdörfer
> It's an oversight; I hadn't thought of that case. You're right, marking > render() output as safe should be the right thing to do. If you'd care > to open a ticket so this doesn't get lost, I'll fix it tomorrow or > during the sprint on the weekend. Thanks Malcolm: http://code.djangoproject.co

NodeList.render() and SafeString

2007-11-29 Thread Michael Elsdörfer
I just updated to an auto-escaping enabled trunk, and I'm trying to adjust some template tags. One of them stores a nodelist and renders it at some point. Now, NodeList.render() returns escaped data, but does not mark it as safe (it's a unicode instance). Is this just an oversight, or as designed