Re: Dynamically adapting admin page for editting xml data?
On 13 Aug., 11:53, spacetaxi <spacet...@gmail.com> wrote: > I'd like to implement an admin page (field, widget, template... > whatever) to edit xml-formatted contents of TextFields. Every child > node of the xml data has to be editable in a *separate* TextField. Ok guys, just in case anybody is interested: I got this problem solved. I don't know why it was *that* difficult for me. ;-) The section about "Custom Widgets" in the book "Pro Django" by Marty Alchin was very helpful. Regards, -Stephan --~--~-~--~~~---~--~~ 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: ModelForm limit m2m choices
Hello alain31, On 12 Aug., 21:41, alain31wrote: > [...] > How can I use a custom QuerySet for the choices of field1 ? I think it should work like this: myform = MyForm(..) myqueryset = myform.base_fields['field1'].queryset myqueryset = myqueryset.filter_by(somefield='somevalue') myform.base_fields['field1'].queryset = myqueryset Regards, -Stephan --~--~-~--~~~---~--~~ 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: One-to-many relationship (the opposite of many-to-one)
Hi Fredrik, you could define a customized subclass of Site: -- from django.contrib.sites.models import Site class Company(models.Model): name = models.CharField(max_length = 30) url = models.CharField(max_length = 100) class CompanySite(Site): company = models.ForeignKey(Company) -- Regards, -Stephan --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Dynamically adapting admin page for editting xml data?
Hello fellow djangonauts, I'd like to implement an admin page (field, widget, template... whatever) to edit xml-formatted contents of TextFields. Every child node of the xml data has to be editable in a *separate* TextField. Simple example: I want to store some information about books, but for every book there is a different set of information available. So I am going to store the xml-formatted information set into a single TextField. (Unfortunately it is not possible to split up the information set into a 1:n-relation - for internal reasons). The only information available for all books is the book's name. So I define this Book class: class Book(models.Model): name = models.CharField('name of the book', max_length=200) infoset_xml = models.TextField('additional info') The contents of infoset_xml are expected to look like this: John Smith 234 or >1987-06-05 42 $1,50 The "ordinary user"'s admin page should contain one TextField for the book's name and one additional TextField for every info-node within infoset_xml. The "administrator"'s admin page should contain one TextField for the book's name and one TextField for editing the raw infoset_xml. Unfortunately I've failed in implemeting the "ordinary user"'s admin page (using MultiValueField and MultiWidget, and lxml for xml parsing). The problem is, that it's not determined how many info-nodes infoset_xml may contain. So the admin page has to dynamically adapt to the number of info-nodes. Is that possible? I'm desperately hoping that somebody can give me a hint on how to implement it. TIA and regards, -Stephan --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
How to change ordering of m2m-fields in newforms-admin?
Hello all, maybe there are some newforms-admin experts out there: What's the right way to change the ordering of ManyToMany-fields (displayed as select widgets) in newforms-admin? I need to change the ordering *without* changing the respective model class. Background: The default ordering of the contrib.auth User class was removed from trunk (see ticket #6089). But I need an ordererd user selection widget for my ManyToMany-fields relating to the User class. BTW, how can I replace the default widget for a specific field to be used in the newforms-admin form? I didnt't find any docs on this. Regards -Stephan --~--~-~--~~~---~--~~ 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: Unsorted user selection widget after changeset 7806 (nfa)
On 4 Jul., 15:52, "Karen Tracey" <[EMAIL PROTECTED]> wrote: > You've waited one day right at the beginning of a big holiday weekend in the > US; [...] Ooops, sorry. I didn't think about this. Thanks for your feedback! -Stephan --~--~-~--~~~---~--~~ 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: Unsorted user selection widget after changeset 7806 (nfa)
Hm, it seems to me that nobody has a solution? Do I have to replace the many-to-many-relation (editors) with an additional ArticleEditor- class, containting a one-to-many relation to the User class and a one- to-many relation to Article? Is this the only way to get a sorted User selection widget? Kind regards -Stephan On 3 Jul., 13:56, spacetaxi <[EMAIL PROTECTED]> wrote: > Hello, currently I'm a little bit lost on this one... Maybe some kind > soul can give me a hint? > > Look at this excerpt of a model class: > > - > from django.db import models > from django.contrib.auth.models import User > class Article(models.Model): > # (...snip...) > editors = models.ManyToManyField(User, > related_name='articles_from_editor') > # (...snip...) > - > > Everything was fine up to changeset 7806, which removed the default > ordering of the User class:http://code.djangoproject.com/changeset/7806 > > After changeset 7806 the user selection widget in the admin form for > my Article class contains *unsorted* usernames. This is a major > problem when there are a lot of users existing in the database... > > So what's the easiest and most elegant way to get the user selection > widget sorted again? > > BTW, I'm using the newforms-admin branch. > > TIA > -Stephan --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Unsorted user selection widget after changeset 7806 (nfa)
Hello, currently I'm a little bit lost on this one... Maybe some kind soul can give me a hint? Look at this excerpt of a model class: - from django.db import models from django.contrib.auth.models import User class Article(models.Model): # (...snip...) editors = models.ManyToManyField(User, related_name='articles_from_editor') # (...snip...) - Everything was fine up to changeset 7806, which removed the default ordering of the User class: http://code.djangoproject.com/changeset/7806 After changeset 7806 the user selection widget in the admin form for my Article class contains *unsorted* usernames. This is a major problem when there are a lot of users existing in the database... So what's the easiest and most elegant way to get the user selection widget sorted again? BTW, I'm using the newforms-admin branch. TIA -Stephan --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Django as front-end for php- and zope2-based apps?
On 29 Jun., 18:44, "Alex Ezell" <[EMAIL PROTECTED]> wrote: > It's pretty simple to get Django and PHP to share the same > session information once a user has been logged in on the > PHP side. I'd like to do it the other way around: Login with django and share the authentication with PHP and Zope2. > I can provide more details on the session sharing if you wish. Currently I'm just checking which options are reasonable. But I'll happily get back on your offer when I start implementing this functionality! So thank you very much! -Stephan --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Django as front-end for php- and zope2-based apps?
On 29 Jun., 18:41, "Ariel Mauricio Nunez Gomez" <[EMAIL PROTECTED]> wrote: > I have 'integrated' django and moodle in the past. For authentication I > would suggest using a single source (In my case is imap auth using google > apps for your domain) and both moodle and django validate credentials > against it. Users are authenticated with ldap. So there are identical credentials for django and moodle (and our other web apps). > It is very easy to write django models to get access to moodle functions. Up to now I don't havy any experience with moodle. I'm hoping I don't have to become an expert on moodle internals just to "embed" it into my django app, as I fear it to be a rather complex system - and becoming an expert to be a very time consuming task... Hence my idea of a rather generic approach to the problem. ;-) > However I wouldn't recommend the django-app as proxy approach you suggest, > better to write some matching moodle themes and css for django apps and use > something like nginx to do the routing. I don't know nginx... Does it give us more options than Apache? Our setup is as follows: We have Apache2 running as the only "visible" server. It serves PHP and static files and it acts as proxy for Django and Zope2 running on the same machine. But my suggested proxy approach even would allow for "django-embedded" php/zope apps running on other machines. It would give us rather flexible options... if it'd work. ;-) Thanks for your feedback! -Stephan --~--~-~--~~~---~--~~ 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 as front-end for php- and zope2-based apps?
Hello djangonauts, maybe someone of you has a good solution for the following scenario: We have several rather complex web applications (partly php-based, partly zope2-based) and I'd like to integrate them into one django- based front-end. New apps will be implemented with django, but we definitely need these "legacy" (php/zope2) apps to be available to the user within *one* front-end. Ideally the different apps should look like they actually were *one* app. (By the way, one of the php-based apps is Moodle (www.moodle.org).) This is my vision: After an user has logged into the (to-be-developed) django site, he get's some kind of "menu bar" (based on yahoo's yui) on the top of the screen. Every menu item selects a different web application, which may be django-based, php-based or zope2-based. The selected application will be shown below the menu bar, so the user can use the menu-bar to switch between the different web apps. Do you have an idea, how this could be implemented? Currently, I'm thinking about implementing some kind of http-proxy within my django-app, so django would forward the incoming requests (get/post) to the particular application. When receiving the response, django could modify the html source so the content gets embedded into my common page template (with the menu bar at the top of the page). Additionally I'd implement a "authentication bridge" between the different apps to share the login information with django. Is this a reasonable way to do it? Or do you have a better approach? Thank in advance for any hint! -Stephan --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Strange translation/encoding problem
Hi list, my django is completely utf8-configured. I'm using I18N and my msg-ids (po-files) are utf8-encoded, too. But now I've run into a strange problem: Translation of strings containing non-ascii characters is working great in templates, but it fails if I try to translate non-ascii strings in a view. For example, this get's translated without problems: {% trans "Lösung" %} But this one fails: from django.utils.translation import ugettext as _ def index(request): teststring = _("Lösung") [...] This exception is raised when the view is called: -- Traceback (most recent call last): File "/usr/local/lib/python2.4/site-packages/django/core/handlers/ base.py" in get_response 77. response = callback(request, *callback_args, **callback_kwargs) File "/usr/local/django/myproject/../myproject/portal/views.py" in index 8. teststring = _("Lösung") File "/usr/local/lib/python2.4/site-packages/django/utils/translation/ __init__.py" in ugettext 61. return real_ugettext(message) File "/usr/local/lib/python2.4/site-packages/django/utils/translation/ trans_real.py" in ugettext 274. return do_translate(message, 'ugettext') File "/usr/local/lib/python2.4/site-packages/django/utils/translation/ trans_real.py" in do_translate 258. return getattr(t, translation_function)(message) UnicodeDecodeError at / 'ascii' codec can't decode byte 0xc3 in position 1: ordinal not in range(128) -- Why does it work within templates but not within views?? What am I doing wrong? Any hint? (BTW, I'm using the current django trunk.) TIA -Stephan --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Is the software behind the Djangobook available?
Filipe Correia wrote: Just for the record, I would also be very interested in this! Yes, it would be *really* great to have this software available! :-) Regards -Stephan --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---