Problem building data structure for Archive page

2009-08-27 Thread gnijholt
Hello Django-users, Actually it's more of a basic Python problem than a Django problem. I'll try to be brief: In the view, I'm looping through my posts as such: --- def archive(request): years = Post.objects.dates('pub_date', 'year') for year in years: print year.year

Strange: named URL only works in root urlconf..

2009-06-05 Thread gnijholt
I've used named URLs for some time now, never had any trouble with them. But now I have added an app 'website' to a new Django project. (version 1.1 beta 1 SVN-10924) My root urlconf (as defined in settings.py) contains an include to website.urls: --- urlpatterns = patterns('',

Overlapping date range test

2009-03-09 Thread gnijholt
Hello django-users, I'm having some trouble with a date-range filter. My goal is to prevent a model from being saved when it's date-range overlaps with existing records. Apparently, the math is quite straightforward: ( start1 <= end2 and start2 <= end1 ) if TRUE, the ranges overlap (*)

Re: UnicodeDecodeError when uploading files with non-ascii characters in filename

2008-11-27 Thread gnijholt
Thanks for the quick reply. I almost gave up, but I just found something that seems to work for me. So I've tried: --- filename = codecs.BOM_UTF8.decode(postfile['filename']) --- ...which gave a LookupError. Then I tried casting to Unicode: --- filename = unicode(postfile['filename']) ---

UnicodeDecodeError when uploading files with non-ascii characters in filename

2008-11-26 Thread gnijholt
Hello, I'm running Django r7548 using PostgreSQL 8.3 on Leopard. The problem: When I upload a file with a filename like '.jpg', I get the following error: --- UnicodeDecodeError at /library/documents/12114/addFile/ 'ascii' codec can't decode byte 0xc3 in position 1: ordinal not in

Re: ImageField: upload_to

2008-09-18 Thread gnijholt
I had to define the callable function before it gets called. So in your case I'd put it right under class Product(models.model) Then you should be able to just do: upload_to=get_image_path Cheers, On Sep 18, 10:20 pm, lingrlongr <[EMAIL PROTECTED]> wrote: > According to the documentation, I

Extending Newforms Admin with functionality

2008-07-22 Thread gnijholt
Hello django-users, What is the preferred way of extending the Admin interface with functionality (not just a template override) (using the newforms admin)? I ask because I'm trying to build something simple. I have a model NewsletterSubscriber which has just a name, an active boolean, and an

Filtering by returned name?

2008-07-16 Thread gnijholt
Hello Django-users, Say I have a model that returns its name like this: def __unicode__(self): return str(self.distance_min) + "-" + str(self.distance_max) I want to filter this model based on those two values: Distance.objects.filter("241-250") this obviously does not work, but is it

From ASP to Django

2008-06-19 Thread gnijholt
Ok I need some thoughts on the following. For a client, we need to redesign their website. The back-end was coded a couple of years ago in classic ASP. It's fairly complex, with a webshop, uploading and parsing of excel files with new collections of clothing, and stuff like that. It took people

Re: (Py)Textile bug?

2007-04-17 Thread gnijholt
I'm sorry if the formatting in my post is messed up... (safari & google groups) if the example is not clear, I will try to attach it as plain text. On Apr 17, 10:42 am, gnijholt <[EMAIL PROTECTED]> wrote: > Hello Django-users, > > Could there be a bug in PyTextile that's

(Py)Textile bug?

2007-04-17 Thread gnijholt
Hello Django-users, Could there be a bug in PyTextile that's currently 'shipped' with Django? (textile-2.0.11) If I filter the following through textile: "[EMAIL PROTECTED]":mailto:[EMAIL PROTECTED] I get the following output as a result: mailto:[EMAIL PROTECTED]">john.mailto:[EMAIL

Dynamic fixtures?

2007-03-15 Thread gnijholt
Just watched a co-worker demonstrate fixtures in Django, which worked fast and flawlessly. >From what I understand, it takes JSON or XML files, but is it also possible to do Rails-style dynamic fixtures? Would be nice to generate a fixture with a few lines of Python instead of having to extract

Re: Admin site date view and permission controller

2007-01-24 Thread gnijholt
I would like to do this as well, and I have no idea where to start in order to solve the problem in an elegant and DRY way. On Jan 18, 6:26 pm, "Scott Zheng" <[EMAIL PROTECTED]> wrote: > I working on an cms site with django ,I use the admin site too.there is > a departmenttreelike below : > >