Re: Helsinki area djangonauts: Let's meet up

2009-11-09 Thread akaihola
Count me in. Also sent the message to three djangonauts I know who are not on djangopeople. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to

Re: Uploading music or videos (seeking django package)

2009-04-08 Thread akaihola
> I'd like to upload music and/or photos and/or videos to my website, > with the emphasis on mp3. If you're looking for re-usable apps, these two simple apps will get you started: django-attachments (on Google Code) django-uploads (on GitHub) They might also work together with django-massmedia,

Re: Many Questions, some of which are theoretical

2009-04-08 Thread akaihola
zayatzz, There are also lots of great re-usable apps for Django to get you jump- started. Here are some I've been happy with and which probably intersect with features you're looking for: sorl-thumbnail django-photologue django-page-cms django-rendertext django-cairo-text See also:

IOError: request data read error (revisited)

2009-03-31 Thread akaihola
We ran into the same issue Chunlei Wu described in January[1]. A user was trying to upload large files and all we got were 500 errors by e- mail: File "/home/citedesarts/src/django/django/http/multipartparser.py", line 406, in read IOError: request data read error The user was on a public

Re: delete in formset by clearing fields instead of checkbox

2009-03-17 Thread akaihola
Just in case anyone decides to use the code I posted earlier in this thread, there's one bug: the str() call needs to be replaced with a unicode() call to prevent failure with non-ASCII input. --~--~-~--~~~---~--~~ You received this message because you are

Re: delete in formset by clearing fields instead of checkbox

2009-03-13 Thread akaihola
Here is what I came up with. I had to override ModelForm as well to get rid of validation errors in emptied forms. This solution works in my use case where I only have CharFields and IntegerFields. It's not as simple as I had wished. Can it be? class DeleteIfEmptyModelForm(ModelForm): """

delete in formset by clearing fields instead of checkbox

2009-03-12 Thread akaihola
I have an inline formset with three CharFields in each form of a child object. For usability reasons, I'd like deleting to happen when all fields of a form are blank (or whitespace-only) instead of using a delete checkbox. I'm looking at save_existing_objects() in django/forms/models.py: 399-421

Re: CMS apps feature comparison matrix

2009-02-07 Thread akaihola
Kenneth Gonsalves kirjoitti: > cool - but I think it is better if you had the features as column headers and > the CMSs as row headers - easier to compare. I actually had it that way originally until version 14 [1], but tranposed the table because the large number of features (and still growing)

Re: Django Forms in HTML 4.01 Strict

2009-02-07 Thread akaihola
Isn't there a broader problem than just django.forms? Now that Django 1.0 seems to stand on the XHTML side, it encourages re-usable app authors to generate XHTML instead of HTML in their default templates as well as in any markup their apps might be generating programmatically. I have to admit

CMS apps feature comparison matrix

2009-02-06 Thread akaihola
://code.djangoproject.com/wiki/CMSAppsComparison [2] http://code.djangoproject.com/wiki/ForumAppsComparison [3] http://djangopeople.net/akaihola/ [4] http://djangoplugables.com/ --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "D

Django users meeting in Helsinki, Finland

2008-09-05 Thread akaihola
Last minute notice: There's a Django users meeting in Helsinki, Finland on Saturday, September 6th. See http://code.djangoproject.com/wiki/VersionOneReleasePartyHelsinki for more information. --~--~-~--~~~---~--~~ You received this message because you are

Re: simple multiplication in models

2008-09-01 Thread akaihola
Fabio, The only reasons I can think of for this kind of denormalization of the database are performance (as you mentioned, unsignificant benefit here) or using the resulting value in a filter condition. The latter can be better worked around by mixing raw SQL with Django's ORM expressions (with

Re: ManyToMany + through + using add, d

2008-08-29 Thread akaihola
This looks like Gergo's ticket for his original request: http://code.djangoproject.com/ticket/8334 --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to

Re: ManyToMany + through + using add, d

2008-08-28 Thread akaihola
I was just discussing this on the #django channel with Kuba, and we couldn't think why the following syntax wouldn't be possible to implement: >>> beatles.members.add(john, paul, date_joined=date(1961, 1, 1)) It would be otherwise similar to a normal m2m, but all keyword arguments would be used

Re: Language code as part of URL

2008-04-23 Thread akaihola
Panos, Thanks for the links. I checked the conversation and the blog post, by they address issues I've already solved. What I'm really struggling with is the reverse() problem and how to cleanly move the language activation logic from middleware (Django's default mechanism) to the URL resolver.

Re: Language code as part of URL

2008-04-23 Thread akaihola
Andrew, Thanks for your thoughts! > If the content is ultimately the same and you're simply offering > translations you don't want to put the language code before the > resource in the URL. Ie you don't want /fi/second/example/ because the > hierarchy implies that for a different country it's

Language code as part of URL

2008-03-28 Thread akaihola
re-usable components with no pre-existing counterparts, we'll of course publish and maintain them. I've collected some relevant links here: http://www.diigo.com/user/akaihola/django+language-in-url -Antti --~--~-~--~~~---~--~~ You received this message because

Comparing discussion forum apps

2008-02-25 Thread akaihola
Yvan Seth did a good job presenting a few discussion forum applications for Django in his blog entry [1] from December 2007. I'm now in the same position as Yvan was - I need to integrate a simple forum application to a Django site. I thought I'd share the results of my evaluation and allow

Re: PyAMF nogo, try DjangoAMF

2008-01-05 Thread akaihola
DjangoAMF almost worked for us except for two problems: - with hundreds of object it started to corrupt data - it needs the S2Flex2 library on the ActionScript side Since the December alpha version we have switched to PyAMF which works nicely with the native mx:RemoteObject mechanism.

Re: PyAMF 0.1.0 alpha

2008-01-05 Thread akaihola
I've been following the development of PyAMF because we need this kind of remote object support between Django and Flex in one of our projects. I just wanted to let everyone know that since this alpha release PyAMF really rocks. There's example code for the Django gateway and some decent

Re: editing an image with ModelForm

2007-12-29 Thread akaihola
Wouldn't it make sense to use the same mechanism as in the Admin interface of the newforms-admin branch? It seems to show the current file path as static text and somehow ignore an empty file field if the object already has a file. --~--~-~--~~~---~--~~ You

Re: Unhandled Exception on new server (Lighttpd + FastCGI)

2007-12-05 Thread akaihola
Derek just noticed in IRC that [6895] is still failing on flatpages. --~--~-~--~~~---~--~~ 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

Re: newforms-admin: Mixed form fields and text values with formsets

2007-10-17 Thread akaihola
Here's the solution I'm using right now in my view. Not pretty. my_items = MyModel.objects.all() my_items_dict = dict((obj.pk, obj) for obj in my_items) formset = forms.formset_for_model(MyModel, extra=0) (instances=my_items) pk_name = MyModel._meta.pk.attname for form in

Re: How do you manage your django sources?

2007-10-17 Thread akaihola
If the apps are shared (or might be shared) between multiple projects, I put them into separate repositories and use svn externals to stick them into the project tree. I actually include the Django source as an svn external as well to keep track on which branch/revision each project is using and

newforms-admin: Mixed form fields and text values with formsets

2007-10-17 Thread akaihola
I have a formset for "confirming" multiple model instances by checking a checkbox. I'd like to show values of some fields as text and display a checkbox for the confirmation boolean field. I have a couple of ideas: - somehow couple the instances and their corresponding formset forms and access

Re: Playing with fixtures and django serializers -> Errors...

2007-04-10 Thread akaihola
Unaware of the new manage.py dumpdata and loaddata commands, I've written a tool (dbpickle.py) for dumping and loading Django databases. I've used it both for moving data from one database engine to another and for migrating schema changes to production databases. I wonder if it would be

Re: Help needed in understanding newforms.

2007-03-04 Thread akaihola
On 2 March, Malcolm Tredinnick wrote: > [...] Group B are those forms where the input data is then > munged in some way and split across possibly multiple models for > storage. An example here might be a form that allows multiple teams for > a competition to be entered -- the data is split across

Re: Django snippets

2007-02-28 Thread akaihola
akaihola wrote: > > The e-mail field when registering towww.djangosnippets.orgis too > > short for the e-mail address I use for on-line services. James replied: > Do you mean it throws a validation error? Or that the field is too > small for you to see the whole address as yo

Solution: change only a subset of a model's field in newforms

2007-02-28 Thread akaihola
It must be a common need to allow the user to change only some fields of an object and keep old values for the rest. So far with newforms this has involved copying values explicitly from the database object to the form object. Looking at newforms code I realized that a cleaner way is to just not

Re: Django snippets

2007-02-26 Thread akaihola
Great! One small note: The e-mail field when registering to www.djangosnippets.org is too short for the e-mail address I use for on-line services. Also, the FAQ page fails: File "/home/ubernostrum/pylib/cab/models.py", line 137 original = models.ForeignKey('self', null=True, blank=True,,

Re: Hidden variable lookup failures and template performance

2007-01-17 Thread akaihola
Karen, Thanks for opening the ticket. Nice to see a patch as well. --~--~-~--~~~---~--~~ 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

multi-level foreign key query optimization

2007-01-17 Thread akaihola
Ok ORM gurus: my models form a foreign key "chain": ProductType <- Product -> Producer -> Region -> Country My view needs the list of product types for each Producer, Region and Country. Currently I iterate all producers, regions and countries in the view and do e.g. country.producttypes =

Hidden variable lookup failures and template performance

2007-01-05 Thread akaihola
Here's an issue to be aware of wrt template performance: I noticed that one of my templates was getting really slow. I profiled it and it seemed to spend lots of time calling the __str__ method of one of my models. The method contains a query for a related object, which slowed things down quite

Re: SQLAlchemy Progress

2006-12-30 Thread akaihola
Also, Robin Munn doesn't seem to have written much anything on django-developers lately. So it doesn't look very active at the moment. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post

Re: How to save a FileField in a custom manipulor?

2006-12-01 Thread akaihola
Found one tutorial: http://predius.org/blog/2006/09/11/uploading-files-on-django/ --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to

Re: How to save a FileField in a custom manipulor?

2006-12-01 Thread akaihola
I'd be grateful for any example code showing how this was intended to work, too. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to

Re: MR and users magic

2006-04-30 Thread akaihola
See http://code.djangoproject.com/ticket/61 for discussion and http://code.djangoproject.com/wiki/CookBookPasswordGreasemonkeyUserScript for a client-side solution while waiting for Django to be fixed. --~--~-~--~~~---~--~~ You received this message because you

Re: querying for an empty set in m-r?

2006-04-19 Thread akaihola
I vaguely remember an advice to use __isnull in a similar situation. Maybe one of these discussions turns up something useful: http://simon.bofh.ms/logger/django/search/?q=isnull --~--~-~--~~~---~--~~ You received this message because you are subscribed to the

Re: Locale from URL Middleware

2006-04-07 Thread akaihola
A downside in this is increased complexity when generating links between pages. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to

Re: Help with performance?

2006-04-05 Thread akaihola
Here's one technique for optimizing cases where you just get too many queries: http://code.djangoproject.com/wiki/CookBookPreloadRelated --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post

Re: Help with performance?

2006-04-05 Thread akaihola
Joseph, actually the page behind that link describes my profiling hack for the internal webserver, not mod_python. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send

Re: Help with performance?

2006-04-05 Thread akaihola
It's also useful to inspect {{sql_queries}} (see core/context_processors.py). If Django is doing tons of SQL queries, you'll have to sort out how to optimize. I reduced the number of queries on one of my more complex pages from over 6000 to just five. I'll contribute something about this on the

Re: How do I handel multiple foriegn keys in single model

2006-04-05 Thread akaihola
First you retrieve the person and e-mail type objects, then add a PersonEmail object using them. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to

Re: How do I handel multiple foriegn keys in single model

2006-04-05 Thread akaihola
Kenneth, what, many persons can have the same e-mail address?!? --~--~-~--~~~---~--~~ 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

Re: Locale from URL Middleware

2006-04-05 Thread akaihola
I very much agree with Simon and Jan. A middleware like this would be nice to have in django.contrib. One useful enhancement would be the ability to specify in where in the URL the language can be specified. On one of my sites the syntax of the URL is always /userid/locale/page... so it would be

Re: follow relationship

2006-04-03 Thread akaihola
http://code.djangoproject.com/wiki/CookBookChoicesContantsClass Feel free to fix any mistakes on the page! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to

Re: Too many SQLs in change_list pages

2006-04-03 Thread akaihola
I'm hitting the same problem with my own views and templates. I can query lots and lots of objects with one filter, but when I start to access related objects for each of the objects, Django fires lots of separate queries. I know select_related=True, but it doesn't seem to make a difference, and

Re: How to make the module name translatable in M-R

2006-04-03 Thread akaihola
Create an __init__.py file in the app directory: from django.utils.translation import gettext_noop gettext_noop('The name of the app') Then do the usual make-messages.py etc. dance. --~--~-~--~~~---~--~~ You received this message because you are subscribed to

Re: follow relationship

2006-04-02 Thread akaihola
Ned, I think this is definitely Django Cookbook stuff. It would perhaps fit in http://code.djangoproject.com/wiki/CookBookDataModels I can add it for you if you're busy and allow me to... :) --~--~-~--~~~---~--~~ You received this message because you are

Re: applying strip() to submitted formfield values, especially numerics

2006-04-02 Thread akaihola
Out of curiosity, I took a look at magic-removal source to see what changes would be needed for this. I think that in the case of integer fields it's sufficient to add whitespace into the validation regexp in core/validators.py: integer_re = re.compile(r'^\s*-?\d+\s*$') This should work because

Re: mini-wiki advice

2006-04-01 Thread akaihola
Wouldn't it be more useful to store the revision number as a field instead of building a chain of links for the revision history? I'm not sure how straightforward it is to fetch the record with the largest revision number in Django though, but a boolean 'current' field would be a quick

Re: intermediate table, how do i ensure no two similar rows exist.

2006-03-19 Thread akaihola
To complete your model, I think a unique_together='recipe','user' should be added. What happens if you have unique_together='recipe','user' and try to create a Mark which already exists? --~--~-~--~~~---~--~~ You received this message because you are subscribed

Re: Template formatting (e.g. HTMLtidy) ?

2006-03-12 Thread akaihola
I found this discussion concerning HTML Tidy and ASP.NET tags: http://blogs.borland.com/stevet/archive/2004/10/11/1568.aspx Another idea: Write a wrapper for HTML Tidy to convert Django tags/vars to HTML comments and back. It would be a serious hack, but could work: {% tagname parameters %} =>

Re: Template formatting (e.g. HTMLtidy) ?

2006-03-12 Thread akaihola
For Emacs users: Emacs' nxml-mode seems to work rather well with Django templates. It underlines tags and variable references with a red line, but otherwise it's nice to work with. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the

Re: basic model with user foreign key.

2006-03-12 Thread akaihola
from django.models.auth import User --~--~-~--~~~---~--~~ 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

Re: url config and generic views and non generic views.

2006-03-11 Thread akaihola
urlpatterns.extend(patterns('', r'^pattern/', 'myproj.myapp.views.myview')) is a simple way to achieve this. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email

Re: Help with a custom tag

2006-03-03 Thread akaihola
It seems you can also say {{item.list.0}} = {{item.list.1}} --~--~-~--~~~---~--~~ 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

ManyToMany relations and order_with_respect_to

2006-03-03 Thread akaihola
In my model I have Papers and Persons. One Paper usually has multiple Persons as authors, and they have to be in a determined order. Every Person can of course be author for multiple Papers. On top of all, I'd like to be able to edit authors inline and re-arrange their order for every Paper in

Re: Ordering with respect to a function in models?

2006-03-03 Thread akaihola
You're not alone. I need this too and couldn't find a solution. --~--~-~--~~~---~--~~ 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

Re: admin > site

2006-03-03 Thread akaihola
At least the FlatPages app in Django's contrib uses the site feature. --~--~-~--~~~---~--~~ 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

Re: Help with a custom tag

2006-03-03 Thread akaihola
First of all, do you need a template tag for this? Can't you say {% for item in mylist %} {{item|slice:"0"}} = {{item|slice:"1"}} {% endfor %} If you want to create a for-loop-like template tag, you need some additional machinery. It's best to use class ForNode and def do_for() from

Re: Recursive ForeignKey with blank=True

2006-03-02 Thread akaihola
Strange, since for me a similar case works in the current magic-removal. And your DB is up-to-date with the Django model? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group,

Re: To Truncate a Word to # of chars

2006-02-26 Thread akaihola
Reading the source code of the "slice" filter in Django it looks to me like it should work on strings as well as lists. If you only need to truncate and discard the extra characters, that would be the way to go. --~--~-~--~~~---~--~~ You received this message

Re: Template

2006-02-25 Thread akaihola
It would be easier to give advice if we could see the whole story and not only details. Could you express in clear terms what you are trying to achieve? But to get started: To test if page.title == "menu": {% ifequal page.title "menu" %} {% endifequal %} To retrieve objects from the database,

Re: weekend datetime objects

2006-02-23 Thread akaihola
I have a related problem: I like to calculate time differences with a custom SQL query to optimize speed. The db cursor seems to return a DateTimeDelta object (is that a psycopg class?) which I need to convert to a datetime.timedelta to interoperate with other time objects in Django. On the

Re: How to implement this fucntionality ? (current page higlighting)

2006-02-22 Thread akaihola
Sorry, my mistake. Actually you can't insert anything into the context in urls.py. I was thinking of the ability to pass extra arguments for your view functions, which is of little use here. So I'd either use the method I illustrated above or go with the CSS method. Either way, you need to

Re: How to implement this fucntionality ? (current page higlighting)

2006-02-21 Thread akaihola
A simple solution is to indicate the current page (or section) in the context. You can do it in your urls.py (see http://www.djangoproject.com/documentation/url_dispatch/#passing-extra-options-to-view-functions ) or in views.py. Let's say you have inserted {'section': 'ajouter'} in your context.

Re: Creating a menu structure

2006-02-20 Thread akaihola
I've hit the same challenge. I'd like to maintain a list of nested categories with the admin interface. Any news on this? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this

Re: Tiny myce

2006-02-09 Thread akaihola
Doesn't your HTML render as expected in the editor, or do you get unexpected results when viewing the resulting HTML outside admin? If you're used to hand-coding your HTML, remember that with wysiwyg editors, your HTML is not your HTML anymore: you'll have to live with the machine-generated

Re: Tiny myce

2006-02-08 Thread akaihola
The tiny_mce editor should appear nevertheless. View the source of an admin page where tiny_mce should appear. Check the tags. You should have something like this (I've set my ADMIN_MEDIA_PREFIX to '/admin_media/'):