Re: Localisation and timezones

2012-10-10 Thread koenb
Tom, I think you can create a custom format file for that (see [1] ). Koen [1] : https://docs.djangoproject.com/en/1.4/topics/i18n/formatting/#creating-custom-format-files Op woensdag 10 oktober 2012 12:40:52 UTC+2 schreef Tom Evans het volgende: > > Hi all > > If you enable USE_L10N=True,

Re: Server error caused by too many database look-ups

2012-05-03 Thread koenb
You should use DEBUG=True in your development settings, so you get a proper traceback of what is going on. As far as I can see, you do have syntax errors in your models.py file (eg line 266). You should fix them first. As a side note, your unicode methods are not all correct, some of them are

Re: Am I overlooking something or is this a bug in ModelForm?

2011-08-31 Thread koenb
On 31 aug, 17:12, Wim Feijen wrote: > Hello, > > I am using a form which (simplified) looks like this: > > class AdvancedSearchForm(forms.ModelForm): >     email = forms.CharField(label='Emailadres', required=False) > >     class Meta: >         model = Address >        

Re: Reporting Library??

2010-08-11 Thread koenb
On 11 aug, 03:15, ydjango wrote: > I need a reporting library for web based (HTML) reporting with support > for standard features > 1) header > 2) footer > 3) pagination > 4) Totals/summary > > Reportlab is too low level for my needs and their pro version license > does not

Re: Many to Many...so many queries

2010-03-18 Thread koenb
On 18 mrt, 10:12, bruno desthuilliers <bruno.desthuilli...@gmail.com> wrote: > On Mar 18, 8:42 am, koenb <koen.bierm...@werk.belgie.be> wrote: > > > Take a look at something like django-selectreverse [1] for inspiration > > on how to reduce your querycount for M2M

Re: Many to Many...so many queries

2010-03-18 Thread koenb
Take a look at something like django-selectreverse [1] for inspiration on how to reduce your querycount for M2M relations. Koen [1] http://code.google.com/p/django-selectreverse/ On 17 mrt, 18:55, TheIvIaxx wrote: > I made a mistake in my model definitions above.  The

Re: Project optimisation stage: Advice to boost speed of database queries across tables?

2010-01-06 Thread koenb
On 31 dec 2009, 01:56, Sam Walters wrote: > Thanks for the replies. > > Yes, there is the option of going to raw MySQL. However the project > requirements mean i can't use raw SQL. (portability, readability) > From what i can see using django's db API i have to execute the >

Re: ManyToMany lookups

2009-10-21 Thread koenb
On 20 okt, 21:19, r_f_d wrote: > Why not do this: > > for p in products.objects.all(): >     for c in p.categories.all(): >          print p,' - ', c > > -richard > > On Oct 20, 7:57 am, Михаил Лукин wrote: > This will obviously leave you with a

announcing django-selectreverse

2009-10-12 Thread koenb
It is quite common to have templates with lists traversing reverse foreignkey relationships or m2m relationships, which generate a lot of queries, for example: {% for building in buildinglist %} Building: {{ building }} Appartments: {% for

Re: Global custom tags

2009-07-03 Thread koenb
On 3 jul, 04:59, diogobaeder wrote: > But where do I put the custom template, than? If I load it from an app > template, I must create it under /templatetags/, and what if I > want to call it from the base template? /templatetags/? > > Thanks! > > Diogo > I think you are

Re: Django form: Allow user to insert a date in dd-mm-yyyy format and then convert in yyyy-mm-dd

2009-03-18 Thread koenb
On 18 mrt, 13:01, MarcoS wrote: > Hi Adi, thanks for your reply! > > I had just tried the DateField.input_formats, but the problem was that > I'm using the date admin widgets. > If I specify input_formats like: '%d.%m.%y', I can't use the admin > widgets 'cause it insert

Re: DateField with Django

2009-03-18 Thread koenb
> Does anybody know how to control a form's output format of a stored > DateField? Unfortunately, different countries use different customs to > represent dates and I'd like to represent the date in another > international format (%d-%m-%Y). Any help would be very much > appreciated! I use the

Re: Using BaseInlineFormSet with customized form

2009-03-03 Thread koenb
On 3 mrt, 14:32, koenb <koen.bierm...@werk.belgie.be> wrote: > Do you think this is worth a ticket ? I created ticket #10403 for this. Koen --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Djang

Re: Using BaseInlineFormSet with customized form

2009-03-03 Thread koenb
On 3 mrt, 14:09, Alex Gaynor wrote: > > AFAIK the intention was always to eventually have a metaclass so it looked > more like model forms, but the usecase wasn't as strong, and no one who > wanted it ever wrote any code AFAIK > > Alex Thank you Alex, something like

Using BaseInlineFormSet with customized form

2009-03-03 Thread koenb
Hi all, I want to use a inlineformset with a highly customized form (it is based on a specific metaclass and has a customized __init__ function). Due to the way the inlineformset_factory function works, if I specify my form in the form argument, the specific form instantiation does not seem to

Re: Date and Times

2009-02-18 Thread koenb
H René, This is what I use on all my forms (I use my own modelform subclass to insert these for date fields, but that is not relevant): as formfield: class DateFormField(forms.DateField): def __init__(self, input_formats=None, *args, **kwargs): super(DateFormField,

Re: Optional m2m relationships in Admin

2009-02-04 Thread koenb
>     def save_model(self, request, obj, form, change): >         super(GamesAdmin, self).save_model(request, obj, form, change) >         if not change: >             #get a tag >             tag = Tags.objects.get(pk=1) >             #associate tag with newly created object >            

Re: #7210 - F() Query Expressions

2009-01-30 Thread koenb
On 30 jan, 13:46, Russell Keith-Magee wrote: > If you are interested in implementing this, I'm happy to give you > pointers. The first pointer I can suggest is that you will be looking > at the SQLEvaluator class contained in > django/db/models/sql/expressions.py. This

Re: #7210 - F() Query Expressions

2009-01-30 Thread koenb
> > As committed, the expressions framework is fairly dumb - it is really > just a way to do two things: >  1) Expand Django-style field references into column names (and joins > if required) >  2) Turn Python expression trees into SQL expression trees. > > This means that the operations that

Re: #7210 - F() Query Expressions

2009-01-29 Thread koenb
This is really great! Thanks all for the good work. Just curious, has there been any work done to make this also work for dates ? like in longevents = Event.objects.filter(enddate__gte=F('startdate')+10) or something like that ? Koen --~--~-~--~~~---~--~~ You

Re: Update: Date formatting between model and form output

2008-09-26 Thread koenb
On 26 sep, 16:00, Gerard Petersen <[EMAIL PROTECTED]> wrote: > Getting closer. This works: product.period_start_date.strftime('%d-%m-%Y') > > But I definitely do not want this in all view handlers. It should go in the > model .. or the modelform. > > Thanx again! > > Gerard. > > Gerard Petersen

Re: formset issue

2008-09-02 Thread koenb
??? > > thanks, > patrick > > On Sep 1, 3:39 pm, koenb <[EMAIL PROTECTED]> wrote: > > > Are you sure the data will be retrieved twice ? I thought those > > queryset definitions were lazy, so they are only executed when the > > widgets are rendered. >

Re: formset issue

2008-09-01 Thread koenb
, > patrick > > On Sep 1, 1:51 pm, koenb <[EMAIL PROTECTED]> wrote: > > > I have not tried this, but can't you just in your view instantiate the > > formset and then loop over the forms and set the queryset on your > > field ? > > > Koen > > &

Re: formset issue

2008-09-01 Thread koenb
I have not tried this, but can't you just in your view instantiate the formset and then loop over the forms and set the queryset on your field ? Koen On 1 sep, 09:24, patrickk <[EMAIL PROTECTED]> wrote: > found a solution: with using threadlocals, it´s possible to define a > custom manager

Re: How to create a Generic Show View ?

2008-08-28 Thread koenb
out write in views.py to instantiate the > form. > > Is it possible? > > Thanks. > Mario Hozano. > > > > On Wed, Aug 27, 2008 at 3:34 AM, koenb <[EMAIL PROTECTED]> wrote: > > > Hi Mario, > > > a few months ago I posted a snippet on djangosnip

Re: how to locate the OS currently logged in user??

2008-08-27 Thread koenb
Did you look at the information attached to ticket 689 [1] ? This is about using the credentials provided by the webserver. Typical use case is having apache authenticate the user (eg via mod_ntlm, mod_auth_sspi or another authentication system), pass the username into the django app and use

Re: How to create a Generic Show View ?

2008-08-27 Thread koenb
Hi Mario, a few months ago I posted a snippet on djangosnippets [1] that kind of does something like this: it takes a form (can be the same one you use for editing) and displays it as read-only. The disadvantage is it uses the entire form machinery just to display some values, which is a lot of

Re: Random NoReverseMatch

2008-08-25 Thread koenb
I guess you are seeing the bug reported in #6379. You probably have an import error somewhere, but it is being hidden by the NoReverseMatch exception that is raised for anything that goes wrong. Koen On 25 aug, 16:13, Robin <[EMAIL PROTECTED]> wrote: > Hello, > > i have the same exception and

Re: partially edit an object

2008-05-16 Thread koenb
Robin, I don't know if this is a 'right' way, but I posted a snippet on djangosnippets with my DisplayModelForm [1]. Basically, it allows you to reuse your form definitions, but turn them into a "display_only" mode. You can do all fields or just a few. I use it to display objects to users, with

Re: generic foreignkey and auditTrail

2008-05-14 Thread koenb
Ok, just found #5826 which seems to solve my problem. Thanks, kgoudeaux! On 14 mei, 16:32, koenb <[EMAIL PROTECTED]> wrote: > Hi all, > > I was trying to adapt AuditTrail [1] to also automatically add generic > foreignkey attributes. > > The audittrail app n

generic foreignkey and auditTrail

2008-05-14 Thread koenb
Hi all, I was trying to adapt AuditTrail [1] to also automatically add generic foreignkey attributes. The audittrail app now copies all the fields to the audit model, which means the contenttype and objectid are copied perfectly, but I would like to access the referenced object directly from

Re: Row-level permissions, recommendations?

2008-05-14 Thread koenb
Why would you want to do this in admin ? Admin is for ... hmm admins. If you want your users to change their info: make your own view (very easy with modelforms) and add the permission check in your view (this really isn't difficult at all). Koen On 6 mei, 15:50, Rodrigo Culagovski <[EMAIL

Re: generic delete_object issue on Firefox (redirect bug)

2008-04-28 Thread koenb
Sorry; forgot to add, you will need to wrap the generic view in a custom wrapper view for that. On 28 apr, 22:42, koenb <[EMAIL PROTECTED]> wrote: > The problem is FF does not like it if you do not consume the POST > data. > Just add the line > request.POST > somewher

Re: generic delete_object issue on Firefox (redirect bug)

2008-04-28 Thread koenb
The problem is FF does not like it if you do not consume the POST data. Just add the line request.POST somewhere in your view before redirecting. Koen On 28 apr, 17:33, yml <[EMAIL PROTECTED]> wrote: > Hello, > I noticed a very strange behavior with the generic view called : > "delete_object".

Re: serving static content on Windows

2008-04-17 Thread koenb
The error message says it all: it is looking for testporject.polls.views.django.views.static. Notice the first part. It means your view function is taken from within testproject.polls.views (which is probably on top in your patterns declaration). You should take this declaration out of there and

Re: Read-only connection to database. How to?

2008-02-05 Thread koenb
You could take a look at the multidb branch (specifically check out ticket #4747). It is a bit behind on trunk, but the basics should work. It allows you to define multiple connections, so you should be able to connect to the same db using different users. Koen On 5 feb, 23:47, Julien <[EMAIL

Re: form for display, not edit

2008-02-01 Thread koenb
I also have something similar: I created a bunch of display widgets (displaytextinput, displaytextarea, displayselect, displayselectmultiple etc.), which override the render method of their parents and created a subclass of forms.ModelForm for this, which has a display_only argument on the

Re: Very Easy Question

2008-01-10 Thread koenb
Especially take note of the hint to use junction.exe [1]. It allows you to use kind of like symlinks on windows. Especially interesting if you use different versions and branches. Koen [1] http://www.microsoft.com/technet/sysinternals/FileAndDisk/Junction.mspx

Re: QuerySet.count() inaccurate across ForeignKey relationships

2007-10-31 Thread koenb
First things first: I would either define a separate Group object here, or use a many2manyfield if you don't need to know the group numbers. Second thing: why use the assembly object if you want to count items ? You are thinking to much in SQL instead of ORM. If you say Assembly.objects.count(),

Re: Markdown problem

2007-10-22 Thread koenb
Alexander, A few weeks ago I came across the same issue (I filed ticket #5663). The good thing is, making your own replacement filter to bypass the problem is easy. On the other hand, Malcolm closed the ticket today as wontfix, stating it is a bug in markdown. Though that may be true, I do not

Re: multiple database support: oracle backend

2007-10-17 Thread koenb
In the latest patches for multi-db the QuerySet that is returned is no longer fixed, but varies with the model's manager. That should fix that problem for now. Koen On 17 okt, 09:03, Ian <[EMAIL PROTECTED]> wrote: > I don't know anything about the multi-db branch, but I imagine that > whatever

Re: Multiple Database Support

2007-10-17 Thread koenb
Hi Mark, You can find some newer work at ticket #4747. The patches there are some work in progress trying to bring multi-db back in line with trunk. A lot has changed in trunk in the last year, so I think it is worth trying those out instead of the old branch. Off course there are still a lot of

Re: multiple database support: oracle backend

2007-10-17 Thread koenb
Sorry Carlos, those patches are far from complete, and I don't use Oracle myself. For the moment the backends in the patches use the following to get the connection: connection = self.model._default_manager.db.connection Removing the import and putting in that line should do the

Re: problems with i18n

2007-08-13 Thread koenb
Hi Heba, I just tried your project with django trunk r5881: I put everything in a folder, modified the settings to use sqlite3, created a db, did manage.py syncdb. Then I started the development server, looked at 127.0.0.1:8000 and it seems to work just fine. What django version are you using ?

Re: help serving static files (css, images, pdf, js)

2007-08-03 Thread koenb
There already is a ticket: #4783. Just needs volunteers to do the writing... Koen On 3 aug, 10:41, james_027 <[EMAIL PROTECTED]> wrote: > hi, > > On Aug 3, 4:32 pm, koenb <[EMAIL PROTECTED]> wrote: > > > My guess is you are interfering with your admin_media (look

Re: help serving static files (css, images, pdf, js)

2007-08-03 Thread koenb
My guess is you are interfering with your admin_media (look at the admin_media_prefix setting). Try using something like r'^sitemedia/... and src="/sitemedia/...". Koen On 3 aug, 09:16, james_027 <[EMAIL PROTECTED]> wrote: > hi, > > I already did the > > (r'^media/(?P.*)$',

Re: i18n on win 32 : make_message.py doesn't find anything to translate

2007-07-23 Thread koenb
That fix seems to work ok for me now. Thanks Ramiro, Koen --~--~-~--~~~---~--~~ 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

Re: i18n on win 32 : make_message.py doesn't find anything to translate

2007-07-22 Thread koenb
Check ticket 4899. It is the newline thing. The extra chr(13) under Windows breaks the fix from the ticket. Koen --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send

utf-8 and legacy databases

2007-07-05 Thread koenb
Do I understand correctly that with the unicode branch, databases are supposed to be providing and accepting utf-8 data ? This assumption is ok for self-constructed databases, but I am interacting with a legacy database that is in iso-8859-1 and I can't change that. Is there a setting somewhere