Announcing django-modeltranslation-0.5

2013-02-10 Thread Dirk Eschler
Hello,

i'm pleased to announce a new release of django-modeltranslation, a Django 
app used to translate dynamic content using a registration approach.

The 0.5 release is an important milestone which sorts out many caveats and 
inconsistencies that have been present in earlier versions. It adds official 
support for most non-text-like fields, a new multilingual manager, support for 
fallback languages and incorporates many improvements and bugfixes from the 
community.

Special thanks goes to Jacek Tomaszewski for addressing the deeper problems in 
modeltranslation with his django-modeltranslation-wrapper app. The changes and 
improvements made by the wrapper have been fully merged into 
modeltranslation's core with this release. And better: Jacek recently agreed 
to become a core committer, which makes me feel very positive about the 
project's future again.

Changelog
=
https://github.com/deschler/django-modeltranslation/blob/master/CHANGELOG.txt

Documentation
=
https://django-modeltranslation.readthedocs.org/en/latest/

Installation

$ pip install django-modeltranslation

Project Home

https://github.com/deschler/django-modeltranslation


Best Regards,
Dirk Eschler

-- 
Dirk Eschler <esch...@gmail.com>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Announcing django-modeltranslation-0.3

2011-06-03 Thread Dirk Eschler
Hello,

i'm pleased to announce the 0.3 release of django-modeltranslation, a Django 
app used to translate dynamic content of existing models to an arbitrary 
number of languages without having to change the original model classes.

It uses a registration approach (comparable to Django’s admin app) to be able 
to add translations to existing or new projects and is fully integrated into 
the Django admin backend.

Alongside bugfixes and some refactoring, this release adds new features like 
support for multi-table inheritance and tabbed translation fields in the admin 
using jquery-ui. This is really a community release, thanks for all the help, 
bug reports and patches.

Source download:
http://django-modeltranslation.googlecode.com/files/django-
modeltranslation-0.3.tar.gz

For a full changelog, downloads and docs, please visit the project page:
http://code.google.com/p/django-modeltranslation/

Best Regards,
Dirk Eschler

-- 
Dirk Eschler <esch...@gmail.com>

-- 
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 email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



UnicodeDecodeError with makemessages in django-1.3

2011-03-30 Thread Dirk Eschler
Hello,

i get a UnicodeDecodeError when running makemessages in the project folder 
with django-1.3, it works fine with django-1.2.

The release notes mention a change in the project-level handling of 
translations. Adding the project locale folder to LOCALE_PATHS doesn't seem to 
make a difference. I'm not sure if i understand the deprecation correctly - 
does it mean that the whole locale folder in the project directory should be 
dropped in favour of app level locale folders? Has this anything to do with 
the exception i get?

$ ./manage.py makemessages -l de
processing language de
Traceback (most recent call last):
  File "./manage.py", line 11, in 
execute_manager(settings)
  File "/path/to//django/core/management/__init__.py", line 438, in 
execute_manager
utility.execute()
  File "/path/to//django/core/management/__init__.py", line 379, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/path/to//django/core/management/base.py", line 191, in run_from_argv
self.execute(*args, **options.__dict__)
  File "/path/to//django/core/management/base.py", line 220, in execute
output = self.handle(*args, **options)
  File "/path/to//django/core/management/base.py", line 351, in handle
return self.handle_noargs(**options)
  File "/path/to//django/core/management/commands/makemessages.py", line 365, 
in handle_noargs
make_messages(locale, domain, verbosity, process_all, extensions, 
symlinks, ignore_patterns, no_wrap, no_obsolete)
  File "/path/to//django/core/management/commands/makemessages.py", line 233, 
in make_messages
f.write(templatize(src, orig_file[2:]))
  File "/path/to//django/utils/translation/__init__.py", line 127, in 
templatize
return _trans.templatize(src, origin)
  File "/path/to//django/utils/translation/trans_real.py", line 450, in 
templatize
content = u''.join(comment)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 284: 
ordinal not in range(128)


Best Regards,
Dirk Eschler

-- 
Dirk Eschler <esch...@gmail.com>

-- 
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 email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Wrong datetime format with datepicker in admin

2011-02-28 Thread Dirk Eschler
Hello,

using django-1.2.4 i get the wrong date format when using the datepicker or 
the today shortcut in the admin.

Instead of the format specified in my settings, it generates a local format -
"28.02.2011" instead of "2011-02-2011".

settings.py:
DATE_FORMAT = 'Y-m-d'
DATETIME_FORMAT = 'Y-m-d H:i:s'
YEAR_MONTH_FORMAT = 'Y-m'
MONTH_DAY_FORMAT = 'm-d'
TIME_FORMAT = 'H:i'
LANGUAGE_CODE = 'de-de'

USE_L10N defaults to False.

The today link in admin is:
javascript:DateTimeShortcuts.handleCalendarQuickLink(2, 0);

If i remember correctly the problem didn't exist in django-1.1 and arised 
after the upgrade to django-1.2. Is there any other setting or configuration i 
have missed?

Best Regards,
Dirk Eschler

-- 
Dirk Eschler <esch...@gmail.com>

-- 
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 email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: MySQL behavior about Warning/Exception

2011-01-25 Thread Dirk Eschler
Am Dienstag, 25. Januar 2011, 19:48:48 schrieb etienned:
> I would like to understand how Warning/Exception are treated in the
> MySQL backend because I have a weird bug.
> 
> When I run the test suite of django-reversion on my production server
> (Ubuntu 10.04) one test fail because MySQL give a warning instead of
> an exception. If I run the same test on my testing server (again
> Ubuntu 10.04 but in VirtualBox, so it's mostly the same software)
> MySQL give the exception so the test didn't fail. I tried on both
> server with DEBUG = True and DEBUG = False with the same result.
> 
> For more info you could check here:
> https://github.com/etianen/django-reversion/issues/closed#issue/18/comment/
> 566932
> 
> Anyone have an idea on this bug or, at least, explain how Warning/
> Exception are treated in the MySQL backend?

Hello,

the behaviour depends on the "non-strict" setting of the MySQL server. If i 
remember correctly in non-strict mode an error will be raised. You should 
compare the server configs of both machines.

Best Regards,
Dirk Eschler

-- 
Dirk Eschler <esch...@gmail.com>

-- 
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 email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



UnicodeDecodeError after upgrade to django-1.2.2

2010-09-09 Thread Dirk Eschler
Hello,

after upgrading from 1.2.1 to 1.2.2 i get a UnicodeDecodeError using the dev 
server. It happens with a simple contact form i'm using. The error page is 
served as text, white background, no django debug screen.

Traceback (most recent call last):

  File "/path/to/django/core/servers/basehttp.py", line 280, in run
self.result = application(self.environ, self.start_response)

  File "/path/to/django/core/servers/basehttp.py", line 674, in __call__
return self.application(environ, start_response)

  File "/path/to/django/core/handlers/wsgi.py", line 245, in __call__
response = middleware_method(request, response)

  File "/path/tos/django/middleware/csrf.py", line 242, in process_response
response.content, n = _POST_FORM_RE.subn(add_csrf_field, response.content)

UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 275: 
ordinal not in range(128)

-- 
Dirk Eschler <esch...@gmail.com>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Very slow page load in production with mod_wsgi

2010-09-03 Thread Dirk Eschler
Am Freitag 03 September 2010, 12:05:47 schrieb Graham Dumpleton:
> On Sep 3, 7:45 pm, Dirk Eschler <esch...@gmail.com> wrote:
> > Hello,
> > 
> > i experience slow page loads in production using mod_wsgi. The django
> > debugging toolbar reveals a very high CPU use with lots of voluntary
> > context switches:
> > 
> > Production (Apache mod_wsgi-3.2, daemon mode, 10 threads):
> > User CPU time3580.224 msec
> > System CPU time  156.010 msec
> > Total CPU time   3736.234 msec
> > Elapsed time 3671.237 msec
> > Context switches 21573 voluntary, 108 involuntary
> > 
> > Same page compared using the dev server:
> > 
> > Development (Django dev server):
> > User CPU time90.987 msec
> > System CPU time  5.999 msec
> > Total CPU time   96.986 msec
> > Elapsed time 99.323 msec
> > Context switches 0 voluntary, 51 involuntary
> > 
> > SQL queries doesn't seem to be the problem. I reduced the number of
> > queries to 1 or 2 using johnny-cache, but the CPU time is still nearly
> > the same as in the above example.
> > 
> > The load of the server is somewhere around 0.1 to 0.3 so this can't be
> > the problem either.
> 
> Is this on an initial request to the application or all requests?

This is on all requests. If the page is reloaded several times, chances are 
good that i hit one with 0 voluntary context switches, but the CPU time is 
still about the same, always around 3500ms .

> Is this only for a specific URL of your application or all URLs?

All, but only the frontend ones, the admin is fast. So the problem must be 
related to something that is only used in the frontend in production.

> What is the actual mod_wsgi configuration snippet from Apache
> configuration file?

WSGIDaemonProcess foo user=foo threads=10
WSGIProcessGroup foo
WSGIScriptAlias / /path/to/django.wsgi

> Have you confirmed in some way that your application is in fact
> running in daemon mode?

'ps' shows apache processes with the user used in my config and 'touch 
django.wsgi' reloads the application.

> What Apache MPM are you using?

mpm-prefork

> What is MaxRequestPerChild set to in your Apache configuration?

It was set to 0. Changed it to 500 now, but doesn't seem to make any 
difference.

p.s.:
Okay i found it. It is related to the django_compressor app which is used in 
production but not on the development server. When disabled, the CPU time is 
back to normal!

Thanks for your help,
Dirk Eschler

-- 
Dirk Eschler <esch...@gmail.com>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Very slow page load in production with mod_wsgi

2010-09-03 Thread Dirk Eschler
Hello,

i experience slow page loads in production using mod_wsgi. The django 
debugging toolbar reveals a very high CPU use with lots of voluntary context 
switches:

Production (Apache mod_wsgi-3.2, daemon mode, 10 threads):
User CPU time3580.224 msec
System CPU time  156.010 msec
Total CPU time   3736.234 msec
Elapsed time 3671.237 msec
Context switches 21573 voluntary, 108 involuntary

Same page compared using the dev server:

Development (Django dev server):
User CPU time90.987 msec
System CPU time  5.999 msec
Total CPU time   96.986 msec
Elapsed time 99.323 msec
Context switches 0 voluntary, 51 involuntary

SQL queries doesn't seem to be the problem. I reduced the number of queries to 
1 or 2 using johnny-cache, but the CPU time is still nearly the same as in the 
above example.

The load of the server is somewhere around 0.1 to 0.3 so this can't be the 
problem either.

Best Regards,
Dirk Eschler

-- 
Dirk Eschler <esch...@gmail.com>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Announcing django-modeltranslation-0.2

2010-06-15 Thread Dirk Eschler
Hello,

i'm pleased to announce the second release of django-modeltranslation, a 
Django app used to translate dynamic content of existing models to an 
arbitrary number of languages without having to change the original model 
classes.

It uses a registration approach (comparable to Django’s admin app) to be able 
to add translations to existing or new projects and is fully integrated into 
the Django admin backend.

This release resolves many problems of the initial version, adds full support 
for admin inlines and incorporates lots of fixes and enhancements supplied by 
the community.

Source download:
http://django-modeltranslation.googlecode.com/files/django-
modeltranslation-0.2.tar.gz

For a full changelog, downloads and docs, please visit the project page:
http://code.google.com/p/django-modeltranslation/

Best Regards,
Dirk Eschler

-- 
Dirk Eschler <esch...@gmail.com>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Fetch DoesNotExist from get_object_for_this_type

2010-05-28 Thread Dirk Eschler
Am Freitag 28 Mai 2010, 14:43:21 schrieb Daniel Roseman:
> On May 28, 1:33 pm, Dirk Eschler <esch...@gmail.com> wrote:
> > how to fetch the DoesNotExist exception generated by
> > get_object_for_this_type? Being generic i can't use the actual model.
[...]
> The DoesNotExist exceptions for each model are subclasses of
> django.core.exceptions.ObjectDoesNotExist - you can catch that
> instead.

Hello Daniel,

good point. Thanks alot.

Best Regards,
Dirk Eschler

-- 
Dirk Eschler <esch...@gmail.com>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Fetch DoesNotExist from get_object_for_this_type

2010-05-28 Thread Dirk Eschler
Hello,

how to fetch the DoesNotExist exception generated by get_object_for_this_type? 
Being generic i can't use the actual model.

I tried something like that, but i doesn't seem to work, the original 
exception is still raised.

from django.contrib.contenttypes.models import ContentType
from django.http import Http404
from django.shortcuts import get_object_or_404

ctype = get_object_or_404(ContentType,
  app_label=obj_app,
  model=obj_model)
try:
obj = ctype.get_object_for_this_type(id=obj_id)
except ctype.DoesNotExist:
raise Http404


Best Regards,
Dirk Eschler

-- 
Dirk Eschler <esch...@gmail.com>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: disabling dashboard 'recent actions'

2010-05-26 Thread Dirk Eschler
Am Mittwoch 26 Mai 2010, 08:50:09 schrieb rahul jain:
> Hi Django,
> 
> How to disable the dashboard ('recent actions') on django admin main page ?

Hello,

you can override the admin/index.html template to disable the display. There's 
a sidebar block you might want to change/remove.

Best Regards,
Dirk Eschler

-- 
Dirk Eschler <esch...@gmail.com>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Permissions of abstract model not added on syncdb

2010-05-26 Thread Dirk Eschler
Hello,

i've got an abstract model which has no fields and only defines permissions. 
The permission isn't added to the auth_permission table on syncdb nor is the 
content_type added to django_content_type. The app is in INSTALLED_APPS.

class Base(models.Model):
class Meta:
abstract = True
permissions = (
("can_do_foo", _(u"Can do foo")),
)

Is this a bug or am i missing something? I'm using django-1.2.1.

Best Regards,
Dirk Eschler

-- 
Dirk Eschler <esch...@gmail.com>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Reorder fields in tabular admin inline

2010-05-21 Thread Dirk Eschler
Hello Danfi,

thanks alot for your reply. I've just found another solution using a custom 
form for the inline like this:

from django.forms import ModelForm
from django.contrib.contenttypes import generic

class BarInlineForm(ModelForm):
class Meta:
model = Bar
fields = ['field3', 'field2', 'field1']

class BarInline(generic.GenericTabularInline):
model = Bar
form = BarInlineForm


Best Regards,
Dirk Eschler


Am Freitag 21 Mai 2010, 10:57:27 schrieb Danfi:
> use filedsets can dispaly them in that way , but it looks differently
> 
> from django.contrib import admin
> from models import *
> 
> class BarAdmin(admin.ModelAdmin):
> fieldsets = [
> (None, {
> 'classes': ('field3',),
> 'fields': ['field3']
> }),
> (None, {
> 'classes': ('field2',),
> 'fields': ['field2']
> }),
> (None, {
> 'classes': ('field1',),
> 'fields': ['field1']
> }),
> ]
> 
> admin.site.register(Bar,BarAdmin)
> 
> On 5月20日, 下午6时27分, Dirk Eschler <esch...@gmail.com> wrote:
> > Hello,
> > 
> > is there an easy way to reorder field display in a tabular admin inline,
> > like fieldsets for common admin forms?
> > 
> > Consider the following models, with Bar being edited inline:
> > 
> > class Foo(models.Model):
> > field1 = models.CharField(max_length=255)
> > field2 = models.CharField(max_length=255)
> > 
> > class Meta:
> > abstract = True
> > 
> > class Bar(Foo):
> > field3 = models.CharField(max_length=255)
> > 
> > This will result in an display order of [field1, field2, field3], while i
> > want it be ordered like [field3, field1, field2] or [field3, field2,
> > field1]. Since Foo is abstract, i can't just swap the definition order
> > to achieve this.
> > 
> > Best Regards,
> > Dirk Eschler
> > 
> > --
> > Dirk Eschler <esch...@gmail.com>
> > 
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Django users" group. To post to this group, send email to
> > django-us...@googlegroups.com. To unsubscribe from this group, send
> > email to django-users+unsubscr...@googlegroups.com. For more options,
> > visit this group athttp://groups.google.com/group/django-users?hl=en.

-- 
Dirk Eschler <esch...@gmail.com>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Reorder fields in tabular admin inline

2010-05-20 Thread Dirk Eschler
Hello,

is there an easy way to reorder field display in a tabular admin inline, like 
fieldsets for common admin forms?

Consider the following models, with Bar being edited inline:

class Foo(models.Model):
field1 = models.CharField(max_length=255)
field2 = models.CharField(max_length=255)
class Meta:
abstract = True

class Bar(Foo):
field3 = models.CharField(max_length=255)

This will result in an display order of [field1, field2, field3], while i want 
it be ordered like [field3, field1, field2] or [field3, field2, field1]. Since 
Foo is abstract, i can't just swap the definition order to achieve this.

Best Regards,
Dirk Eschler

-- 
Dirk Eschler <esch...@gmail.com>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Tests fail with django-1.2-rc1

2010-05-11 Thread Dirk Eschler
Am Dienstag 11 Mai 2010, 16:38:40 schrieb Russell Keith-Magee:
> On Tue, May 11, 2010 at 10:21 PM, Dirk Eschler <esch...@gmail.com> wrote:
> > Hello,
> > 
> > i'm in the process of upgrading a project to django-1.2-rc1. While the
> > project specific tests passed with django-1.1.1, they all fail now with
> > django-1.2-rc1 (see example below). Any idea what's going wrong?
> 
> At a guess -- you have a model with a custom save() method that isn't
> correctly handling optional arguments. In Django 1.1, save() only took
> two arguments: force_insert=False and force_update=False. Django 1.2
> added a new argument to save (the ``using`` argument) in order to
> handle multiple databases.
> 
> The Django docs recommended [1] using (*args, **kwargs) to allow for
> the addition of future arguments to save(); if you explicitly included
> support for force_insert and force_update, you will need to update
> your save() method to support the new using argument as well (or,
> better still - take the opportunity to migrate to using
> (*args,**kwargs) )

Good guess. :) And thanks for the pointer regarding additional arguments. I 
have fixed my save methods and the tests pass again.

Best Regards,
Dirk Eschler

-- 
Dirk Eschler <esch...@gmail.com>
http://www.krusader.org

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Tests fail with django-1.2-rc1

2010-05-11 Thread Dirk Eschler
Hello,

i'm in the process of upgrading a project to django-1.2-rc1. While the project 
specific tests passed with django-1.1.1, they all fail now with django-1.2-rc1 
(see example below). Any idea what's going wrong?


ERROR: test_content_is_active (foo.bar.tests.MyTestCase)
--
Traceback (most recent call last):
  File "/path/to/myproject/site-packages/foo/bar/tests.py", line 35, in setUp
status=status)
  File "/path/to/myproject/site-packages/django/db/models/manager.py", line 
138, in create
return self.get_query_set().create(**kwargs)
  File "/path/to/myproject/site-packages/django/db/models/query.py", line 352, 
in create
obj.save(force_insert=True, using=self.db)
TypeError: save() got an unexpected keyword argument 'using'


Best Regards,
Dirk Eschler

-- 
Dirk Eschler <esch...@gmail.com>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



No required field indication in TabularInline

2010-03-17 Thread Dirk Eschler
Hello,

in StackedInline the label of a required field gets the class required. In 
TabularInline (and GenericTabularInline) however, the corresponding table head 
cell gets no class, so there is no indication if a field is required or not. 
You have to save to know what fields are required. Is this just a missing 
feature or am i missing something?

Best Regards,
Dirk Eschler

-- 
Dirk Eschler <esch...@gmail.com>
http://www.krusader.org

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Custom set_password_form in password_reset_confirm

2009-08-07 Thread Dirk Eschler

Hello,

i'm trying to pass a custom set_password_form to the password_reset_confirm 
view. For some reason the set_password_form argument isn't honoured and i 
always end up with the original SetPasswordForm.

urls.py:
from foo.accounts.forms import KrSetPasswordForm
url(r'^accounts/password/reset/(?P[0-9A-Za-z]+)-(?P.
+)/$', 'django.contrib.auth.views.password_reset_confirm', 
{ 'set_password_form': KrSetPasswordForm, }),

I suppose something is wrong with my url pattern as set_password_form is still 
using SetPasswordForm when i check it in the view. Can anybody help me?

Best Regards,
Dirk Eschler

-- 
Dirk Eschler <esch...@gmail.com>

--~--~-~--~~~---~--~~
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 email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: foreign key id as part of models.FileField(upload_to=...)

2009-03-14 Thread Dirk Eschler

Am Samstag 14 März 2009 22:29:16 schrieb Dirk Eschler:
> def get_img_storage_path(instance, filename):
> return '%salbums/images/%s/' % (settings.MEDIA_ROOT, instance.album.pk)

Forgot the filename in my example...

def get_img_storage_path(instance, filename):
return '%salbums/images/%s/%s' % (settings.MEDIA_ROOT, instance.album.pk, 
filename)

-- 
Dirk Eschler <dirk.esch...@gmx.net>
http://www.krusader.org


--~--~-~--~~~---~--~~
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 email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: foreign key id as part of models.FileField(upload_to=...)

2009-03-14 Thread Dirk Eschler

Am Samstag 14 März 2009 22:13:39 schrieb Christoph Wegscheider:
> Hi,
> I want to upload photos to directories structured by the album primary
> key. I have the following model:
>
> class Photo(models.Model):
> album = models.ForeignKey(Album)
> img = models.FileField(upload_to='albums/images/' + str(album.pk)
> + '/',  blank=True)
>
> The str(album.pk) part is not working. As I understand it I can't use
> the album as an object of type album here like in views/templates (I'm
> new to python and haven't fully understand the mechanisms working
> underneath, but I guess the class declaration is processed earlier,
> when the information is not yet available).
>
> Nevertheless, I'm sure I can use the foreign key id for albums somehow
> as part of the path, but how?
> Any hint will be appreciated.

Hi Christoph,

since the FileField refactoring you can define a callable for upload_to. 
Basically that's a function which knows about the instance and filename and 
returns the full image path. Like this:

from django.conf import settings

def get_img_storage_path(instance, filename):
return '%salbums/images/%s/' % (settings.MEDIA_ROOT, instance.album.pk)

class Photo(models.Model):
img = models.FileField(upload_to=get_img_storage_path, blank=True)


Also see:
http://docs.djangoproject.com/en/dev/ref/models/fields/#django.db.models.FileField.upload_to

Best Regards,
Dirk Eschler

-- 
Dirk Eschler <dirk.esch...@gmx.net>
http://www.krusader.org


--~--~-~--~~~---~--~~
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 email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Custom save for excluded inline fields

2009-03-14 Thread Dirk Eschler

Am Samstag 14 März 2009 12:44:11 schrieb Dirk Eschler:
> myproject.news.models:
> ==
> class Post(models.Model):
> date = models.DateTimeField(default=datetime.now())
> release = models.ForeignKey(Release, null=True, blank=True)
>
> myproject.downloads.models:
> ===
> class Release(models.Model):
> release_date = models.DateTimeField(default=datetime.now())
>
> myproject.downloads.admin:
> ==
> class PostInline(admin.StackedInline):
> model = Post
> max_num = 1
> exclude = ('date',)
>
> class ReleaseAdmin(admin.ModelAdmin):
> inlines = [PostInline]
>
> Now what i'm trying to achieve is to exclude Post.date from the inline form
> (works), but then again set it to value that has been entered for
> Release.date when the Release is saved. Can this be handled in PostInline?
> Is exclude suited for this case at all?

Think i found a solution myself, ended up doing it like this:

class ReleaseAdmin(admin.ModelAdmin):
inlines = [PostInline]

def save_model(self, request, obj, form, change):
obj.save()
post = Post.objects.get(release=obj.id)
post.date = obj.release_date
post.save()

-- 
Dirk Eschler <dirk.esch...@gmx.net>
http://www.krusader.org


--~--~-~--~~~---~--~~
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 email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Custom save for excluded inline fields

2009-03-14 Thread Dirk Eschler

Hello,

i've been away from django for quite a while. First of all, i'm really 
impressed about the current state of django.

After porting most of my code to the current stable, i'm now trying to 
understand how the save method of inlines can be overwritten. Here's a 
stripped down version of my code:

myproject.news.models:
==
class Post(models.Model):
date = models.DateTimeField(default=datetime.now())
release = models.ForeignKey(Release, null=True, blank=True)

myproject.downloads.models:
===
class Release(models.Model):
release_date = models.DateTimeField(default=datetime.now())

myproject.downloads.admin:
==
class PostInline(admin.StackedInline):
model = Post
max_num = 1
exclude = ('date',)

class ReleaseAdmin(admin.ModelAdmin):
inlines = [PostInline]

Now what i'm trying to achieve is to exclude Post.date from the inline form 
(works), but then again set it to value that has been entered for Release.date 
when the Release is saved. Can this be handled in PostInline? Is exclude 
suited for this case at all?

Best Regards,
Dirk Eschler

-- 
Dirk Eschler <dirk.esch...@gmx.net>
http://www.krusader.org




--~--~-~--~~~---~--~~
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 email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Authenticate Trac against Django users.

2007-12-20 Thread Dirk Eschler

On Donnerstag, 20. Dezember 2007, Waylan Limberg wrote:
> I've worked up the beginnings of a Trac plugin that authenticates
> against Django users. I've since determined that I'm not likely to use
> it. So, is anyone interested in using and/or maintaining it? If so,
> I'll throw it up on trac-hacks.org.
>
> The basic functionality works. I can login to my django app and then
> I'm instantly logged into trac (without retyping my username and
> password). If I log out of my django app, I'm instantly logged out of
> trac.
>
> It works by getting the django session from the django cookie and
> extracting the user from the django database. Of course, for this to
> work, both the trac and django instances need to be on the same
> machine (to access eachother) and behind the same domain (to access
> the cookie). I also have the beginnings of some code to assign
> permissions within django for trac via django's user groups. For some
> undetermined reason I haven't been able to override the login/out
> links in the  nav and there's some debug code that needs removed.
>
> PS. I've cross-posted this to both django-users and trac-users as
> there may be interest in each group. I'll try to copy both lists with
> responses to any questions.

Hello Waylan,

please throw it up! :)

I've been looking for something like that for quite some time.

Best Regards,
Dirk Eschler

-- 
Dirk Eschler <mailto:[EMAIL PROTECTED]>
http://www.krusader.org

--~--~-~--~~~---~--~~
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 email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Error when I use datetime.now()

2007-10-20 Thread Dirk Eschler

On Samstag, 20. Oktober 2007, Greg wrote:
> Hello,
> I have a class called Orders that tries to add the current date to
>
> it's comments field when it's saved.  Here is my code:
> >from datetime import datetime
>
> class Order(models.Model):
> comments = models.TextField("Comments", maxlength=1000)
> etc...
>
> def save(self):
> self.comments += "This is a string - " + datetime.now() + "
> This is a string "
>
> 
>
> Whenever, I save my order class I get the following error:
>
> TypeError at /admin/plush/order/1/
> cannot concatenate 'str' and 'datetime.datetime' objects
>
> Any Suggestions?

Hi Greg,

you can also concatenate the strings like that:
self.comments = "%s abc %s abc" % (self.comments, datetime.now())

It does a typecast on the datetime object for you and is in general faster 
than using the plus operator.

Best Regards,
Dirk Eschler

-- 
Dirk Eschler <mailto:[EMAIL PROTECTED]>
http://www.krusader.org

--~--~-~--~~~---~--~~
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 email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: UnicodeError in admin in latest django

2007-10-12 Thread Dirk Eschler

On Freitag, 12. Oktober 2007, Michal Konvalinka wrote:
> Hi group,
> I have a problem with this variable in
> django.contrib.admin.templates.admin.change_form.html
> {{ original|truncatewords:"18"|escape }}
>
> I'm getting this error:
>
> UnicodeEncodeError at /admin/player/playerprofile/5/
> 'ascii' codec can't encode characters in position 3-4: ordinal not in
> range(128)
>
> Unicode error hint
> The string that could not be encoded/decoded was: Tomáš
[...]

Hi Michal,

i got around most of my unicode related problems by setting Pythons default 
encoding to utf-8.

$ cat /usr/lib/python2.4/sitecustomize.py
import sys
sys.setdefaultencoding("utf-8")

Best Regards,
Dirk Eschler

-- 
Dirk Eschler <mailto:[EMAIL PROTECTED]>
http://www.krusader.org

--~--~-~--~~~---~--~~
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 email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Unexpected date translation

2007-10-03 Thread Dirk Eschler

On Mittwoch, 3. Oktober 2007, Malcolm Tredinnick wrote:
> On Wed, 2007-10-03 at 15:37 +0200, Dirk Eschler wrote:
> > Hi,
> >
> > i'm using a date based generic on a multi-language website. When the
> > online language is set to German, {{ date|date:"M"|lower }} returns a
> > localized value - "mär" instead of "mar" that is. This breaks the link i
> > intend to build. Can the localisation be turned of somehow in this case?
>
> Not directly, no. The date filter is locale-aware and designed for
> created human readable strings.
>
> You would need to write your own filter that does the same thing but
> after first calling django.utils.translation.deactivate() (or maybe call
> activate('en') so that the result isn't dependent on your settings
> file). Remember to retrieve the current locale with get_language() first
> and set it back afterwards or you may get some weird side-effects.

Thanks for your help Malcolm. I will give it a try.

Best Regards,
Dirk Eschler

-- 
Dirk Eschler <mailto:[EMAIL PROTECTED]>
http://www.krusader.org

--~--~-~--~~~---~--~~
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 email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Unexpected date translation

2007-10-03 Thread Dirk Eschler

Hi,

i'm using a date based generic on a multi-language website. When the online 
language is set to German, {{ date|date:"M"|lower }} returns a localized 
value - "mär" instead of "mar" that is. This breaks the link i intend to 
build. Can the localisation be turned of somehow in this case? 

Best Regards,
Dirk Eschler

-- 
Dirk Eschler <mailto:[EMAIL PROTECTED]>
http://www.krusader.org

--~--~-~--~~~---~--~~
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 email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: PATH_INFO missing first part

2007-04-05 Thread Dirk Eschler

On Donnerstag, 5. April 2007, Bram - Smartelectronix wrote:
> Malcolm Tredinnick wrote:
> > This looks correct. Not sure why it isn't working, sorry. If you wanted
> > to do some more poking around, we set up PATH_INFO in
> > django/core/handlers/modpython.py, so you could put some debugging in
> > there to see what the value we get from modpython is. I'm reluctant to
> > think this would be a modpython problem, either ...something strange is
> > going on though. I don't really have any obvious ideas about what could
> > be going on here.
>
> That was easy to test and it does look like mod_python is giving us the
> wrong path_info!
>
> We're going to try switching off EVERYTHING in the apache config and add
> it back bit by bit to see what the hell is provoking this weird error.
>
> I'll report back later!

Hi,

i had a very similiar problem once. It turned that i had a "DocumentRoot" 
defined in my vhost config and that caused weird PATH_INFO problems. Django 
doesn't care about the DocumentRoot (IMHO), so i just removed it, but it took 
me quite a while to figure that out. I can't see anything unusual in your 
config though...

Best Regards,
Dirk Eschler

-- 
Dirk Eschler <mailto:[EMAIL PROTECTED]>
http://www.krusader.org

--~--~-~--~~~---~--~~
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 email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Please Remove My Email Address From Django Users

2007-03-09 Thread Dirk Eschler

Whoops, the quote was stripped. Here it is:

To unsubscribe from this group, send email to
[EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en

Best Regards.

-- 
Dirk Eschler <mailto:[EMAIL PROTECTED]>
http://www.krusader.org

--~--~-~--~~~---~--~~
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 email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Please Remove My Email Address From Django Users

2007-03-09 Thread Dirk Eschler

On Freitag, 9. März 2007, John A. Miller wrote:

Hi John,

[...]
> Please, remove my id and address from the Django users
> group.
[...]

you can do this yourself:

> 
-- 
Dirk Eschler <mailto:[EMAIL PROTECTED]>
http://www.krusader.org

--~--~-~--~~~---~--~~
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 email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Django Filebrowser and more than one TinyMCE instance

2007-03-03 Thread Dirk Eschler

On Freitag, 2. März 2007, patrick k. wrote:
> try playing around with:
>
>  relative_urls : false,
>  remove_script_host : true,
>
> we´re using absolute_urls and we don´t remove the script_host.
> if the URL is inserted into the tinymce_popup correctly, it doesn´t
> seem to be a problem with the filebrowser but a problem with
> tiny_mce. therefore, you may search the tinymce forum for more details.

I've tried all combinations without success. Can't find anything in the 
TinyMCE forum either. There are a few unsolved threads about a similiar 
problem with #mce_temp_url#, but they all refer to IE only, while for me it 
happens in Firefox too.

And i'm not sure if it's TinyMCE only in this case. The point is, when i enter 
a Link URL in advlink manually, all is fine. It only produces the broken 
#mce_temp_url# when the link was inserted through the Django filebrowser.

Best Regards.

-- 
Dirk Eschler <mailto:[EMAIL PROTECTED]>
http://www.krusader.org

--~--~-~--~~~---~--~~
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 email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Free comments not displayed

2007-03-03 Thread Dirk Eschler

On Samstag, 3. März 2007, Kenneth Gonsalves wrote:
> On 03-Mar-07, at 5:04 PM, Dirk Eschler wrote:
> > Any ideas what's going wrong? Could that be a permission problem
> > (although i'm
> > superuser in the admin)?
>
> looks like a typo somewhere

The only changes i made to the admin interface are minor ones in 
base_site.html and index.html templates or are CSS related. The changes don't 
affect the comment system.

I've uploaded a screenshot, to illustrate the problem:
http://hartkodiert.sinussource.net/media/upload/pub/django_freecomments.png

I'm using django-svn from yesterday, but the problem exists with older 
versions also.

-- 
Dirk Eschler <mailto:[EMAIL PROTECTED]>
http://www.krusader.org

--~--~-~--~~~---~--~~
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 email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Free comments not displayed

2007-03-03 Thread Dirk Eschler

On Samstag, 3. März 2007, Kai Kuehne wrote:
> Hi,
>
> On 3/3/07, Dirk Eschler <[EMAIL PROTECTED]> wrote:
> > Hi Kai,
> >
> > the problem is, that i don't see any entries in admin interface. It says
> > "2 free comments", which is the amount of entries i have added through
> > the frontend, but the list is empty.
>
> Ok, I misunderstood you. :)
> Have you tested to restart the server?
[...]

Yes, several times.

Also dropped the comment tables, ran syncdb and added new entries. Same 
problem.

-- 
Dirk Eschler <mailto:[EMAIL PROTECTED]>
http://www.krusader.org

--~--~-~--~~~---~--~~
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 email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Free comments not displayed

2007-03-03 Thread Dirk Eschler

Hi,

i'm using free comments. While they work fine in one of projects, they don't 
in another, whereas the code is basically the same.

I can add comments through the frontend, but they won't show up. In the free 
comments admin list view it says "2 free comments", the list however is 
empty.

Any ideas what's going wrong? Could that be a permission problem (although i'm 
superuser in the admin)?

Best Regards.

-- 
Dirk Eschler <mailto:[EMAIL PROTECTED]>
http://www.krusader.org

--~--~-~--~~~---~--~~
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 email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Django Filebrowser and more than one TinyMCE instance

2007-03-02 Thread Dirk Eschler
On Freitag, 2. März 2007, patrick k. wrote:
> we´re also using more than one tinymce instance and we don´t have any
> problems.
> could you give more details about your specifications, e.g. how do
> you init tinymce?
>
> patrick.

Hello Patrick,

thanks for your reply. In the model TinyMCE is loaded like:

class Admin:
# ...
js = (
'js/tiny_mce/tiny_mce.js',
'js/textareas.js',
)

For the filebrowser integration i followed:
http://trac.dedhost-sil-076.sil.at/trac/filebrowser/

I had some problems getting the Filebrowser popup to send the link into the 
TinyMCE popup. Clicking the arrow simply did nothing. I ended up with two 
different files:
- js/tiny_mce/tiny_mce_popup.js
- js/tiny_mce/tiny_mce_popup_fb.js

Both have the same content. The first file is sent when the TinyMCE popup is 
loaded, the second when the Filebrowser popup comes (i've traced this with 
LiveHttpHeaders). It was the only way to get it working at all.

In templates/filebrowser/index.html the second JavaScript file is referenced 
this way:

{% ifequal is_popup '2' %}
[...]
 
[...]
{% endifequal %}

I have attached my textareas.js, which also contains the Filebrowser callback 
i'm using. Please let me know if you need more information.

Best Regards.

-- 
Dirk Eschler <mailto:[EMAIL PROTECTED]>
http://www.krusader.org

--~--~-~--~~~---~--~~
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 email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



textareas.js
Description: JavaScript source


Django Filebrowser and more than one TinyMCE instance

2007-03-02 Thread Dirk Eschler

Hi,

i'm using the Django filebrowser together with TinyMCE in one of my projects. 
Inserting a adv_link from the file browser into the TinyMCE popup only works 
in the first TinyMCE instance.

In the second instance the link becomes #mce_temp_url#. Oddly enough, the link 
is displayed correctly in the TinyMCE popup, but after hitting update to 
apply the link and close the popup, it is rendered into #mce_temp_url#.

Is there any way around this problem?

Best Regards.

-- 
Dirk Eschler <mailto:[EMAIL PROTECTED]>
http://www.krusader.org

--~--~-~--~~~---~--~~
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 email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Clean permission table

2007-03-02 Thread Dirk Eschler

Hi,

during development apps are sometimes removed or renamed. What's a good way to 
clean the leftovers from the permissions table without breaking something?

Best Regards.

-- 
Dirk Eschler <mailto:[EMAIL PROTECTED]>
http://www.krusader.org

--~--~-~--~~~---~--~~
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 email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Upcoming Django release, and the future

2007-02-27 Thread Dirk Eschler

On Montag, 26. Februar 2007, James Bennett wrote:

Hi James,

[...]
> If there's a bug that's been annoying the heck out of you and you want
> it fixed before the release, this would be the time to speak up about
> it. We have a fairly high concentration of Django developers all in
> one place with nothing to do but code, so hopefully we'll be able to
> hit a lot of stuff and get a release out very quickly (we'd like to
> release 0.96 in the next day or two).

not really a bug, more an usability issue:

The available user permissions select in the user detail view of the admin 
interface should include the app name.

Say you have two apps, both with a class "section". In this case it's 
impossible to tell which section you assign permissions to. Both appear 
as "section | Can add section" etc. in the permission select box, which can 
in the worst case (if you choose the wrong one) become a security problem as 
well.

Best Regards.

-- 
Dirk Eschler <mailto:[EMAIL PROTECTED]>
http://www.krusader.org

--~--~-~--~~~---~--~~
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 email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Use an application inside other application

2007-02-25 Thread Dirk Eschler

On Sonntag, 25. Februar 2007, Grupo Django wrote:
> Hello, I have created an app named "menu". I want to build an easy way
> of adding items to the menu in the admin zone. I want to render this
> menu in every view of others applications (blog, static pages...).
> I'd like some suggestions about how to implement it in the template
> system.
> I thought about using the {% include %} tag, and then import the menu
> app in every application. Is this a good way?
> I accept suggestions.
> Thank you very much!

Hi,

you can write a custom template tag as part of your menu app and include it in 
the template like this:

{% load menu %}
{% menu %}

http://www.djangoproject.com/documentation/templates_python/#writing-custom-template-tags

Best Regards.

-- 
Dirk Eschler <mailto:[EMAIL PROTECTED]>
http://www.krusader.org

--~--~-~--~~~---~--~~
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 email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: unicode in filters

2007-02-19 Thread Dirk Eschler

On Montag, 19. Februar 2007, omat * gezgin.com wrote:
> I am trying to match a utf-8 character with a filter. Within the
> python prompt, "u'ç'.encode('utf-8')" returns "\xc3\xa7" correctly but
> when I use this inside a filter like:
>
> (name__startswith = u'ç'.encode('utf-8'))
>
> I get a syntax error:
> Non-ASCII character '\xc3' in file .../views.py on line 24, but no
> encoding declared...
>
> I couldn't figure out which encoding declaration does the message is
> talking about.
>
> Thanks for any advice...
> oMat

Hi,

you can try to add this as first line in your file:

# -*- coding: utf-8 -*-

Best Regards.

-- 
Dirk Eschler <mailto:[EMAIL PROTECTED]>
http://www.krusader.org

--~--~-~--~~~---~--~~
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 email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Reuse inclusion template tag in admin textarea?

2007-02-17 Thread Dirk Eschler

Hi,

i'm using the following template tag in my application:

@register.inclusion_tag('gallery/flv.html')
def flv(movie, width=320, height=160):
"""
"""
fl = FlashMovie()
return {
'flv_player': fl.get_flvplayer(),
'movie': '%s/%s' % (fl.get_upload_url(), movie),
'width': int(width),
'height': int(height),
}

In the templates i simply write {% flv "foo.flv" 320 160 %} to get the 
appropriate html for the movie.

Is it possible to reuse the inclusion tag in a admin textarea?

Say i write this into a admin textarea:
Here's my cool movie: {% flv "foo.flv" 320 160 %} ...

And in the model's save() method the template tag is replaced with the 
appropriate piece of html (from gallery/flv.html), which is then saved in the 
db. Can this be done, or should i better parse the content myself?

Best Regards.

-- 
Dirk Eschler <mailto:[EMAIL PROTECTED]>
http://www.krusader.org

--~--~-~--~~~---~--~~
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 email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Image upload - self.image not defined in save method

2007-02-13 Thread Dirk Eschler

Hello,

i use ImageWithThumbnailField to upload screenhots. In the save method i want 
to set some additional model fields, like filesize and width/height of the 
uploaded image. The problem is, that self.image isn't defined at this point, 
the same entry has to be saved twice in the admin.

Checking for self.image (like i read in another thread) doesn't work for me. 
Is there any way to get around this problem?

# -
class Screenshot(models.Model):
image= ImageWithThumbnailField(upload_to='upload/screenshots/')
filesize = models.PositiveIntegerField(null=True, blank=True, 
editable=False)
width= models.PositiveSmallIntegerField(null=True, blank=True, 
editable=False)
height   = models.PositiveSmallIntegerField(null=True, blank=True, 
editable=False)

def get_image_path(self):
return '%s/%s' % (settings.MEDIA_ROOT, self.image)

def save(self):
super(Screenshot, self).save()
if self.image:
self.filesize = getsize(self.get_image_path())
img = Image.open(self.get_image_path())
self.width = img.size[0]
self.height = img.size[1]

-- 
Best Regards
Dirk Eschler <mailto:[EMAIL PROTECTED]>
http://www.krusader.org

--~--~-~--~~~---~--~~
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 email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Custom SQL - MySQL Dictcursor

2007-02-11 Thread Dirk Eschler

On Freitag, 9. Februar 2007, Dirk Eschler wrote:
> Hello,
>
> is there a way to get a dictcursor from Django when using custom MySQL?
>
> >from django.db import connection
>
> cursor = connection.cursor()
> cursor.execute("SELECT [...]")
> cursor.fetchall()
>
> The above fetchall returns a tuple, while i need a dict, like it is built
> with MySQLdb.cursors.DictCursor(db).

In case it's not possible: can i reuse Django's connection object somehow, or 
do i have to handle the connection myself?

Is there any Django/MySQLdb example maybe?

Best Regards,
Dirk Eschler

-- 
Dirk Eschler <mailto:[EMAIL PROTECTED]>
http://www.krusader.org

--~--~-~--~~~---~--~~
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 email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: DB API - dict of emails

2007-02-10 Thread Dirk Eschler

On Samstag, 10. Februar 2007, Ned Batchelder wrote:
> But is is simple to convert what you have into what you want:
>
> l =
> User.objects.filter(username__in=['foo','bar']).values('username', 'email')
> emails = dict([(d['username'], d['email']) for d in l])
>
> It would be a little simpler like this:
>
> emails = dict([(r.username, r.email) for r in
> User.objects.filter(username__in=['foo','bar'])])
>
> The dict() built-in accepts a number of forms of arguments.  One is a
> list of pairs, each of which becomes a key and value in the resulting
> dictionary.

Nice! Thanks alot for posting posting this solution.

Best Regards,
Dirk Eschler

-- 
Dirk Eschler <mailto:[EMAIL PROTECTED]>
http://www.krusader.org

--~--~-~--~~~---~--~~
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 email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: DB API - dict of emails

2007-02-10 Thread Dirk Eschler

On Samstag, 10. Februar 2007, Malcolm Tredinnick wrote:
> Hi Dirk,
>
> On Sat, 2007-02-10 at 12:02 +0100, Dirk Eschler wrote:
> > Hello,
> >
> > i'm trying to get a dict of emails with usernames as keys.
> >
> > User.objects.filter(username__in=['foo', 'bar']).values('username',
> > 'email')
> >
> > The above returns a list of dicts:
> > [{'username': 'foo', 'email': '[EMAIL PROTECTED]'},
> > {'username': 'bar', 'email': '[EMAIL PROTECTED]'}]
> >
> > Is it possible to get a dict like this with Django's db api?:
> > {'foo':'[EMAIL PROTECTED]', 'bar':'[EMAIL PROTECTED]'}
>
> No, it is not possible to get that sort of dictionary back directly from
> Django.
>
> Regards,
> Malcolm

I see, thanks anyway!

Best Regards
Dirk Eschler

-- 
Dirk Eschler <mailto:[EMAIL PROTECTED]>
http://www.krusader.org

--~--~-~--~~~---~--~~
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 email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



DB API - dict of emails

2007-02-10 Thread Dirk Eschler

Hello,

i'm trying to get a dict of emails with usernames as keys.

User.objects.filter(username__in=['foo', 'bar']).values('username', 'email')

The above returns a list of dicts:
[{'username': 'foo', 'email': '[EMAIL PROTECTED]'}, 
{'username': 'bar', 'email': '[EMAIL PROTECTED]'}]

Is it possible to get a dict like this with Django's db api?:
{'foo':'[EMAIL PROTECTED]', 'bar':'[EMAIL PROTECTED]'}

Best Regards,
Dirk Eschler

-- 
Dirk Eschler <mailto:[EMAIL PROTECTED]>
http://www.krusader.org

--~--~-~--~~~---~--~~
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 email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Custom SQL - MySQL Dictcursor

2007-02-09 Thread Dirk Eschler

Hello,

is there a way to get a dictcursor from Django when using custom MySQL?

from django.db import connection
cursor = connection.cursor()
cursor.execute("SELECT [...]")
cursor.fetchall()

The above fetchall returns a tuple, while i need a dict, like it is built with 
MySQLdb.cursors.DictCursor(db).

Best Regards,
Dirk Eschler

-- 
Dirk Eschler <mailto:[EMAIL PROTECTED]>
http://www.krusader.org

--~--~-~--~~~---~--~~
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 email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Change class name in Admin interface

2007-02-07 Thread Dirk Eschler

On Mittwoch, 7. Februar 2007, Dirk Eschler wrote:
> Do you already use Django's i18n support? In this case you can mark the
> verbose_name and verbose_name_plural strings as translateable. Then
> create-messages.py will find it when executed the next time.

It's "make-messages.py" not "create-messages.py", sorry.

-- 
Dirk Eschler <mailto:[EMAIL PROTECTED]>
http://www.krusader.org

--~--~-~--~~~---~--~~
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 email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Change class name in Admin interface

2007-02-07 Thread Dirk Eschler

On Dienstag, 6. Februar 2007, Matias wrote:
> Hi,
>
> I've a class named "Category", but this application must be in
> Spanish, so I need it to be displayed on the Admin interface as
> "Categoria". ¿how can I accomplish that?
>
> Here is the model definition:
>
> class Category(models.Model):
>   name = models.CharField('Nombre',maxlength=40)
>   description = models.CharField('Descripción',maxlength=250)
>   def __str__(self):
> return self.name
>   class Admin:
> pass

Do you already use Django's i18n support? In this case you can mark the 
verbose_name and verbose_name_plural strings as translateable. Then 
create-messages.py will find it when executed the next time.

# -
from django.utils.translation import gettext_lazy as _

class Category(models.Model):
[...]
class Meta:
verbose_name = _('Category')
verbose_name_plural = _('Categories')
# -

See http://www.djangoproject.com/documentation/i18n/ for details about 
Django's i18n support.

Best Regards,
Dirk Eschler

-- 
Dirk Eschler <mailto:[EMAIL PROTECTED]>
http://www.krusader.org

--~--~-~--~~~---~--~~
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 email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Django on SourceForge?

2006-12-22 Thread Dirk Eschler


On Saturday 23 December 2006 00:24, [EMAIL PROTECTED] wrote:

you need python, django and some other python libraries instaled + CGI
isn't a good idea. So django on sourceforge is rather impossible.


Django itself imports without problems. I have just uploaded it to my home dir 
and extendend $PYTHONPATH. 


--
Dirk Eschler <mailto:[EMAIL PROTECTED]>
http://www.krusader.org

--~--~-~--~~~---~--~~
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 email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Django on SourceForge?

2006-12-22 Thread Dirk Eschler


Hello,

has anyone ever tried to deploy a Django powered website on SourceForge? Is it 
possible at all?


http://code.djangoproject.com/wiki/ServerArrangements says, that Django can 
work with plain CGI. Since i don't have much experience with CGI, i'm 
wondering if there's a doc that explains how to use the scripts the wiki page 
links to - or better - how to use them on SourceForge.


Best Regards,
Dirk Eschler

--
Dirk Eschler <mailto:[EMAIL PROTECTED]>
http://www.krusader.org

--~--~-~--~~~---~--~~
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 email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: OneToOneField and edit_inline

2006-12-18 Thread Dirk Eschler

On Monday 18 December 2006 22:49, Rob Slotboom wrote:
> > I'd like to be able to edit Project and News separately with Content
> > inline instead. Do you know what i mean?
>
> Hi Dirk,
>
> I get the point though I think this will not work. I've tried similar
> things when creating a menu, where a menu "one to oned" to a poll item
> or blog entry. I gave up.
>
> In the meanwhile there is a discussion going on about generic
> relations, these will solve this kind of problems. Actualy generic
> relations already are available..but the do not (yet) work in the
> admin (p) Please have a look at djangoproject and search for
> generic relations.
>
> My guess is to sit and wait.

I see. Thanks for the pointer to the generic relations. Looking forward to see 
them in the admin interface.

Best Regards,
Dirk Eschler

-- 
Dirk Eschler <mailto:[EMAIL PROTECTED]>
http://www.krusader.org

--~--~-~--~~~---~--~~
 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 email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: OneToOneField and edit_inline

2006-12-18 Thread Dirk Eschler

On Saturday 16 December 2006 12:07, Rob Slotboom wrote:
> Hi Dirk,
> I think it's the other way around, try this
>
>
> class Content(models.Model):
>  title = models.CharField('Title', maxlength=255, core=True)
>  body  = models.TextField('Body text')
>
> class Admin:
>   fields = (
>  (None, {'fields': ('title','body',)}),
>   )
>   list_display = ('title')
>   list_filter = ['title']   ## optional
>   search_fields = ['title']   ## optional
>   date_hierarchy = 'title'   ## optional
>   pass
>
> class Project(models.Model):
> content  = models.OneToOneField(Content,
> edit_inline=models.TABULAR,  num_in_admin=1, core=True,
> related_name='project_content')
> subtitle = models.CharField('Subtitle', maxlength=255, core=True)
>def __str__(self):
>   return self.Subtitle

Hello Rob,

sorry for the delay. Yes that works, but as soon as i add another class - say 
News - which also has a OneToOneField(Content), the Content admin interface 
shows Project AND News inline. That's certainly not what i want.

I'd like to be able to edit Project and News separately with Content inline 
instead. Do you know what i mean?

# -
class Content(models.Model):
title = models.CharField(maxlength=255, core=True)
body  = models.TextField()

def __str__(self):
return self.title
  
class Admin:
pass

class Project(models.Model):
subtitle = models.CharField(maxlength=255, null=True, blank=True)
content  = models.OneToOneField(Content, unique=True,   
   edit_inline=models.TABULAR, num_in_admin=1, core=True,   
 
   related_name='project_content')

def __str__(self):
return "%s - %s" % (self.content.title, self.subtitle)

class News(models.Model):
date = models.DateTimeField(default=datetime.now())
content = models.OneToOneField(Content, unique=True,
  edit_inline=models.TABULAR, num_in_admin=1, core=True,
  related_name='news_content')

def __str__(self):
return "%s - %s" % (self.content.title, self.date)
# -----

Thanks,
Dirk

-- 
Dirk Eschler <mailto:[EMAIL PROTECTED]>
http://www.krusader.org

--~--~-~--~~~---~--~~
 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 email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



OneToOneField and edit_inline

2006-12-14 Thread Dirk Eschler

Hello,

i'm having some problems with the OneToOneField. I have a content app with a 
class Content that i want to use as base class in several other classes (like 
Project in the below example):

class Content(models.Model):
title = models.CharField('Title', maxlength=255, core=True)
body  = models.TextField('Body text')

class Project(models.Model):
content  = models.OneToOneField(Content, edit_inline=models.TABULAR, 
num_in_admin=1, core=True, related_name='project_content')
subtitle = models.CharField('Subtitle', maxlength=255)

class Admin:
pass

Now when i try to add a project through the admin interface, i don't get the 
Content fields inlined, but only a empty input dropdown. Am i missing 
something obvious?

I'm using Django-0.95.

Best Regards,
Dirk Eschler

-- 
Dirk Eschler <mailto:[EMAIL PROTECTED]>
http://www.krusader.org

--~--~-~--~~~---~--~~
 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 email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Documentation - supported parameter lists

2006-12-13 Thread Dirk Eschler

Hello,

i really like the documentation intergration in Django's admin interface. I'm 
wondering how to document parameters though. I've tried using ReST for my 
classes and functions as described below, but :Parameters: doesn't seem to be 
recognized.

http://epydoc.sourceforge.net/fields.html
5.1. ReStructuredText Fields:

def fox_speed(size, weight, age):
"""
Return the maximum speed for a fox.

:Parameters:
  `size`
  The size of the fox (in meters)
  `weight` : float
  The weight of the fox (in stones)
  `age` : int
  The age of the fox (in years)
"""

Best Regards,
Dirk Eschler

-- 
Dirk Eschler <mailto:[EMAIL PROTECTED]>
http://www.krusader.org

--~--~-~--~~~---~--~~
 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 email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: View on Site link from Admin

2006-11-28 Thread Dirk Eschler

Am Dienstag, 28. November 2006 18:03 schrieb conrad22:
> How do I get the 'View on site' link that appears in the Django
> interface to work?
> I've tried adding the following to my urls.py
>
> (r'^r/', include('django.conf.urls.shortcut')),
>
>
> But didn't do anything!
>
> Thanks!

You have to activate the sites framework, resp. add 'django.contrib.sites' to 
your INSTALLED_APPS, and then set your hostname in the admin interface. At 
least i had to...

http://www.djangoproject.com/documentation/sites/

Hope that helps,
Dirk

-- 
Dirk Eschler <mailto:[EMAIL PROTECTED]>
http://www.krusader.org

--~--~-~--~~~---~--~~
 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 email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Translation hook not working for custom template tag

2006-11-14 Thread Dirk Eschler

Hello,

the i18n docs say, params in template tags can be translated like this:
{% some_special_tag _("Page not found") value|yesno:_("yes,no") %}

This doesn't work for me. I have written a simple template tag that swaps 
filenames depending on the request language. It takes three parameters and i 
want to translate the 3rd in the template like this:
{% i18n_img "img/foo_en.png" LANGUAGE_CODE _("bar") %}

Here's the error i get:
VariableDoesNotExist at /news/
Failed lookup for key [_("bar")] in [{'posts': [, ]}, {'LANGUAGES': (('de', 'German'), 
('en', 'English')), 'LANGUAGE_BIDI': False, 'LANGUAGE_CODE': 'de'}, {}, 
{'perms': , 'messages': [], 'user': }, {}]

Tags are loaded at top of the template:
{% load i18n i18n_img %}

Is this a bug, or am i doing something wrong?

Best Regards,
Dirk Eschler

-- 
Dirk Eschler <mailto:[EMAIL PROTECTED]>
http://www.krusader.org

--~--~-~--~~~---~--~~
 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 email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Store uploaded image by id

2006-11-08 Thread Dirk Eschler

Am Mittwoch, 8. November 2006 02:06 schrieb Enrico:
> Hi Dirk,
>
> I'm the author of that Wiki page, I've put that code on
> '/util/'.
>
> You could put somewhere else in your python path if you plan to use it
> in more projects.
> But Django doesn't look for custom fields anywhere, you'll have to
> import in your code.
>
> Best regards.
> Enrico

Hi Enrico,

thanks for sharing the code. Import sounds reasonable, i guess too much 
automation easily gets counterproductive.

-- 
Dirk Eschler <mailto:[EMAIL PROTECTED]>
http://www.krusader.org

--~--~-~--~~~---~--~~
 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 email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Is there any way to render rtf (rich text format) documents with Django?

2006-11-02 Thread Dirk Eschler

Am Donnerstag, 2. November 2006 12:33 schrieb carlwenrich:
> I'd like to allow a user (or at least an administrator) to edit an rtf
> document, and then render it within an html document the way php
> scripts are now doing.

You could integrate TinyMCE into Django's admin interface:

http://code.djangoproject.com/wiki/AddWYSIWYGEditor
http://www.dehora.net/journal/2006/05/using_tinymce_in_djangos_admin.html

-- 
Dirk Eschler <mailto:[EMAIL PROTECTED]>
http://www.krusader.org

--~--~-~--~~~---~--~~
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 email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Re: captcha problem

2006-10-31 Thread Dirk Eschler

Am Dienstag, 31. Oktober 2006 15:20 schrieb Dirk Eschler:
> In this case i would expect a TemplateSyntaxError. Since you don't get one,
> i suppose it is loaded.
>
> I tried to reproduce your error: i get empty captcha_* values when my
> captcha/urls.py is wrong. Judging from the code you have posted, i think it
> should look like:
>
> urlpatterns = patterns('anastas.apps.captcha.views',
> (r'^i/$', 'image'),
> (r'^json/$', 'json'),
> )

Uh wait, only the image is broken in this case.

Another thing to check, does pycaptcha write anything to your tmp dir? By 
default it seems to create the temporary image at /tmp/pycaptcha_1.

-- 
Dirk Eschler <mailto:[EMAIL PROTECTED]>
http://www.krusader.org

--~--~-~--~~~---~--~~
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 email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Re: captcha problem

2006-10-31 Thread Dirk Eschler

Am Dienstag, 31. Oktober 2006 14:24 schrieb Grigory Fateyev:
> Hello Aidas Bendoraitis!
>
> On Tue, 31 Oct 2006 12:11:00 +0100 you wrote:
> > Maybe your captcha template tag is not loaded? Did you put it in the
> > right place?
>
> Thanks for replay!
>
> I am sure templsate is in the right place:
> anastas/
> apps/
> captcha/
> templatetags/
> captcha.py
> urls.py
> utils.py
> views.py
>
> How to check if it load?

In this case i would expect a TemplateSyntaxError. Since you don't get one, i 
suppose it is loaded.

I tried to reproduce your error: i get empty captcha_* values when my 
captcha/urls.py is wrong. Judging from the code you have posted, i think it 
should look like:

urlpatterns = patterns('anastas.apps.captcha.views',
(r'^i/$', 'image'),
(r'^json/$', 'json'),
)

-- 
Dirk Eschler <mailto:[EMAIL PROTECTED]>
http://www.krusader.org

--~--~-~--~~~---~--~~
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 email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Re: Store uploaded image by id

2006-10-26 Thread Dirk Eschler

Am Mittwoch, 25. Oktober 2006 03:20 schrieb Malcolm Tredinnick:
> On Tue, 2006-10-24 at 19:10 +0200, Dirk Eschler wrote:
> > Hi,
> >
> > i'm trying to store an uploaded image in a directory named after its id.
> > Like in this simplified example:
> >
> > class Project(models.Model):
> > image = models.ImageField(upload_to='upload/projects/'+self.id)
> >
> > Since self isn't defined, how can i access the id?
>
> Some of these articles might help:
>
> http://groups.google.com/group/django-users/search?q=customizing+file
> +field+filename&
>
> Regards,
> Malcolm

Thanks for the responses.

What's a good place to keep custom Field classes like the AutoImageField? Do i 
just add them to the project root or a subdirectory and import them in the 
appropriate model, or is there a special directory where Django looks for 
them?

Best Regards,
Dirk Eschler

-- 
Dirk Eschler <mailto:[EMAIL PROTECTED]>
http://www.krusader.org

--~--~-~--~~~---~--~~
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 email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Store uploaded image by id

2006-10-24 Thread Dirk Eschler

Hi,

i'm trying to store an uploaded image in a directory named after its id. Like 
in this simplified example:

class Project(models.Model):
image = models.ImageField(upload_to='upload/projects/'+self.id)

Since self isn't defined, how can i access the id?

Best Regards,
Dirk Eschler

-- 
Dirk Eschler <mailto:[EMAIL PROTECTED]>
http://www.krusader.org

--~--~-~--~~~---~--~~
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 email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Re: Syntax highlighter

2006-10-21 Thread Dirk Eschler

Am Samstag, 21. Oktober 2006 16:31 schrieb James Bennett:
> On 10/21/06, Dirk Eschler <[EMAIL PROTECTED]> wrote:
> > does anyone use a generic syntax highlighter with Django? I want to
> > integrate something like GeSHi [1] in a blog-like application and i try
> > to find out where to start.
>
> I've been using dp.SyntaxHighlighter[1] (which is entirely JavaScript,
> and thus very easy to integrate) to highlight stuff on my blog for a
> while, and I've been pretty happy with it so far.
>
> [1] http://www.dreamprojections.com/SyntaxHighlighter/

Now that's quite an interesting approach.

Thank you!
Dirk

-- 
Dirk Eschler <mailto:[EMAIL PROTECTED]>
http://www.krusader.org

--~--~-~--~~~---~--~~
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 email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Re: Syntax highlighter

2006-10-21 Thread Dirk Eschler

Am Samstag, 21. Oktober 2006 15:13 schrieb Antonio Cavedoni:
> On 21 Oct 2006, at 12:04, Dirk Eschler wrote:
> > Hello, does anyone use a generic syntax highlighter with Django? I
> > want to integrate something like GeSHi [1] in a blog-like
> > application and i try to find out where to start.
>
> Incidentally, today I found out this Pygments library, which is a
> pure-Python syntax highlighter and looks very good from the outside
> (haven’t tried it yet):
>
> http://pygments.pocoo.org/
>
> This might be easier to integrate in a template tag, because you
> don’t need to call an external program to highlight some code, you
> just call the library function.
>
> Cheers.

Pygments looks very promising. Thanks alot for pointing it out.

Best Regards,
Dirk Eschler

-- 
Dirk Eschler <mailto:[EMAIL PROTECTED]>
http://www.krusader.org

--~--~-~--~~~---~--~~
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 email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Re: Syntax highlighter

2006-10-21 Thread Dirk Eschler

Am Samstag, 21. Oktober 2006 12:47 schrieb Malcolm Tredinnick:
> On Sat, 2006-10-21 at 12:04 +0200, Dirk Eschler wrote:
> > Hello,
> >
> > does anyone use a generic syntax highlighter with Django? I want to
> > integrate something like GeSHi [1] in a blog-like application and i try
> > to find out where to start.
> >
> > 1. http://qbnz.com/highlighter/
>
> Assuming you already know how to convert source text into marked-up text
> from the command line (or a program) using your tool of choice, using it
> in Django shouldn't be too hard. The most straightforward way would be
> to write a template filter to do the markup. This would be very similar
> to the tags in django/contrib/markup/ and you could use it as
>
> {{ source_code|highlight }}
>
> (assuming your filter is called "highlight"). This would run the markup
> highlighting each time you displayed the page, so for a lot of code or
> if the markup process was not particularly quick, performance may be an
> issue (needs timing, not guesswork, though). Still, it's a place to
> start.

The only Python based highlighter that outputs HTML i've found so far is 
SilverCity. Unfortunately not so well documentated. Are there any good 
alternatives?

The filter you describe is a nice solution if you know where the highlighted 
code goes in the template (i might need that as well). But what about dynamic 
content? Say i have a blog entry, where i want to be able to place code 
snippets into a textarea from within the admin interface, like in this 
example:

===
Lorem ipsum dolor sit amet, consectetuer adipiscing elit.


int i = 0;
[...]


Lorem ipsum dolor sit amet, consectetuer adipiscing elit.


foo = "bar"
[...]

===

I thought to overload the save() method of the particular model.

Not really Django related anymore: What would be the best way to parse the 
entry? I would probably try to use a simple XML parser for this task. Get the 
lang attribute for each code tag, replace the code tag itself with a valid 
xhtml tag, and let SilverCity create the inner HTML for the particular 
language.

Does that make any sense? :)

Thanks,
Dirk

-- 
Dirk Eschler <mailto:[EMAIL PROTECTED]>
http://www.krusader.org

--~--~-~--~~~---~--~~
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 email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Syntax highlighter

2006-10-21 Thread Dirk Eschler

Hello,

does anyone use a generic syntax highlighter with Django? I want to integrate 
something like GeSHi [1] in a blog-like application and i try to find out 
where to start.

1. http://qbnz.com/highlighter/

-- 
Dirk Eschler <mailto:[EMAIL PROTECTED]>
http://www.krusader.org

--~--~-~--~~~---~--~~
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 email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Re: print_r

2006-10-16 Thread Dirk Eschler

Am Sonntag, 15. Oktober 2006 00:01 schrieb [EMAIL PROTECTED]:
> I quite often plug in a nonsense command e.g. "fudge" just to raise the
> debug page, maybe with a few
>
> x = dir(some_var)
>
> .. to see what's in them. Once the Django debug page is up, you can
> have a really good poke around with things.
>
> The other alternative is the shell, which is great for working out what
> methods/attributes have, and tracking down the best way to use the
> DB-api etc.
>
> --Simon

How do you do that in the admin interface?

When i have a syntax error in my model, about all i get is a 404 and a note 
that the app/model wasn't found. Not very helpful to track down the source of 
the error. ;)

-- 
Dirk Eschler <mailto:[EMAIL PROTECTED]>
http://www.krusader.org

--~--~-~--~~~---~--~~
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 email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Re: Extending the user model

2006-10-13 Thread Dirk Eschler

Am Freitag, 13. Oktober 2006 13:58 schrieb Malcolm Tredinnick:
> Yes. Is there something you are trying to do that isn't accomplished by
> that method?

Ok now that i have tried, there is indeed something i can't accomplish. :) 
Here's a simplified version of my model:

class UserProfile(models.Model):
  academic_title = models.CharField(maxlength=255)
  user = models.ForeignKey(User, unique=True,
 edit_inline=models.STACKED,
 num_in_admin=1, min_num_in_admin=1,
 max_num_in_admin=1, num_extra_on_change=0)

Using the above code, i get a "User profile #1" fieldset at the bottom of the 
admin interface. Great so far, however, is it still possible to reorder the 
fields? As far as i understand i can't just use a inner Admin class in this 
case, can i?

I'm trying to achieve a field ordering like that:

Personal info
==
Academic title: []
First name: []
Last name:  []
E-mail address: []

Or in case this is impossible, i would like to put the "User profile" fieldset 
below the "Personal info" fieldset.

-- 
Dirk Eschler <mailto:[EMAIL PROTECTED]>
http://www.krusader.org

--~--~-~--~~~---~--~~
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 email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Re: Extending the user model

2006-10-13 Thread Dirk Eschler

Am Freitag, 13. Oktober 2006 13:58 schrieb Malcolm Tredinnick:
> On Fri, 2006-10-13 at 13:20 +0200, Dirk Eschler wrote:
> > Hello,
> >
> > is the method described at the below link still the recommended one?
> > http://www.b-list.org/weblog/2006/06/06/django-tips-extending-user-model
>
> Yes. Is there something you are trying to do that isn't accomplished by
> that method?

Thanks for the quick response. And sorry for not being more precise. I haven't 
tried it yet. Just wanted to be sure, that the article doesn't refer to an 
obsolete version of Django. It mentioned that things might change in future 
releases, model subclassing in particular.

Best Regards,
Dirk Eschler

-- 
Dirk Eschler <mailto:[EMAIL PROTECTED]>
http://www.krusader.org

--~--~-~--~~~---~--~~
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 email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Extending the user model

2006-10-13 Thread Dirk Eschler

Hello,

is the method described at the below link still the recommended one?
http://www.b-list.org/weblog/2006/06/06/django-tips-extending-user-model

-- 
Dirk Eschler <mailto:[EMAIL PROTECTED]>
http://www.krusader.org

--~--~-~--~~~---~--~~
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 email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Re: Count clicks

2006-10-10 Thread Dirk Eschler

Am Montag, 9. Oktober 2006 09:07 schrieb Holger Schurig:
> > agreed, in a perfect world i would parse the log files. But
> > sometimes you don't have access to a cron daemon.
>
> In this case you should read the database API documentation page.
> Then your code looks something like this:
>
> from django.shortcuts import get_object_or_404
> from my.models import MyObj
>
> def detail(post_id):
> myobj = get_object_or_404(MyObj, id=post_id)
> myobj.count += 1
> myobj.save()

Allright, thank you! Somehow it felt wrong to put it into the view.

In this case the FAQ helped to understand. :)
http://www.djangoproject.com/documentation/faq/#django-appears-to-be-a-mvc-framework-but-you-call-the-controller-the-view-and-the-view-the-template-how-come-you-don-t-use-the-standard-names

-- 
Dirk Eschler <mailto:[EMAIL PROTECTED]>
http://www.krusader.org

--~--~-~--~~~---~--~~
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 email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Translation not loaded

2006-10-08 Thread Dirk Eschler

Hello,

i can't get my project translation to load. Original strings are in English. I 
switch the language to "de" with set_language (like described in the i18n 
doc). Checked it with "get_current_language" in the template, which 
outputs "de" as expected. My strings however are still in English and i have 
no idea what i'm doing wrong.

---
- The translation is in place:
$ cd ${my_project_dir}
$ ls conf/locale/de/LC_MESSAGES/django.*
conf/locale/de/LC_MESSAGES/django.mo  conf/locale/de/LC_MESSAGES/django.po

- My settings.py:
MIDDLEWARE_CLASSES = (
'django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.locale.LocaleMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.middleware.doc.XViewMiddleware',
)
gettext = lambda s: s
LANGUAGES = (
('de', gettext('German')),
('en', gettext('English')),
)

- My view:
def index(request):
post_list = Post.objects.all().order_by('date')[:5]
return render_to_response('base_frontpage.html', {
'post_list': post_list,
},
context_instance=RequestContext(request)
)
---

Anything that i have missed?

Best Regards,
Dirk Eschler

-- 
Dirk Eschler <mailto:[EMAIL PROTECTED]>
http://www.krusader.org

--~--~-~--~~~---~--~~
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 email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Re: Ajax

2006-10-08 Thread Dirk Eschler

Am Samstag, 7. Oktober 2006 23:38 schrieb MerMer:
> I'm using a default local installation on a Windows XP machine, running
> Firefox 1.5
>
> When I try the following URL
> http://localhost:8000/media/js/textareas.js  I get a message saying
> that the file cannot be found on the following (notice the slashes)
>
> C:\Python24\lib\site-packages\django_src\django/contrib/admin/media\js/test
>area.js

I'm truely no big help with windows, however, to me it seems that the file 
isn't readable. How do you serve your media files?

During development i'm using the method described here:
http://www.djangoproject.com/documentation/static_files/

Make sure to read the disclaimer. ;)

> However, when I go to localhost:8000/admin and then look in the source
> of the generated web pages it seems clear to that the files are in
> correct directory.
>
> It's probably something stupid,  I am doing here ?. I'm very new to
> Django and still trying to find my way around.

Ok, these are two different things. The path might be correct, but if the 
webserver doesn't serve the file, nothing will happen.

-- 
Dirk Eschler <mailto:[EMAIL PROTECTED]>
http://www.krusader.org

--~--~-~--~~~---~--~~
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 email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Re: Ajax

2006-10-07 Thread Dirk Eschler

Am Samstag, 7. Oktober 2006 22:05 schrieb MerMer:
> I can't get it to work either.  I've tried both setttings.  I followed
> Bill de hÓra  detailed screen shots about where to install TinyMCE.
>
> My admin code inside my model has:-
> js = ['tiny_mce/tiny_mce.js', 'js/textareas.js']
>
> Checking the source code from the returned HTML shows that the
> Javascript is being parsed correctly to where the files are stored.
>
> 
> 
>  
>
> However,  I'm not getting anything.  Anybody have any ideas where I
> might be going wrong?
>
> MerMer

Ok you've surely checked, but i have to ask anyway. :)
Are the files really readable, e.g. does 
http://www.yoursite.com/media/js/textareas.js show up in your browser?

Oh and which browser do you use? Konqueror (and probably Safari too) don't 
work with tinyMCE.

-- 
Dirk Eschler <mailto:[EMAIL PROTECTED]>
http://www.krusader.org

--~--~-~--~~~---~--~~
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 email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Re: Count clicks

2006-10-07 Thread Dirk Eschler

Am Samstag, 7. Oktober 2006 18:47 schrieb Martin Winkler:
> Hi,
>
> > In my model i have an IntegerField called "count". What would be a
> > good way to increment the post with post_id=1 when someone
> > accesses "http://www.mysite.com/news/1;? Resp. where do i put my code?
>
> I can see here two issues:
> It's generally a bad idea to update anything in the database without a
> POST form. (see tutorial 4, "vote()" function)
>
> Second, you do a database-update whenever an anonymous user views a
> page - this can be a major performance issue.
>
> Why don't you run a cronjob asynchronously - say: once every hour or
> day, that checks your webserver's access log and updates all relevant
> numbers in one session?
>
> just my 2eurocents,
>
> Martin

Hi Martin,

agreed, in a perfect world i would parse the log files. But sometimes you 
don't have access to a cron daemon.

Basically i'm trying to get a better idea of how Django works (still pretty 
new to me), and in this case, how to react on a request. The count was just 
the first example that came to my mind. :)

Anyway, thanks for the pointer to part 4 of the tutorial. I had to re-read it 
and think i got it now.

Best Regards,
Dirk Eschler

-- 
Dirk Eschler <mailto:[EMAIL PROTECTED]>
http://www.krusader.org

--~--~-~--~~~---~--~~
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 email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Count clicks

2006-10-07 Thread Dirk Eschler

Hi,

i've started working on a very simple news app (still learning). Now i want to 
count the hits a topic gets. My url pattern looks like this:

urlpatterns = patterns('foo.news.views',
(r'^$', 'index'),
(r'^(?P\d+)/$', 'detail'),
)

In my model i have an IntegerField called "count". What would be a good way to 
increment the post with post_id=1 when someone 
accesses "http://www.mysite.com/news/1;? Resp. where do i put my code?

Best Regards,
Dirk Eschler

-- 
Dirk Eschler <mailto:[EMAIL PROTECTED]>
http://www.krusader.org

--~--~-~--~~~---~--~~
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 email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Re: Ajax

2006-10-07 Thread Dirk Eschler

Am Samstag, 7. Oktober 2006 14:14 schrieb Ramdas S:
> Hi,
>
> .Aanyone integrated dojo or any other Ajax tool kit with admin interface. I
> need a simple Rich Text Box for the body editor fpr a blog. I tried
> TinyMCE. It is not working.
>
> Thanks
>
> Ramdas

What exactly have you tried to get TinyMCE working?

Today i tried the same, followed the below howto and got it working with no 
hassle. Just make sure to double check the script tags for a wrong path to 
the js files.

http://code.djangoproject.com/wiki/AddWYSIWYGEditor


-- 
Dirk Eschler <mailto:[EMAIL PROTECTED]>
http://www.krusader.org

--~--~-~--~~~---~--~~
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 email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Re: Reload Admin interface after model changes

2006-10-07 Thread Dirk Eschler

Am Samstag, 7. Oktober 2006 02:57 schrieb Matt:
> It is probably number 2. I'm using apache2 w/ mod_python. I'll check
> when I'm back at work next.
>
> As for what I did to dump the old app, I deleted the application folder
> and then recreated everything using manage.py startapp.
>
> Thanks for the quick reply. I'll post here again to confirm that it was
> a problem with not restarting apache.
>
> Matt

Hi Matt,

like mentioned in the docs, for a development server you should 
set "MaxRequestsPerChild 1" in your Apache config. That worked for me.

http://www.djangoproject.com/documentation/modpython/

Best Regards,
Dirk Eschler

-- 
Dirk Eschler <mailto:[EMAIL PROTECTED]>
http://www.krusader.org

--~--~-~--~~~---~--~~
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 email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Re: HTML entities

2006-10-06 Thread Dirk Eschler

Am Donnerstag, 5. Oktober 2006 23:11 schrieb Ivan Sagalaev:
> Dirk Eschler wrote:
> > In theory i can just use utf-8, but what if one participant in the line
> > (os, db, browser, whatever) can't handle it?
>
> Talking about client side, only very old browsers can't handle utf-8
> (NN4 and IE4 can). Same goes for email clients. And even such simple and
>   'legacy' software as Windows' Notepad can read and write utf-8 files
> since year 2000.
>
> And talking about server side that store and transfer your data, this is
> also safe as utf-8 was specifically designed to be compatible with old
> software that treats characters as bytes.
>
> All this means that currently in most cases there is no reason to do
> things in anything but utf-8 (edge cases where you can't do this are
> cases like shared DB server in some legacy encoding that you can't change).
>
> > Encodings stay one of those long time
> > mysteries to me. I'd happily adopt a practice that's fool proof.
>
> Unicode and utf-8 is specifically designed to eliminate all these
> encoding problems, to be the one universal encoding (though many
> Japanese developers don't think Unicode suits this goal).

Jup, i just stumbled into encoding problems with utf-8 pretty often. And that 
were situations where i thought that i didn't make any mistake. Mostly 
desktop related though, using older toolkits etc..

Nonetheless, i think it's about time to drop old habids and give utf-8 another 
try. Thanks everyone!

-- 
Dirk Eschler <mailto:[EMAIL PROTECTED]>
http://www.krusader.org

--~--~-~--~~~---~--~~
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 email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Re: HTML entities

2006-10-06 Thread Dirk Eschler

Am Freitag, 6. Oktober 2006 09:48 schrieb Holger Schurig:
> > >   
>
> Oh, I just noticed this with Konqueror from KDE 3.5.4: you can
> have this meta line in your base.html template as long as you
> want. When you use "./manage.py runserver", it won't be honored,
> the value from DEFAULT_CHARSET from settings.py takes
> precedence.

Aha! Funny you should mention that. I've run into the same problem yesterday 
(Konq is my main browser). It's one of those things that fuels my confusion 
about encodings. :)

-- 
Dirk Eschler <mailto:[EMAIL PROTECTED]>
http://www.krusader.org

--~--~-~--~~~---~--~~
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 email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Re: HTML entities

2006-10-05 Thread Dirk Eschler

Am Donnerstag, 5. Oktober 2006 16:04 schrieb Holger Schurig:
> > ä -> 
> > Ö -> 
> > ß -> 
>
> Do you really need them?  Theoretically, you can simply set
>
>   
>
> And then you may use those characters literally.
>
> However, I'm not a browser expert and don't know if all modern
> browsers under the sun understand this.

Hi Holger,

i'm not sure if i really need them. In fact that's my main problem. :|

In theory i can just use utf-8, but what if one participant in the line (os, 
db, browser, whatever) can't handle it? Encodings stay one of those long time 
mysteries to me. I'd happily adopt a practice that's fool proof.

Thank you,
Dirk Eschler

-- 
Dirk Eschler <mailto:[EMAIL PROTECTED]>
http://www.krusader.org

--~--~-~--~~~---~--~~
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 email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



HTML entities

2006-10-05 Thread Dirk Eschler

Hi,

in PHP *shrug* i used to pipe user input through htmlentities() before i 
stored it in a database. Basically to avoid encoding issues with German 
special chars.

ä -> 
Ö -> 
ß -> 
etc.

How can i achieve this when defining a model in Django? Or is it a bad pratice 
and there's a better way? Sorry if this is obvious, but i can't seem to find 
a good answer.

Best Regards,
Dirk Eschler

-- 
Dirk Eschler <mailto:[EMAIL PROTECTED]>
http://www.krusader.org

--~--~-~--~~~---~--~~
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 email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Re: Localizing dynamic content through the admin interface

2006-10-03 Thread Dirk Eschler

Am Dienstag, 3. Oktober 2006 19:32 schrieb Steven Armstrong:
> On 10/03/06 19:14, Dirk Eschler wrote:
> > Hello,
> >
> > please let me first point out that i'm new to Django. I have experience
> > with gettext, but only in non-webapp environments.
> >
> > I've read through the i18n doc and am quite impressed about the gettext
> > support. I just wonder how you usually handle dynamic content.
> > Clients/Users often want to localize the content they add right in the
> > admin interface. Are there any hooks in Django that make it easier?
> >
> > The simplest way i see, is to use separate columns for each language
> > (e.g. title_en, title_de) in my models. Is there a better approach?
>
> Not a complete solution, but maybe gets you started.
>
> http://djangoutils.python-hosting.com/wiki/TranslationService

Thank you, looks interesting. I will give it a try...

By the way, it seems that the project has been moved to another location:
http://trac.studioquattro.biz/djangoutils/wiki/TranslationService

Best Regards,
Dirk Eschler

-- 
Dirk Eschler <mailto:[EMAIL PROTECTED]>
http://www.krusader.org

--~--~-~--~~~---~--~~
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 email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Localizing dynamic content through the admin interface

2006-10-03 Thread Dirk Eschler

Hello,

please let me first point out that i'm new to Django. I have experience with 
gettext, but only in non-webapp environments.

I've read through the i18n doc and am quite impressed about the gettext 
support. I just wonder how you usually handle dynamic content. Clients/Users 
often want to localize the content they add right in the admin interface. Are 
there any hooks in Django that make it easier?

The simplest way i see, is to use separate columns for each language (e.g. 
title_en, title_de) in my models. Is there a better approach?

Best Regards,
Dirk Eschler

-- 
Dirk Eschler <mailto:[EMAIL PROTECTED]>
http://www.krusader.org

--~--~-~--~~~---~--~~
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 email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---