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
> 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,
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:
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
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
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):
"""
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
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)
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
://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
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
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
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
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
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.
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
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
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
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.
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
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
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
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
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
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
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
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
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
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
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,,
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
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 =
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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 %} =>
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
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
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
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
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
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
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
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
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,
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
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,
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
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
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.
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
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
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/'):