Django Channels tests: Task x got Future y attached to a different event loop
Hi everyone, I have a question regarding Django Channels testing. I've asked the question before on StackOverflow, so more info can be found here: https://stackoverflow.com/questions/74154013/django-channels-tests-task-x-got-future-y-attached-to-a-different-event-loop Any help would be greatly appreciated :). Jens -- 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 view this discussion on the web visit https://groups.google.com/d/msgid/django-users/859dfa39-e323-41c8-bccd-4e49d523fabcn%40googlegroups.com.
Re: Django admin application for Android
Hi Alexandre, the app is written in Kotlin. Looked for using flutter but the webview support is not quite there yet.. Op woensdag 17 juli 2019 17:26:04 UTC+2 schreef Alexandre Guignard: > > That's cool, thanks > Which langage do You use for the app ? -- 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 view this discussion on the web visit https://groups.google.com/d/msgid/django-users/4e27ac91-ffd4-4bfa-9c8c-5d4c27ba87a2%40googlegroups.com.
Re: Django admin application for Android
Hi Derek, The GOLD plan is for users who want to manage multiple projects. On top of that they get some other benefits like using shortcuts and rearranging the order of the models. This is $0.99 per month as a way to support my development :-) Kind regards Op woensdag 17 juli 2019 08:11:56 UTC+2 schreef Derek: > > Can you explain more about the GOLD plan - what is it and how much does it > cost? > > On Monday, 15 July 2019 12:51:58 UTC+2, Jens-Joris Decorte wrote: >> >> Hello Django developers! >> >> Being both a Django developer and a heavy user of Django applications, I >> found myself accessing the admin interface of my Django sites quite often >> via my smartphone when I am on the road. >> I was stoked to see the new responsive admin since Django 2.0, which made >> this process much smoother. >> >> Lately I've been developing an *Android app* to access your site's >> admin. It ports the *responsive design to ALL Django versions* and >> includes even more features to make the experience very mobile friendly. >> I have just released this app on the Google Play Store >> <https://play.google.com/store/apps/details?id=com.jjdc.djangoadmin> so >> feel free to check it out or to share it with other Django developer / >> users. Any feedback will also be appreciated! >> >> The app can be found here: >> https://play.google.com/store/apps/details?id=com.jjdc.djangoadmin >> >> [image: Django-admin-1] >> <https://play.google.com/store/apps/details?id=com.jjdc.djangoadmin> [image: >> Django-admin-2.jpg] >> <https://play.google.com/store/apps/details?id=com.jjdc.djangoadmin> >> > -- 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 view this discussion on the web visit https://groups.google.com/d/msgid/django-users/fbd4f7b2-4ae7-4ac2-b8fe-a7839d3f0d1d%40googlegroups.com.
Re: Django admin application for Android
Hi Derek, The GOLD plan is for users who want to manage multiple projects. On top of that they get some other benefits like using shortcuts and rearranging the order of the models. This is $0.99 per month as a way to support my development :-) Kind regards Op woensdag 17 juli 2019 08:11:56 UTC+2 schreef Derek: > > Can you explain more about the GOLD plan - what is it and how much does it > cost? > > On Monday, 15 July 2019 12:51:58 UTC+2, Jens-Joris Decorte wrote: >> >> Hello Django developers! >> >> Being both a Django developer and a heavy user of Django applications, I >> found myself accessing the admin interface of my Django sites quite often >> via my smartphone when I am on the road. >> I was stoked to see the new responsive admin since Django 2.0, which made >> this process much smoother. >> >> Lately I've been developing an *Android app* to access your site's >> admin. It ports the *responsive design to ALL Django versions* and >> includes even more features to make the experience very mobile friendly. >> I have just released this app on the Google Play Store >> <https://play.google.com/store/apps/details?id=com.jjdc.djangoadmin> so >> feel free to check it out or to share it with other Django developer / >> users. Any feedback will also be appreciated! >> >> The app can be found here: >> https://play.google.com/store/apps/details?id=com.jjdc.djangoadmin >> >> [image: Django-admin-1] >> <https://play.google.com/store/apps/details?id=com.jjdc.djangoadmin> [image: >> Django-admin-2.jpg] >> <https://play.google.com/store/apps/details?id=com.jjdc.djangoadmin> >> > -- 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 view this discussion on the web visit https://groups.google.com/d/msgid/django-users/be43dd1b-9297-429e-b029-e8c18b2398b9%40googlegroups.com.
Re: Django admin application for Android
Hi Derek, The GOLD plan is for users who want to manage multiple projects. On top of that they get some other benefits like using shortcuts and rearranging the order of the models. This is $0.99 per month as a way to support my development :-) Kind regards Op woensdag 17 juli 2019 08:11:56 UTC+2 schreef Derek: > > Can you explain more about the GOLD plan - what is it and how much does it > cost? > > On Monday, 15 July 2019 12:51:58 UTC+2, Jens-Joris Decorte wrote: >> >> Hello Django developers! >> >> Being both a Django developer and a heavy user of Django applications, I >> found myself accessing the admin interface of my Django sites quite often >> via my smartphone when I am on the road. >> I was stoked to see the new responsive admin since Django 2.0, which made >> this process much smoother. >> >> Lately I've been developing an *Android app* to access your site's >> admin. It ports the *responsive design to ALL Django versions* and >> includes even more features to make the experience very mobile friendly. >> I have just released this app on the Google Play Store >> <https://play.google.com/store/apps/details?id=com.jjdc.djangoadmin> so >> feel free to check it out or to share it with other Django developer / >> users. Any feedback will also be appreciated! >> >> The app can be found here: >> https://play.google.com/store/apps/details?id=com.jjdc.djangoadmin >> >> [image: Django-admin-1] >> <https://play.google.com/store/apps/details?id=com.jjdc.djangoadmin> [image: >> Django-admin-2.jpg] >> <https://play.google.com/store/apps/details?id=com.jjdc.djangoadmin> >> > -- 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 view this discussion on the web visit https://groups.google.com/d/msgid/django-users/56e4363e-85b4-401d-864f-eb14bb559366%40googlegroups.com.
Problem with django.contrib.session datetimes after Django upgrade
Hi, I upgraded from Django 1.7.x to 1.9.5 and now get sporadic errors like this that come from the django.contrib.sessions module (the full stack trace is below): Exception Type: ValueError at /subscriptions/ Exception Value: make_aware expects a naive datetime, got 2016-04-21 23:26:19.247888+00:00 Sporadic in the sense that when I visit the site and get the error, I can refresh and it is gone. If I wait for a while (e.g. the next day) and go to the site again, the error is back once and then goes away again if I refresh. I haven't figured out the timespan I need to wait before the error reappears yet, but assume it has to do with caching. I think it cannot be a problem with my own code, as the stack trace only contains stock Django functionality and my own code doesn't directly access or meddle with the Session models. If I understand correctly, Session objects are selected from the database with a filter on their expire_date, and at some point, this expire_date datetime object should be converted from native to aware, which fails because it is aware already. My first assumption was that there was a change from Django 1.7 to 1.9 and that the objects already saved in the database with Django 1.7 code are no longer compatible with Django 1.9. So I deleted all Session objects from the database and then start a new session by logging in again. However, the resulting Session object also has an expire_date which is aware already, so it would run into the same problem again. I use sqlite as the database backend, if that's relevant. Any idea what the problem might be? Thanks in advance! Jens -- ValueError at /subscriptions/ make_aware expects a naive datetime, got 2016-04-21 23:26:19.247888+00:00 Request Method: GET Request URL: https://.../subscriptions/ Django Version: 1.9.5 Python Executable: /usr/bin/python Python Version: 2.7.3 Python Path: ['/root/.virtualenvs/django19/lib/python2.7/site-packages', '/var/www/MYAPP', '/usr/lib/python2.7', '/usr/lib/python2.7/plat-linux2', '/usr/lib/python2.7/lib-tk', '/usr/lib/python2.7/lib-old', '/usr/lib/python2.7/lib-dynload', '/usr/local/lib/python2.7/dist-packages', '/usr/lib/python2.7/dist-packages', '/usr/lib/pymodules/python2.7'] Server time: Fri, 15 Apr 2016 21:02:49 +0200 Installed Applications: ('django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'django.contrib.sites', 'MYAPP', 'django_extensions', 'debug_toolbar') Installed Middleware: ('django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.auth.middleware.SessionAuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware') Traceback: File "/root/.virtualenvs/django19/lib/python2.7/site-packages/django/core/handlers/base.py" in get_response 149. response = self.process_exception_by_middleware(e, request) File "/root/.virtualenvs/django19/lib/python2.7/site-packages/django/core/handlers/base.py" in get_response 147. response = wrapped_callback(request, *callback_args, **callback_kwargs) File "/root/.virtualenvs/django19/lib/python2.7/site-packages/django/contrib/auth/decorators.py" in _wrapped_view 22. if test_func(request.user): File "/root/.virtualenvs/django19/lib/python2.7/site-packages/django/contrib/auth/decorators.py" in 46. lambda u: u.is_authenticated(), File "/root/.virtualenvs/django19/lib/python2.7/site-packages/django/utils/functional.py" in inner 204. self._setup() File "/root/.virtualenvs/django19/lib/python2.7/site-packages/django/utils/functional.py" in _setup 351. self._wrapped = self._setupfunc() File "/root/.virtualenvs/django19/lib/python2.7/site-packages/django/contrib/auth/middleware.py" in 22. request.user = SimpleLazyObject(lambda: get_user(request)) File "/root/.virtualenvs/django19/lib/python2.7/site-packages/django/contrib/auth/middleware.py" in get_user 10. request._cached_user = auth.get_user(request) File "/root/.virtualenvs/django19/lib/python2.7/site-packages/django/contrib/auth/__init__.py" in get_user 167. user_id = _get_user_session_key(request) File "/root/.virtualenvs/django19/lib/python2.7/site-packages/django/contrib/auth/__init__.py" in _get_user_session_key 59. return get_user_model()._meta.pk.to_python(request.session[SESSION_KEY]) File "/root/.virtualenvs/django19/lib/python2.7/site-packages/django/contrib/sessions/backends/base.py" in __getitem__ 48. return self._session[key] File "/root
custom model fields with to_python()/from_db_value() for different django version...
("Moved" from django-developers list) Am 17.06.2015 um 16:48 schrieb charettes:> Hi Jens, > > I'm not sure I understand what you are trying to achieve but I assume you want > to write a third-party field that supports both Django 1.7 and 1.8 without > raising deprecating warnings? > > I suggest you use the following pattern which also accounts for py2/3: > > import django > from django.db import models > from django.utils.six import with_metaclass > > MyFieldBase = type if django.VERSION >= (1, 8) else models.SubfieldBase > > class MyField(with_metaclass(MyFieldBase, models.Field)): > def from_db_value(self, value, expression, connection, context): > pass > > def to_python(self, value): > pass > > This is stepping into the django-user@ territory so I suggest we move the > discussion over there if the provided example doesn't match your needs but you > are really just trying to write a portable third-party field. Yes, that's my problem. Maybe i should better check with """hasattr(models, "SubfieldBase")""" instead of testing the version number?!? Is this a good fallback to use 'type' ?!? What's about this: """ import django from django.db import models from django.utils.six import with_metaclass if hasattr(models, "SubfieldBase"): _class_args = with_metaclass(models.SubfieldBase, models.Field) else: _class_args = (models.Field,) class MyField(*_class_args): def from_db_value(self, value, expression, connection, context): pass def to_python(self, value): pass """ Not tested. > Le mercredi 17 juin 2015 06:25:09 UTC-4, Jens Diemer a écrit : > > Am 16.06.2015 um 18:43 schrieb Tim Graham: > > The doc about how to ignore warnings in tests is here: > > > https://docs.djangoproject.com/en/dev/internals/contributing/writing-code/submitting-patches/#deprecating-a-feature > <https://docs.djangoproject.com/en/dev/internals/contributing/writing-code/submitting-patches/#deprecating-a-feature> > > > > > Alternatively, you can temporarily remove these lines in runtests.py: > > > > warnings.simplefilter("error", RemovedInDjango20Warning) > > warnings.simplefilter("error", RemovedInDjango21Warning) > > Thanks! > > But then, there can't exists tests that will raise a warning while importing > ?!? > > > > > So i try to make it clear: > > With v1.7 the "__metaclass__ = models.SubfieldBase" is needed. So i remove the > tests without it. > > And i found a existing Bug https://code.djangoproject.com/ticket/9619 > <https://code.djangoproject.com/ticket/9619> for: > > to_python not called when fetching data with .values(...) > > > I update the tests and create a ticket and pull request here: > * https://code.djangoproject.com/ticket/24993 > <https://code.djangoproject.com/ticket/24993> > * https://github.com/django/django/pull/4874 > <https://github.com/django/django/pull/4874> > > I can also made pull request for v1.8.x and master... > > > > > > I also found the Solution for: "to_python() didn't call with Python 3": > The "__metaclass__" syntax changed in Python 3. > > The Problem: I didn't read the doc carefully here: > > https://docs.djangoproject.com/en/1.7/howto/custom-model-fields/#the-subfieldbase-metaclass > <https://docs.djangoproject.com/en/1.7/howto/custom-model-fields/#the-subfieldbase-metaclass> > > > There are three code examples: > * for Python 2 only > * for Python 3 only > * for Python 2+3 using six.with_metaclass() > > What's about to remove the first two examples and leave only the > six.with_metaclass() example?!? > > I made also a ticket/pull request for this: > * https://code.djangoproject.com/ticket/24992 > <https://code.djangoproject.com/ticket/24992> > * https://github.com/django/django/pull/4873 > <https://github.com/django/django/pull/4873> > > > > > > > > > > > > > > > On Tuesday, June 16, 2015 at 12:30:05 PM UTC-4, Jens Diemer wrote: > > > > > > I try to create a custom model field, that should "Converting values > to Python > > objects" as described in the documentation here: > > > > > <https://docs.djangoproject.com/en/dev/howto/custom-model-fields/#convertin
Re: phpBB3 to DjangoBB migration...
jens wrote: > The last thing to migrate is the topic subscriptions, but django can't > handle the model. See: https://github.com/jedie/django-phpBB3/issues/5 This is now implemented with commit: https://github.com/jedie/django-phpBB3/commit/2c4835fceb1c7dc8df30b1ef50b2cc06d4425f5c So i think everything is done to migrate a phpBB forum to DjangoBB ;) Mfg. Jens -- 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: phpBB3 to DjangoBB migration...
We improve the migration. Seems that the most work is done! The last thing to migrate is the topic subscriptions, but django can't handle the model. See: https://github.com/jedie/django-phpBB3/issues/5 On 20 Jul., 15:27, jens <google-c...@jensdiemer.de> wrote: > Anyone who interest the migration from phpBB3 to DjangoBB should take > a look at > my project: > > https://github.com/jedie/django-phpBB3 -- 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.
phpBB3 to DjangoBB migration...
Hi... Anyone who interest the migration from phpBB3 to DjangoBB should take a look at my project: https://github.com/jedie/django-phpBB3 There i worked on a migration script. What is django-phpBB3 ? --- """ Django-phpBB3 provides the database models of a existing phpBB3 installation for easy migration into a other forum software. It's not a phpBB clone or a forum! Warning: In the current state, it's not guaranteed that changes trough the django admin will work with phpBB3! So in the current state, access 'read-only' to the data Patches are welcome! Please send pull requests. """ -- Mfg. Jens Diemer -- 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.
Call to manager._insert() in save_base() returns None
Hi, I'm seeing some really weird behaviour when saving new instances of certain models. After calling save() the instance's primary key isn't set, despite the data having been inserted properly, and if I fetch the newest instance of the model in question I get the expected result, I get the data I just saved. After some digging I discovered that this happens due to the call to manager._insert() in save_base() in the Model class (either on line 553 or line 556 in django/db/models/base.py ) returning None, while it should have returned the primary key of the newly inserted row. So, anyone have any ideas about why this could be happening? This for instance happens with the following model, but I've seen it happen with other models as well: class Message(models.Model): type = models.IntegerField(default=MessageType.INTERNAL, choices=MessageType) subject = models.CharField(max_length=128, verbose_name=__("Subject")) body = models.TextField(verbose_name='') sender = models.ForeignKey(User, editable=False, null=True, related_name='ge_message') sms_from = models.CharField(max_length=11, null=True, editable=False) created = models.DateTimeField(auto_now_add=True, editable=False) flag = models.CharField(max_length=1, editable=False, default=flags.CREATED) premium_sum = models.PositiveIntegerField(default=0, editable=False, blank=True) premium_codeword = models.CharField(max_length=32, editable=False, blank=True, null=True) billable_type = models.ForeignKey(ContentType, null=True, editable=False) billable_id = models.IntegerField(null=True, editable=False) billable = generic.GenericForeignKey('billable_type', 'billable_id') And the environment is: Django 1.3, Python 2.4.3 (RHEL 5), Postgres 8.1, using the postgresql_psycopg2 backend. -- mvh Jens Ådne Rydland -- 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.
ANN: PyLucid CMS v0.9
After a long time, we released PyLucid CMS in Version v0.9! The main goals are: * internationalization and localization support (Multilingual content) * Multi site support (Allows a single installation to serve multiple websites.) * Revision controlled content Please follow the install instruction on our Homepage: http://www.pylucid.org/ A DEMO page is also available here: http://demo.pylucid.net/ -- 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: I need help
Hi Hussain, Please be more descriptive in your subject line next time. It makes it easier for everyone subscribed to the list to acknowledge if the message is something is of interest or not. Thank you, Jens On 14 Maj, 10:51, Hussain Deikna <dei...@gmail.com> wrote: > Hi, > I plan to start writing my web page and I decide to use django and sqlite3 > , my web page is very simple it is look like : > 1- homepage a main page for public 'main page'. > 2- user login and it will display special information to every to group of > users > 3- admen side. > I need help in part 2 which django application I have to use? > thank you -- 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: django-weave needs contribution...
Am 07.03.2010 20:15, schrieb Jens: I started http://code.google.com/p/django-weave/ a Django reuseable Application witch implements a Firefox weave server. The Project is in planning/pre-alpha state. If anyone has interest to help, please contact me! Bookmark sync works now, since: http://code.google.com/p/django-weave/source/detail?r=41 -- Mfg. Jens Diemer http://www.jensdiemer.de -- 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: Thread safe language switching?
Hi Michal, I'm not sure, but I would write the verbose names manually for each field, wrapping each string inside a ugettext(...) function call like so: class Poll(models.Model): ... field = models.CharField(ugettext("My verbose name"), max_length=40) ... Thay way I could just use the normal './manage.py makemessages' to extract the translatable strings. Regards, Jens On Mar 8, 2:28 pm, Plovarna <mic...@plovarna.cz> wrote: > Hello, > I just developing my first aplication with internationalization. I need to > get all verbose_name values of the model for each language defined in > settings.LANGUAGES. I do it by this code defined inside model method : > > current_lang = get_language() > names = {} > for lang in settings.LANGUAGES: > activate(lang[0]) > class_name = unicode(self.__class__._meta.verbose_name) > names.append(class_name) > deactivate() > activate(current_lang) > > My question is: Is this approach thread safe? Is there any other way how to > get verbose_name of the model for each defined language? > > Thank you for any advice > Michal -- 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: django-weave needs contribution...
Am 08.03.2010 07:44, schrieb Rizwan Mansuri: I am happy to help you but my experience with django is very much like starting level. Is that something helps you? You are welcome ;) -- Mfg. Jens Diemer http://www.jensdiemer.de -- 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.
django-weave needs contribution...
I started http://code.google.com/p/django-weave/ a Django reuseable Application witch implements a Firefox weave server. The Project is in planning/pre-alpha state. If anyone has interest to help, please contact me! Mfg. Jens -- 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: CI for Django projects
Hi, you could try TeamCity. I've written some short instructions (in german) here: http://www.jan0sch.de/wissen/teamcity-django-python-tests You'll need an extension for python, a custom test runner and the appropriate build configuration for TeamCity. We are using this for some months now and it works. Regards, Jens -- 19. Hornung 2010, 19:38 Homepage : http://www.jan0sch.de BOFH excuse #33: piezo-electric interference pgp3IkkNCQECX.pgp Description: PGP signature
Re: Table with 4 Milions of rows
Hi Nameless, On Jan 12, 9:20 pm, nameless <xsatelli...@gmail.com> wrote: > The table is queried from ajax using an autocomplete field with this > query in the views.py: > > books.objects.filter(book_title__istartswith=request.GET['q'])[:100] This should not be a problem in MySQL either if you are using an index for the string field. MySQL string indices creates a tree with the first letter as the top node, which means your lookup will be extremely fast when using an iindex. As someone else said, using memcache or similar on top of that should make the search fast enough. That said, the size of a table is rarely the problem. It is rather how you choose you indices and what to cache. Jens -- 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: DeprecationWarning: Non-ASCII character in models.py
I got the same message the other day and the solution was to put following line at the top (first line, befor everything else) of my models.py: #coding: utf8 worked for me, hope it'll work for you. Jens On 30 Sep., 13:07, Nick <[EMAIL PROTECTED]> wrote: > Hi, > > I've recently noticed that I'm getting the following in my Apache > error log... > > DeprecationWarning: Non-ASCII character '\xc2' in file /var/www/django/ > newsite/web/models.py on line 101, but no encoding declared; > seehttp://www.python.org/peps/pep-0263.htmlfor details > > Line 101 in my models.py file contains... > > price_per_week = models.CharField(max_length=100, blank=True, > help_text="Calculate average price per week. Include > £ prefix.Example: \"£150\", > \"£300-£320\", \"£100+\"") > > I'm guessing it's something to do with the help_text, specifically the > £ symbol. > > Can anybody shed some light on how I can fix this, presumably I need > to declare an encoding, or there is an encoding mismatch going on > somewhere? > > Thanks, > Nick --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
ManyToMany relation and admin newforms
Hello django-users, after searching google and this group and not finding any helpful answers I hope you can help me. I am making an event-app which allows me to manage my own events I organize for me and my friends. I add my friends to the database. Then I create an event and choose which friends I want to invite. The app sends mails to these friends with a url to the event. They can decide by their own if they want to join. There are a model for events and for attendees. In addition I made an intermediary table by myself: Code: - class EventAttendeeList(models.Model): event_id = models.ForeignKey(Event) attendee_id = models.ForeignKey(Attendee) is_enrolled = models.BooleanField(default=False, editable=False) class Meta: db_table = 'events_attendee_list' - If a friend of mine decides to attend he checks his own name in a list of possible attendees (yes I trust my dudes). So I dont really need to edit the "is_enrolled" field in admin. The default m2m widget with the multiple-select field was perfect : ( But now its gone and I have to use this inline stuff: Code: - class AttendeeListInline(admin.TabularInline): model = EventAttendeeList class EventAdmin(admin.ModelAdmin): inlines = [AttendeeListInline,] admin.site.register(Event, EventAdmin) - I only want the default widget back :( Does anyone know how to achieve that without much work? I want to keep things simple. Thank you so far Jens from Germany --~--~-~--~~~---~--~~ 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' object has no attribute 'user'
Seems that the session middleware not active. It should append the user object to the request object. laspal schrieb: > I am trying to send mail using sendmail. Getting the error 'unicode' > object has no attribute 'user' ... > request.user.message_set.create(message="Mail was send > successfully.") -- Mfg. Jens Diemer http://www.jensdiemer.de --~--~-~--~~~---~--~~ 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: MySQL timediff and datetime.timedelta
On Sep 2, 12:55 pm, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > On Tue, 2008-09-02 at 03:16 -0700, JensGrivollawrote: > > I am getting weird results using django.db to do a "select > > timediff(a,b)..." query from MySQL. The result is a datetime.datetime > > object instead of a datetime.timedelta. When using MySQLdb directly, > > it returns the expected timedelta object. > > Are you really getting a datetime.datetime and not a datetime.time? I > would have expected you might get the latter, since we map any TIME type > of column to a datetime.time. I can't see how you would be getting a > datetime, though. You are right, it's a datetime.time. I'd still rather have a datetime.timedelta (which seems more logical), mostly because I want to use the timedelta.seconds attribute. I'm now using time_to_seconds() in MySQL so I don't have to deal with the time vs. timedelta issues. Ciao, Jens --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
MySQL timediff and datetime.timedelta
Hi, I am getting weird results using django.db to do a "select timediff(a,b)..." query from MySQL. The result is a datetime.datetime object instead of a datetime.timedelta. When using MySQLdb directly, it returns the expected timedelta object. The code is exactly identical in both cases other than using django.db.connection instead of MySQLdb.connect(...) I'm using default packages on Ubuntu 8.04 (django 0.96.1-2ubuntu2, mysqldb 1.2.2-5ubuntu1, mysql 5.0.51a-3ubuntu5.1). Any clues? Thanks, Jens --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Side effect if using threading.local ?
Hi... Are there exist any side effect by using threading.local, like it describe in the Wiki: http://code.djangoproject.com/wiki/CookBookThreadlocalsAndUser - Performance issue? - does it works in all server setup variants? Thx. Jens --~--~-~--~~~---~--~~ 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: UnicodeDecodeError: markdown failing to parse data fed by django
fizban schrieb: > On 12 Apr, 12:54, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: >> It sounds like you're using markdown 1.7. We haven't yet incorporated >> the patch necessary to handle markdown 1.7 along with the earlier >> versions. That will go in soon, though -- there's already a ticket in Trac >> for it. > > Ok, that sounds cool (the pending fix, not the backwards incompatible > changes); thank you for the reply btw. ticket: http://code.djangoproject.com/ticket/6387 -- Mfg. Jens Diemer A django powered CMS: http://www.pylucid.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: Strange Django-error
Nianbig schrieb: > Anyone know whats causing this error message? I get several of them > per day, now from diffrent IP-addresses. > >> Traceback (most recent call last): >> >> File "/usr/lib/python2.4/site-packages/django/core/handlers/base.py", >> line 68, in get_response >>callback, callback_args, callback_kwargs = >> resolver.resolve(request.path) >> >> TypeError: unpack non-sequence I rarely get the same error :( But only, if a client request directly the dispatcher file: e.g.: Traceback with: www.domain.tld/index.fcgi no Traceback with.: www.domain.tld Any idea? -- Mfg. Jens Diemer A django powered CMS: http://www.pylucid.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 -~--~~~~--~~--~--~---
ANN: PyLucid CMS v0.8.0 stable released...
After a long time, we released the first django Version of PyLucid CMS. This is the first stable release, after the big django modification ;) What? = PyLucid is a free content management system. It is written in Python using the Django Web framework. PyLucid has a web based installer, so the user need no shell account. It's works on a standard webserver with Python (at least v2.4) CGI and one of the supported database engines (MySQL, SQLite3, Postgre, Oracle and MS-SQL). It's hight customizable via the powerful django template engine and CSS. It support a Plugin API and has some interesting build in Plugins (a file manager, RSS etc.) Download There existing two packages: "full" and "lite". The full packages includes: - django v0.97pre (Rev.7112) - pygments v0.9 The lite packages doesn't include the external sources. many things changed since the last Release Candidate. some Backwards-incompatible changes since RC2, please look at: http://pylucid.org/_goto/121/changes/ -add the filemanager plugin Download: https://sourceforge.net/project/showfiles.php?group_id=146328_id=161206_id=576538 Links = Homepage: http://www.pylucid.org Forum: http://www.pylucid.org/phpBB2/ Install Info: http://pylucid.org/_goto/107/install-PyLucid/ Update Info: http://pylucid.org/_goto/108/Update-PyLucid/ -- Jens Diemer A django powered CMS: http://www.pylucid.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 -~--~~~~--~~--~--~---
Bug? - model with property + objects.values()
I would like to escape the data from a model attribute... Here a example: Old model: - class Page(models.Model): ... name = models.CharField() ... - I have changed the model to this: - class Page(models.Model): ... __name = models.CharField( db_column='name' ) def __get_name(self): return escape(self.__name) def __set_name(self, data): self.__name = data name = property(__get_name, __set_name) ... - Now, i have a problem :( This works, fine: page = Page.objects.all()[0] print page.name But here i get a 'FieldDoesNotExist' Traceback: print Page.objects.values("name") The complete traceback: - Traceback (most recent call last): File "./PyLucid_shortcuts_test.py", line 24, in print Page.objects.values("name") File "./django/db/models/query.py", line 108, in __repr__ return repr(self._get_data()) File "./django/db/models/query.py", line 482, in _get_data self._result_cache = list(self.iterator()) File "./django/db/models/query.py", line 597, in iterator fields = [self.model._meta.get_field(f, many_to_many=False) for f in self._fields] File "./django/db/models/options.py", line 131, in get_field raise FieldDoesNotExist, '%s has no field named %r' % (self.object_name, name) django.db.models.fields.FieldDoesNotExist: Page has no field named 'name' ----- Why? Is this a bug? -- Mfg. Jens Diemer A django powered CMS: http://www.pylucid.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: Build the _complete_ aboslute URI...
[EMAIL PROTECTED] schrieb: > On Wed, Oct 31, 2007 at 09:06:58AM +0100, Jens Diemer wrote: >> >> With get_absolute_url() [1] we can build a URL of a model entry. The Problem >> is, >> this is not really a _complete_ URL. The protocol and domain is absent. >> >> I implemented this: >> ... > > The URL is absolute, since it starts with a slash. Maybe this helps you: > > Look at request.build_absolute_uri() (http/__init__.py) Yes, but i can't get the request object in the model :( So this is not a solution :( -- Mfg. Jens Diemer A django powered CMS: http://www.pylucid.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 -~--~~~~--~~--~--~---
Build the _complete_ aboslute URI...
With get_absolute_url() [1] we can build a URL of a model entry. The Problem is, this is not really a _complete_ URL. The protocol and domain is absent. I implemented this: --- def get_absolute_uri(self): """ returned the complete absolute URI (with the domain/host part) """ url = self.get_absolute_url() if os.environ.get("HTTPS") == "on": protocol = "https" else: protocol = "http" domain = os.environ.get("SERVER_NAME") if not domain: domain = os.environ.get("HTTP_HOST") if not domain: # Can't build the complete uri without the domain ;( # e.g. running the django development server return url return "%s://%s%s" % (protocol, domain, url) --- I think it's not a good idea to get information from os.environ. This only works with Apache. The better way is to use request.META or directly request.build_absolute_uri(). But IMHO i can't get the request object in the model. I can't use Site.objects.get_current().domain [2], because i didn't use the Site framework. And this is not a good idea: The protocoll is always "http". Any better idea? [1] <http://www.djangoproject.com/documentation/model-api/#get-absolute-url> [2] <http://www.djangoproject.com/documentation/sites/#getting-the-current-domain-for-full-urls> -- Mfg. Jens Diemer A django powered CMS: http://www.pylucid.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 -~--~~~~--~~--~--~---
Patch for 'mysql_old' users... (unicode error)
On my SharedWebspace i have only a old MySQLdb version (v1.2.1g2) :( So i must use mysql_old and i trapped into unicode errors. The Problem is: The database results are not unicode. There exists a ticket: http://code.djangoproject.com/ticket/4741 In this combination there is probably a problem with the Traceback. If a Unicode error appears, the values in the traceback seems to be unicode. But this is not true. The data from the database are byte strings. I have made a Patch for the file ./django/db/backends/mysql_old/base.py to fix the unicode problem. You can find the Patch in the ticket. The solution is: All byte string results from the database must be decoded to unicode. If you have the same Problem, you can use the patch from the ticket. If you have trouble to apply the patch, mail me. I can send you the patched base.py. Please let me know if this works for you or not. -- Mfg. Jens Diemer A django powered CMS: http://www.pylucid.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: How to clean the cache completely?
Deryck Hodge schrieb: > On 9/20/07, Jens Diemer <[EMAIL PROTECTED]> wrote: >> I can delete one entry in the cache. But how can i clean the cache >> completely? > Assuming your cache backend is memcached: > > from django.core.cache import cache > cache._cache.flush_all() > > I don't use the other cache backends enough to know about this method for > them. Hm. I used the filesystem backend. There is IMHO no flush_all() method. But i think it simple to implement this: The only thing to do, is: Delete all files ;) -- Mfg. Jens Diemer A django powered CMS: http://www.pylucid.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 -~--~~~~--~~--~--~---
How to clean the cache completely?
I can delete one entry in the cache. But how can i clean the cache completely? -- Mfg. Jens Diemer A django powered CMS: http://www.pylucid.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: Trigger a django user password change...
Jens Diemer schrieb: > I would like to do something if the django user password has been set or > update. > So i trigger signals.post_save with the User class, like this: > === > from django.db.models import signals > from django.dispatch import dispatcher > > > def update(sender, instance, signal, *args, **kwargs): > > user_obj = instance > > ... > > user_obj.message_set.create(message="Updated!") > > > dispatcher.connect(update, signal=signals.post_save, sender=User) > === > But my function 'update' is not only called if the user password changed. > The problem is, in the User model exists e.g. 'last_login'. So the save > method > called every time, the user logged in :( > > Any better ideas? I found a simple way to trigger a user password change. I hacked directly into the django.contrib.auth.models.User.set_password() method. It looks like this: === from django.contrib.auth.models import User # Save the original method old_set_password = User.set_password def set_password(user, raw_password): if user.id == None: # It's a new user. We must save the django user account first. user.save() # # Do something with the user obejct and the given raw_password ;) # # Use the original method to set the django User password: old_set_password(user, raw_password) # Replace the method User.set_password = set_password === So every normal password change (e.g. from the django admin panel) are caught and i can access to the raw plaintext password. I added a snippets here: http://www.djangosnippets.org/snippets/397/ -- Mfg. Jens Diemer A django powered CMS: http://www.pylucid.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: session expire_date
KpoH schrieb: > You can view all other settings in django_root_dir/conf/global_settings.py Don't understand. How should this help me? I would like to know, how long the current session is still valid. Do I think to complex? Should I simply do this: -- now = datetime.datetime.now() cookie_age = datetime.timedelta(seconds=settings.SESSION_COOKIE_AGE) expiry_date = now + cookie_age -- -- Mfg. Jens Diemer A django powered CMS: http://www.pylucid.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 -~--~~~~--~~--~--~---
session expire_date
I would like to know the expire date of the current session. I made this: -- from django.contrib.sessions.models import Session session_cookie_name = settings.SESSION_COOKIE_NAME current_session_id = self.request.COOKIES[session_cookie_name] s = Session.objects.get(pk=current_session_id) expiry_date = s.expire_date -- There must be a simpler way for this, isn't it? -- Mfg. Jens Diemer A django powered CMS: http://www.pylucid.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: Trigger a django user password change...
RajeshD schrieb: > Create a custom view to allow your users to change just their > password. In that view, you will be able to tell in a straightforward > fashion if the user has changed her password and take action > accordingly. Yes. That would work fine. Now, i realized that i need the raw_password for my things. With signals i can only get the hashed password, not the raw plaintext password. On the other side, wit signals i can catch every changes from every views. So i must build my own views and the user can used the default django views to change his password. Is there is an other way to trigger a django user password change and get the raw password??? -- Mfg. Jens Diemer A django powered CMS: http://www.pylucid.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 -~--~~~~--~~--~--~---
Trigger a django user password change...
I would like to do something if the django user password has been set or update. So i trigger signals.post_save with the User class, like this: === from django.db.models import signals from django.dispatch import dispatcher def update(sender, instance, signal, *args, **kwargs): user_obj = instance ... user_obj.message_set.create(message="Updated!") dispatcher.connect(update, signal=signals.post_save, sender=User) === But my function 'update' is not only called if the user password changed. The problem is, in the User model exists e.g. 'last_login'. So the save method called every time, the user logged in :( One idea is this: === old_passwords = {} def save_old_pass(sender, instance, signal, *args, **kwargs): user_obj = instance old_pass = user_obj.password old_passwords[user_obj] = old_pass def update(sender, instance, signal, *args, **kwargs): user_obj = instance new_password = user_obj.password if user_obj in old_passwords and old_passwords[user_obj] == new_password: # Nothing to change return ... user_obj.message_set.create(message="Updated!") from django.db.models import signals from django.dispatch import dispatcher dispatcher.connect(save_old_pass, signal=signals.post_init, sender=User) dispatcher.connect(update, signal=signals.post_save, sender=User) === This works, but save_old_pass() would be often called, if the user is logged in. So it's not a really good idea. Any better ideas? -- Mfg. Jens Diemer A django powered CMS: http://www.pylucid.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 -~--~~~~--~~--~--~---
Pickle model fields with cache...
I have insert a small cache mechanism. So pickle.loads() would only used for the first _get_value(): - class Preference(models.Model): def __init__(self, *args, **kwargs): self._cache = {} super(Preference, self).__init__(*args, **kwargs) ... def _get_value(self): if "value" in self._cache: value = self._cache["value"] else: value = pickle.loads(self._value) self._cache["value"] = value return value def _set_value(self, value): self._cache["value"] = value self._value = pickle.dumps(value) _value = models.TextField() value = property(_get_value, _set_value) ... ----- -- Mfg. Jens Diemer A django powered CMS: http://www.pylucid.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: Pickle model fields
I would make a pickle field, too. I tried this: - class Preference(models.Model): ... def _get_value(self): return pickle.loads(self._value) def _set_value(self, value): self._value = pickle.dumps(value) _value = models.TextField() value = property(_get_value, _set_value) ... - In a short test works this seems to work... Question: Is this a good idea? -- Mfg. Jens Diemer A django powered CMS: http://www.pylucid.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: ForeignKey
Christopher schrieb: > class Menu(models.Model): > display_text = models.CharField(maxlength=50) > url = models.URLField(verify_exists=False) > parent_menu_item = models.ForeignKey(Menu) > > totalimpact.menu: name 'Menu' is not defined """ If you need to create a relationship on a model that has not yet been defined, you can use the name of the model, rather than the model object itself: """ change: parent_menu_item = models.ForeignKey(Menu) to this: parent_menu_item = models.ForeignKey("Menu") -- Mfg. Jens Diemer A django powered CMS: http://www.pylucid.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: Problem: locale.getdefaultlocale() returns (None, None) under apache2...
Malcolm Tredinnick schrieb: > On Tue, 2007-06-26 at 23:28 +1000, Malcolm Tredinnick wrote: > [...] >> The code itself is not catching all the right exceptions that can be >> raised: the idea was that if getdefaultlocale() returns something we >> can't use, it should just return no timezone. I'll give it another look >> and put in some more fallbacks. > > This should be fixed in [5546]. Yes, now it fallback to "ascii" -- Mfg. Jens Diemer A django powered CMS: http://www.pylucid.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 -~--~~~~--~~--~--~---
Problem: locale.getdefaultlocale() returns (None, None) under apache2...
Woops... I used apache2 and django via cgi... This works fine so far. Until now. locale.getdefaultlocale() returns (None, None) Don't know why. A restart of apache doesn't change anything. So i get a django traceback: - Traceback (most recent call last): File "./django/template/__init__.py" in render_node 754. result = node.render(context) File "./django/template/__init__.py" in render 899. dict = func(*args) File "./django/contrib/admin/templatetags/admin_list.py" in result_list 206. 'results': list(results(cl))} File "./django/contrib/admin/templatetags/admin_list.py" in results 201. yield list(items_for_result(cl,res)) File "./django/contrib/admin/templatetags/admin_list.py" in items_for_result 163. result_repr = capfirst(dateformat.format(field_val, datetime_format)) File "./django/utils/dateformat.py" in format 258. df = DateFormat(value) File "./django/utils/dateformat.py" in __init__ 114. self.timezone = LocalTimezone(dt) File "./django/utils/tzinfo.py" in __init__ 34. self._tzname = self.tzname(dt) File "./django/utils/tzinfo.py" in tzname 53. return smart_unicode(time.tzname[self._isdst(dt)], DEFAULT_ENCODING) File "./django/utils/encoding.py" in smart_unicode 25. return force_unicode(s, encoding, strings_only, errors) File "./django/utils/encoding.py" in force_unicode 42. s = unicode(s, encoding, errors) TypeError at /_admin/PyLucid/page/ unicode() argument 2 must be string, not None - This is "normal" because of this line in ./django/utils/tzinfo.py : - DEFAULT_ENCODING = locale.getdefaultlocale()[1] - So, DEFAULT_ENCODING is None... In the Python shell, everything is ok: - >>> import locale >>> print locale.getdefaultlocale() ('de_DE', 'UTF8') - Somebody a idea? -- Mfg. Jens Diemer A django powered CMS: http://www.pylucid.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 -~--~~~~--~~--~--~---
quote django template tags for a html textarea...
I would like to edit templates online. So i used newforms and .form_for_instance() to build a html form. The Problem: If there are django template tags in the content, the tag rendered by the template engine. But i don't want that. I want to edit the tag in a html textarea. Here a small cut out from my source: --- from django import newforms as forms from PyLucid.models import Page page_instance = Page( content="Test {{ YYY }} foo bar...", ) page_instance.save() Form = forms.models.form_for_instance(page_instance) html_form = Form() # in the real code: render to response and not print it out ;) print html_form.as_p() --- One solution i found: Replace "{" and "}". after render the form with .as_p() Like this: form = form.replace("{", "").replace("}", "") This works fine. But now i doesn't wand directly render the html code. I used the "complex template output" described here: http://www.djangoproject.com/documentation/newforms/#complex-template-output So i have no change to replace "{" and "}"... If i replace it before i make .form_for_instance() the escaped sequence "" would be escaped a second time to this: "#x7B;". How can i handle this??? -- Mfg. Jens Diemer A django powered CMS: http://www.pylucid.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: newforms: How to make a Checkboxed user select list...
Jens Diemer schrieb: > I would like to make a newforms user select list, from every existing django > users, looks like this: I have found a solution: class MailForm(forms.Form): users = forms.ModelMultipleChoiceField( queryset=User.objects.all(), widget=forms.CheckboxSelectMultiple ) =;-) -- Mfg. Jens Diemer A django powered CMS: http://www.pylucid.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 -~--~~~~--~~--~--~---
newforms: How to make a Checkboxed user select list...
I would like to make a newforms user select list, from every existing django users, looks like this: -- username1 - mailto:[EMAIL PROTECTED]">[EMAIL PROTECTED] username2 - mailto:[EMAIL PROTECTED]">[EMAIL PROTECTED] username3 - mailto:[EMAIL PROTECTED]">[EMAIL PROTECTED] -- I don't know how to make this. Has anyone a idea? -- Mfg. Jens Diemer A django powered CMS: http://www.pylucid.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: no newforms.TextField() available?!?!?
James Bennett schrieb: > On 6/25/07, Jens Diemer <[EMAIL PROTECTED]> wrote: >> This works: >> mail_text = forms.CharField(widget=forms.Textarea) > > That's by design. Whether to show an input type="text" or a textarea > is a matter of widgets, so you differentiate between them by using > different widgets. > Thanks for the info ;) --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
no newforms.TextField() available?!?!?
I would like to use the newforms.TextField() to make a html textarea. But i get the error: 'module' object has no attribute 'TextField' I wounder, because in the Docu i find TextField unter field types list: http://www.djangoproject.com/documentation/newforms/#field-types my code: -- from django import newforms as forms class MailForm(forms.Form): ... mail_text = forms.TextField() ... -- This works: mail_text = forms.CharField(widget=forms.Textarea) Note: I used the unicode-branch. -- Mfg. Jens Diemer A django powered CMS: http://www.pylucid.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 -~--~~~~--~~--~--~---
ANN: PyLucid v0.8.0alpha2...
A new PyLucid CMS snapshot released. - http://www.pylucid.org changes: + Inline Editing with template tag list and tinyTextile help page. + reimplemented: create a cms page, delete pages and "Select a page to edit it". + better _install section login. + CMS page view cache. + better update routines. + and more... The PyLucid v0.8.0alpha2 Package is preinstalled. A local django enviroment, a preinstalled SQLite database file and a presetuped settings.py is included. You should only run "standalone_linux.sh" or "standalone_w32.cmd" to start a local development server and test PyLucid. Normal CMS page request: http://localhost:8000/ Django admin panel: http://localhost:8000/_admin/ Install section link (password is "12345678"): http://localhost:8000/_install/ preinstalled user: username: "test" userpassword: "12345678" download: http://sourceforge.net/project/showfiles.php?group_id=146328_id=172512 btw. the test page http://www.pylucid.de used the new alpha Version. (It runs via CGI on apache with SQLite) -- Mfg. Jens Diemer A django powered CMS: http://www.pylucid.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: delete obsolete content type entries...
Gabriel Farrell schrieb: > On May 7, 4:32 am, Jens Diemer <[EMAIL PROTECTED]> wrote: >> That surprises me. Does nobody have the same problems? >> Still nobody delete a model class? >> >> How to clean up the django tables? With phpMyAdmin? >> > > I've just run into a similar issue when I removed an app from a > project. After some attempt to fix the tables myself, I held my > breath, dropped the tables (auth_permission and django_content_type), > then ran "python manage.py syncdb". Voila, the tables were re-created > correctly, without the app I had removed. Yes, you can drop and recreate the tables. But if you setup users and permissions, then IMHO you lost this :( For PyLucid i have made a small tool to fix this: http://pylucid.net/trac/browser/branches/0.8%28django%29/PyLucid/tools/clean_tables.py?rev=1085 -- Mfg. Jens Diemer A django powered CMS: http://www.pylucid.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: FastCGI Shared host
rtconner schrieb: > ~/www/django> python mysite.fcgi > ... > Traceback (most recent call last): > ... > if settings.APPEND_SLASH and (old_url[1][-1] != '/') and ('.' not > in old_url[1].split('/')[-1]): > IndexError: string index out of range > Content-Type: text/html This is probably the same problem like here: http://code.djangoproject.com/ticket/3414 -- Mfg. Jens Diemer A django powered CMS: http://www.pylucid.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 help_text if form_for_model used...
Jens Diemer schrieb: > How can i change the help_text after i have generate the form with > form_for_model() ? I found a solution: -- from django.contrib.auth.models import User UserForm = forms.form_for_model(User, fields=("username", "password")) # change the help_text: UserForm.base_fields['password'].help_text = "" ------ -- Mfg. Jens Diemer A django powered CMS: http://www.pylucid.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 -~--~~~~--~~--~--~---
change help_text if form_for_model used...
How can i change the help_text after i have generate the form with form_for_model() ? -- Mfg. Jens Diemer A django powered CMS: http://www.pylucid.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: Admin custom widget
I found the solution. It is very simple. I need only a directory named 'widget' in my project-template-directory. Thats all! --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Announcing: PyLucid CMS v0.8.0alpha1
What is PyLucid? PyLucid is a lightweight, OpenSource (GPL) content management system. It's ideal for Shared-Webhosting: No shell account needed. Run at least with CGI. -- Release notes: The PyLucid django branch is now a little bit usable. (Not for production sites.) The PyLucid v0.8.0alpha1 Package is preinstalled. A local django enviroment, a preinstalled SQLite database file and a presetuped settings.py is included. You should only run "standalone_linux.sh" or "standalone_w32.cmd" to start a local development server and test PyLucid. Login Link: http://localhost:8000/_admin/ _install section link: http://localhost:8000/_install/12345678/ preinstalled user: user name: "test" password: "12345678" -- Links: Homepage: http://www.pylucid.org sf.net page: http://sourceforge.net/projects/pylucid/ Download: http://sourceforge.net/project/showfiles.php?group_id=146328 -- btw. Are announcements permitted/desired here? -- Mfg. Jens Diemer A django powered CMS: http://www.pylucid.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 -~--~~~~--~~--~--~---
Admin custom widget
Hi everybody, I'm creating a new widget/template for my admin interface (image_with_thumbnail.html for nesh.thumbnail.field.ImageWithThumbnailField). For the moment it works fine, if I put the image_with_thumbnail.html in django/contrib/admin/templates/widget, but I don't want patch the django-package. How can I integrate a customed/new widget in my own project(-path) (simular the admin-templates)? --~--~-~--~~~---~--~~ 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: modifying shebang reference in django 0.95.1
Mark Phillips schrieb: > Thank you. I am not familiar with the "init/index" python script. Can > you elaborate? You use fastCGI... So you have a "init" WSGI Handler file? Only the shebang in this file is IMHO important. -- Mfg. Jens Diemer A django powered CMS: http://www.pylucid.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: modifying shebang reference in django 0.95.1
Mark Phillips schrieb: > django/bin/compile-messages.py:1: #!/usr/bin/env python > django/bin/django-admin.py:1: #!/usr/bin/env python > django/bin/make-messages.py:1: #!/usr/bin/env python > django/bin/unique-messages.py:1: #!/usr/bin/env python > django/conf/project_template/manage.py:1: #!/usr/bin/env python > > My intention is to change the shebang to #!/usr/local/python You must only change the shebang in your "init/index" python script. The Handler file. -- Mfg. Jens Diemer A django powered CMS: http://www.pylucid.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: delete obsolete content type entries...
Here a stand alone cleanup script, for discussion: http://paste.pocoo.org/show/1482/ btw. you should have the same problem, if you test a separate django app. And "deinstall" it later. If you use "django.contrib.auth" and "django.contrib.contenttypes" there must be exist obsolete contenttypes and permission entries, after you deactivate the test-App. -- Mfg. Jens Diemer A django powered CMS: http://www.pylucid.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: delete obsolete content type entries...
That surprises me. Does nobody have the same problems? Still nobody delete a model class? How to clean up the django tables? With phpMyAdmin? -- Mfg. Jens Diemer A django powered CMS: http://www.pylucid.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 -~--~~~~--~~--~--~---
delete obsolete content type entries...
I have delete some app models. So, in the internal django tables "django_content_type" and "auth_permission" are some old content types entries. So i received errors like: "ContentType matching query does not exist." (When i create a new user group). Is there a way to update the django tables automatically? -- Mfg. Jens Diemer A django powered CMS: http://www.pylucid.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: Big Upload
Micha Reiser schrieb: > I created an upload page, but the problem is, that the server load the > whole file in the Ram. I have only some links for you: - http://code.djangoproject.com/ticket/1484 - http://code.djangoproject.com/ticket/2070 - http://jesusphreak.infogami.com/blog/vrp1 (search for "upload") -- Mfg. Jens Diemer A django powered CMS: http://www.pylucid.org --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to [EMAIL PROTECTED] 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: Playing with fixtures and django serializers -> Errors...
jj schrieb: > I've run into a similar problem (error: "columns app_label, model are > not unique"). > > I've found a work-around: > A easier way is to use db_dump.py ;) Look at: http://groups.google.com/group/django-users/browse_thread/thread/342efea6e3fc693d/a6807b7770b6b165 -- Mfg. Jens Diemer A django powered CMS: http://www.pylucid.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: backup/restore DB data...
limodou schrieb: > You can try db_dump.py tool, it's not a web-gui based, but a command line > tool. > > http://www.djangosnippets.org/snippets/14/ Very cool! It seems to work without problems ;) I made a hack to put it into my web install section: http://pylucid.net/trac/changeset/930 But i must redirect the stdout and make a fake optparse options... Is it possible you change the script, so its easy to use it without a shell? And a feature request: a option to zip all dumpfiles and load the dump on-the-fly from a zip archive. So a user can download one zipfile as a backup ;) btw. can you insert a Licence statements into you script? -- Mfg. Jens Diemer A django powered CMS: http://www.pylucid.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 -~--~~~~--~~--~--~---
backup/restore DB data...
I would like to backup and restore my django App-Database. This should be usable with a Web-GUI. I thought fixtures would be well usable for it. But there are some problems with this. Look at: http://groups.google.com/group/django-users/browse_thread/thread/6a4e9781d08ae815 What is a good/other way, for DB backups? -- Mfg. Jens Diemer A django powered CMS: http://www.pylucid.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.template.TemplateSyntaxError: Invalid block tag: 'extends'
I used a base.html template and extends it with a String-Template. Example: -- from django.template import Template, Context #, loader my_example_string_template = """ {% extends "example.html" %} blabla... """ c = Context(context) t = Template(my_example_string_template) html = t.render(c) return HttpResponse(html) -- So i need only to import this: from django.template import Template, Context and not django.template.loader. If i don't import the loader i get the error: -- Traceback (most recent call last): File "test2.py", line 8, in ? t = Template(my_example_string_template) File "./django/template/__init__.py", line 158, in __init__ File "./django/template/__init__.py", line 174, in compile_string File "./django/template/__init__.py", line 271, in parse File "./django/template/__init__.py", line 315, in invalid_block_tag django.template.TemplateSyntaxError: Invalid block tag: 'extends' -- This is normal. Because django.template.loader makes this: add_to_builtins('django.template.loader_tags') and the tags 'block', 'extends' and 'include' are defined in django.template.loader_tags conclusion: The loader must be import, even if i not use it directly! Is that not somehow stupidly solved? -- Mfg. Jens Diemer CMS in pure Python CGI: http://www.pylucid.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: Deployment with Subversion
Kenneth Gonsalves schrieb: > never ever put settings.py under version control ack. In PyLucid i put only a settings-example.py into my svn: http://pylucid.net/trac/browser/branches/0.8%28django%29/PyLucid/settings-example.py In the handler file (here a CGI handler), i check this: - try: from PyLucid.settings import DEBUG except ImportError: print "Content-type: text/plain; charset=utf-8\r\n\r\n" print "Low-Level-Error!" print print "Can't import 'settings'!" print print "You must rename ./PyLucid/settings-example.py to ./PyLucid/settings.py" print print "You must setup this file for your config!" import sys sys.exit() - -- Mfg. Jens Diemer CMS in pure Python CGI: http://www.pylucid.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 server: reload and samba share...
My sources are on a linux samba share. I used this share under windows xp and start the django developer server from this share. The reload mechanism don't work! When i copy the source from the share into my local filesystem, the reload works fin. Any solution? -- Mfg. Jens Diemer CMS in pure Python CGI: http://www.pylucid.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: Playing with fixtures and django serializers -> Errors...
Jens Diemer schrieb: > I can't trying this. Because now i have a error before the serializers > starts working: """ContentType matching query does not exist.""" On a other platform it works! I don't known why... But if i import the dump i got some errors: Error: columns app_label, model are not unique and some Errors like: 'ascii' codec can't decode byte 0xc3 in position 4: ordinal not in range(128) -- Mfg. Jens Diemer CMS in pure Python CGI: http://www.pylucid.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: Playing with fixtures and django serializers -> Errors...
Russell Keith-Magee schrieb: > I've just finished writing a new set of tests for the serializers, > which included fixing a number of bugs. These fixes have been checked > in as of [4719]. Can you retry your tests and see if you still have > problems? I can't trying this. Because now i have a error before the serializers starts working: """ContentType matching query does not exist.""" 110. objects = [] 111. for app in app_list: 112. for model in get_models(app): 113. model_objects = model.objects.all() 114. response.write(repr(model_objects)) 115. objects.extend(model_objects) The Exception Location is in line 114. I used plain "django-admin dumpdata" with the same error. I think i have a error in my DB data. But i can't isolate it with there error messages :( -- Mfg. Jens Diemer CMS in pure Python CGI: http://www.pylucid.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 -~--~~~~--~~--~--~---
Playing with fixtures and django serializers -> Errors...
I'm playing with django.core.serializers... so far with few success :( With JSON i get the Error: "ContentType matching query does not exist." If i use the "python" format, i get from serializers.serialize() a list. How should I to store these list in a file? With pickle, repr() or unicode()??? With pickle, i got the Error: "can't pickle array objects" if i use "python" and store the result with repr() or unicode() in a file... I got an error, if i load the file and deserialize it: File ".\django\core\serializers\python.py", line 59, in Deserializer Model = _get_model(d["model"]) TypeError: string indices must be integers If i use the "xml" format, i get an Error if i deserialize the serialized string: File "serializers_test.py", line 77, in test_xml for object in objects2: File ".\django\core\serializers\xml_serializer.py", line 115, in next return self._handle_object(node) File ".\django\core\serializers\xml_serializer.py", line 155, in _handle_object value = field.to_python(getInnerText(field_node).strip().encode(self.encoding)) File ".\django\db\models\fields\__init__.py", line 525, in to_python raise validators.ValidationError, gettext('Enter a valid date/time in -MM-DD HH:MM format.') django.core.validators.ValidationError: ['Enter a valid date/time in -MM-DD HH:MM format.'] I examined this. The XML file is correct. In the DB (the source) i have datetime fields with a NULL value. XML file cutout: 0 managePages core blabla None The Traceback is interesting (cutout): .\django\core\serializers\xml_serializer.py in _handle_object line 155: Model: data: {'description': 'This group is able to add/edit/delete pages.', 'id': u'1', 'name': 'managePages', 'pluginID': '0', 'section': 'core'} field: field_name: u'lastupdatetime' field_node: m2m_data: {} node: pk: u'1' self: value: 'blabla' In 'data' i missing the keys 'lastupdatetime' and 'createtime'. I find field_name == 'lastupdatetime', but value == 'blabla' also amusing. Because you can see from above: 'blabla' is the value for the key 'description' and not from 'lastupdatetime' -- Mfg. Jens Diemer CMS in pure Python CGI: http://www.pylucid.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 -~--~~~~--~~--~--~---
Bug? Every table needs a id?
I have a (old) Model like this: class SessionData(models.Model): session_id = models.CharField(maxlength=96) expiry_time = models.DateTimeField() ip = models.CharField(maxlength=45) domain_name = models.CharField(maxlength=150) session_data = models.TextField() class Admin: pass class Meta: db_table = '%ssession_data' % TABLE_PREFIX verbose_name_plural = 'Session Data' the i make this: from django.core.management import dump_data print dump_data(app_labels=[]) and i get this traceback: Traceback (most recent call last): File "", line 2, in ? File "/home/jens/servershare/SVN/SVN PyLucid/branches/0.8(django)/django/core/management.py", line 1438, in dump_data objects.extend(model.objects.all()) File "/home/jens/servershare/SVN/SVN PyLucid/branches/0.8(django)/django/db/models/query.py", line 108, in __iter__ return iter(self._get_data()) File "/home/jens/servershare/SVN/SVN PyLucid/branches/0.8(django)/django/db/models/query.py", line 468, in _get_data self._result_cache = list(self.iterator()) File "/home/jens/servershare/SVN/SVN PyLucid/branches/0.8(django)/django/db/models/query.py", line 181, in iterator cursor.execute("SELECT " + (self._distinct and "DISTINCT " or "") + ",".join(select) + sql, params) File "/home/jens/servershare/SVN/SVN PyLucid/branches/0.8(django)/django/db/backends/util.py", line 12, in execute return self.cursor.execute(sql, params) File "/home/jens/servershare/SVN/SVN PyLucid/branches/0.8(django)/django/db/backends/mysql/base.py", line 42, in execute return self.cursor.execute(sql, params) File "/usr/lib/python2.4/site-packages/MySQLdb/cursors.py", line 163, in execute self.errorhandler(self, exc, value) File "/usr/lib/python2.4/site-packages/MySQLdb/connections.py", line 35, in defaulterrorhandler raise errorclass, errorvalue OperationalError: (1054, "Unknown column 'pylucid_session_data.id' in 'field list'") Yes, there is no column "id" for the table "pylucid_session_data". Is that an error? Or must all tables have an ID? (or primary key?) I have made a small patch, so the table skipped: Index: ./django/core/management.py === --- ./django/core/management.py (revision 4692) +++ ./django/core/management.py (working copy) @@ -1434,7 +1434,10 @@ objects = [] for app in app_list: for model in get_models(app): -objects.extend(model.objects.all()) +try: +objects.extend(model.objects.all()) +except Exception, e: +sys.stderr.write(style.ERROR("unable to get data: %s\n" % e)) try: print serializers.serialize(format, objects, indent=indent) except Exception, e: -- Mfg. Jens Diemer CMS in pure Python CGI: http://www.pylucid.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: Recursion in templates... again
Chris Moffitt schrieb: > I've implemented a similar hierarchy for categories in Satchmo using > elementtree. You can see my example here- > http://www.satchmoproject.com/trac/browser/satchmo/trunk/satchmo/shop/templatetags/category_display.py But you have html code in your programm. (The und Tags). I don't want to put this in the programm code. All html thing should be stored in the template. To generate a tree menu without a template is very easy ;) -- Mfg. Jens Diemer CMS in pure Python CGI: http://www.pylucid.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: Generate a tree List...
Jeremy Dunck schrieb: > If you want recursion in templates, why not just use Jinja? Jinja is super cool. But I would like to keep the PyLucid package small. I thought with django i would choose a full features framework :( -- Mfg. Jens Diemer CMS in pure Python CGI: http://www.pylucid.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: Recursion in templates... again
Grupo Django schrieb: > Hello, I have been looking around about some information about how to > do recursion in templates but what I found didn't help me. > ... > > And the plan is to create a menu like this: > - Entry 1 > -- Subentry 1_1 > -- Subentry 1_2 > sub_Subentry 1_2_1 > - Entry 2 > ... I have the same Problem: http://groups.google.com/group/django-users/browse_thread/thread/3bd2812a3d0f7700/e97a9cd4348b0471?#e97a9cd4348b0471 Did you find a solution? I found this: https://svn.greenpeace.org/projects/custard/browser/production/trunk/melt/apps/custard/templatetags/customtags.py But the code is for an older django version. I don't know how to update it... So, if there is no solution, i must use jinja... -- Mfg. Jens Diemer CMS in pure Python CGI: http://www.pylucid.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: Generate a tree List...
Jeremy Dunck schrieb: >> I found this: >> https://svn.greenpeace.org/projects/custard/browser/production/trunk/melt/apps/custard/templatetags/customtags.py >> >> But i don't know how i can use this. Hm :( The code is for an older django version. -- Mfg. Jens Diemer CMS in pure Python CGI: http://www.pylucid.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: Generate a tree List...
Jens Diemer schrieb: > Jeremy Dunck schrieb: >>> I found this: >>> https://svn.greenpeace.org/projects/custard/browser/production/trunk/melt/apps/custard/templatetags/customtags.py >>> >>> But i don't know how i can use this. >> Yeah, I'd be careful about the license. I don't see one. >> You might contact one of these folks: >> https://svn.greenpeace.org/projects/custard/browser/doc/copyright.html > > No problem, the source is under the GPL and PyLucid is under GPL, too ;) Sorry i forgot the link to the license: https://svn.greenpeace.org/projects/custard/browser/production/trunk/melt/COPYING ;) -- Mfg. Jens Diemer CMS in pure Python CGI: http://www.pylucid.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: [help] passing a md5 digest string into URL
Giuseppe Franchi schrieb: > As i said, i need to pass in my URL a variable, wich is the > result of a md5 digest. > (no private information... only a validation key). Look at this: http://code.google.com/p/django-registration/ and this: http://django-registration.googlecode.com/svn/trunk/urls.py -- Mfg. Jens Diemer CMS in pure Python CGI: http://www.pylucid.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: Generate a tree List...
Jeremy Dunck schrieb: >> I found this: >> https://svn.greenpeace.org/projects/custard/browser/production/trunk/melt/apps/custard/templatetags/customtags.py >> >> But i don't know how i can use this. > > Yeah, I'd be careful about the license. I don't see one. > You might contact one of these folks: > https://svn.greenpeace.org/projects/custard/browser/doc/copyright.html No problem, the source is under the GPL and PyLucid is under GPL, too ;) > But it looks like something like this would do: > > x = { 'value':1, 'children': [ > { 'value': 2, 'children': []}, > {'value' : 3, 'children': [ > { 'value':4, 'children':[] } > ]} > ]} > > {% recurse through children as node starting with x %} > ...do something with node. > {% endrecurse %} Thank you for your help! Now, i try it to use it ;) -- Mfg. Jens Diemer CMS in pure Python CGI: http://www.pylucid.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: datetime format and client preferred language?!?!
Jens Diemer schrieb: > How can i send a datetime in the client preferred format? Note: i don't > wand to use a template filter to handle this ;) Hm! I can make this: t.strftime(_("%Y-%m-%d - %H:%M")) :) -- Mfg. Jens Diemer CMS in pure Python CGI: http://www.pylucid.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 -~--~~~~--~~--~--~---
datetime format and client preferred language?!?!
How can i send a datetime in the client preferred format? Note: i don't wand to use a template filter to handle this ;) Generally: - There is no "User preferred language" column in the default User table - django doesn't setup a client preferred language based on the HTTP_ACCEPT_LANGUAGE string. Why? I think a full feature framework should full handle L10N/I18N. Have I overlooked something? -- Mfg. Jens Diemer CMS in pure Python CGI: http://www.pylucid.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: Generate a tree List...
Joseph Heck schrieb: > Check out the docs at > http://www.djangoproject.com/documentation/templates_python/ for a good > overview. Making one is really pretty straightfoward. I don't think this is so easy :( I found this: https://svn.greenpeace.org/projects/custard/browser/production/trunk/melt/apps/custard/templatetags/customtags.py But i don't know how i can use this. Jeremy Dunck schrieb: > It won't be added to Django core, AFAIK. Why? Everyone need this function, if you would like to build a sitemap with a tree. I think this feature should not be missing in the core. It's a very useful function -- Mfg. Jens Diemer CMS in pure Python CGI: http://www.pylucid.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 -~--~~~~--~~--~--~---
Generate a tree List...
I wand generate a tree menu/sitemap. How can i make a recursive loop in a template??? In jinja i can use the tag "recurse": http://wsgiarea.pocoo.org/jinja/docs/loops.html#recursion Here a jinja example: context = {'sitemap': [{'href': u'/Index/', 'subitems': [{'href': u'/Index/PhpBBadmin/', 'title': u'phpBBadmin'}], 'title': u'index'}, {'href': u'/ExamplePages/', 'subitems': [{'href': u'/ExamplePages/TextileExample/', 'title': u'complete tinyTextile examples'}, {'href': u'/ExamplePages/Testpage/', 'title': u'a testpage ;)'}, {'href': u'/ExamplePages/SourceCode/', 'title': u'SourceCode'}, {'href': u'/ExamplePages/Contact/', 'title': u'contact'}, {'href': u'/ExamplePages/SiteMap/', 'title': u'SiteMap'}], 'title': u'example pages'}, {'href': u'/Test/', 'title': u'test'}]} template = """ Sitemap {% for item in sitemap %} {{ item.title|escapexml }} {% if item.subitems %} {% recurse item.subitems %} {% endif %} {% endfor %} """ recurse used the for loop again with the subitems. So i can easy create a recursion. How can i do this in django? -- Mfg. Jens Diemer CMS in pure Python CGI: http://www.pylucid.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 -~--~~~~--~~--~--~---