Re: How to sync admin interface with DB
On Tue, May 6, 2008 at 1:25 PM, Martin Diers <[EMAIL PROTECTED]> wrote: > > The Admin is created on the fly. There is nothing for it to restart > from scratch. Are you running the Django development server (the one > that defaults to localhost:8000) or are you running this under another > web server, like Apache? If you are using Apache + mod_python then you > must restart Apache after changing any code. > Oh! Thanks. I am using mod_python. That fix the problem. =) --~--~-~--~~~---~--~~ 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: IIS 6 PyISAPIe problems
I would love to try, but documentation is sketchy. Can someone provide more detailed instructions? 头太晕 wrote: > Try this http://code.google.com/p/pyisapi-scgi/ > > On Tue, May 6, 2008 at 2:11 AM, shocks <[EMAIL PROTECTED]> wrote: > > > > > Hi > > > > I have followed the Django IIS installation guide on the Django > > website but I'm getting the following error when I point to the > > helloworld.py example: > > > > Internal Server Error > > An error occurred processing this request. > > > > Request handler failed > > > > Traceback (most recent call last): > > File "C:\Python25\Lib\Http\Isapi.py", line 42, in Request > >imp.load_source(Name, Env.SCRIPT_TRANSLATED).Request > > File "\\?\C:\Inetpub\wwwroot\slamprwebsite\helloworld.py", line 1, > > in > >from django.http import HttpResponse > > ImportError: No module named django.http > > > > > > Additional Information > > > > > > Module Search Path: > > > > C:\Python25 > > C:\WINDOWS\system32\python25.zip > > C:\Python25\Lib > > C:\Python25\DLLs > > C:\Python25\Lib\lib-tk > > c:\windows\system32\inetsrv > > > > Any ideas. I managed to get this working on another Win 2003 Server > > box but not this one. > > > > Thanks > > Ben > > > > > --~--~-~--~~~---~--~~ 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 sync admin interface with DB
On May 5, 2008, at 11:56 PM, Timothy Wu wrote: > > I'm sorry, could someone gives me a clarification? > > Maybe I should describe it more clearly. My models.py and my > database ARE in sync and they're with the tables and the fields I > want. It's the admin interface that's out of sync, it's showing a > table not existing in the database and mode, and when I tried to > edit that table in the admin interface it will say: > > Something's wrong with your database installation. Make sure the > appropriate database tables have been created, and make sure the > database is readable by the appropriate user. > > What I am hoping to do is just to start the admin interface all over > from scratch (in a clean slate) as if I've never used it, including > creating the user account. > > Does django offer a facility to doing that? > The Admin is created on the fly. There is nothing for it to restart from scratch. Are you running the Django development server (the one that defaults to localhost:8000) or are you running this under another web server, like Apache? If you are using Apache + mod_python then you must restart Apache after changing any code. --~--~-~--~~~---~--~~ 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: IIS 6 PyISAPIe problems
Try this http://code.google.com/p/pyisapi-scgi/ On Tue, May 6, 2008 at 2:11 AM, shocks <[EMAIL PROTECTED]> wrote: > > Hi > > I have followed the Django IIS installation guide on the Django > website but I'm getting the following error when I point to the > helloworld.py example: > > Internal Server Error > An error occurred processing this request. > > Request handler failed > > Traceback (most recent call last): > File "C:\Python25\Lib\Http\Isapi.py", line 42, in Request >imp.load_source(Name, Env.SCRIPT_TRANSLATED).Request > File "\\?\C:\Inetpub\wwwroot\slamprwebsite\helloworld.py", line 1, > in >from django.http import HttpResponse > ImportError: No module named django.http > > > Additional Information > > > Module Search Path: > > C:\Python25 > C:\WINDOWS\system32\python25.zip > C:\Python25\Lib > C:\Python25\DLLs > C:\Python25\Lib\lib-tk > c:\windows\system32\inetsrv > > Any ideas. I managed to get this working on another Win 2003 Server > box but not this one. > > Thanks > Ben > > > --~--~-~--~~~---~--~~ 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 sync admin interface with DB
On Tue, May 6, 2008 at 11:37 AM, Martin Diers <[EMAIL PROTECTED]> wrote: > > > On May 5, 2008, at 8:56 PM, Timothy Wu wrote: > > Sounds like you need to update your Django models. > > > > I ran manage.py reset appname. All the problems I describe still > > remain. The admin interface is still having problems. > > > > No, resetting the app will not help if your models.py file still > contains models for the tables you no longer need. > > In fact, resetting the app would have re-created the tables you no > longer want, because they were still contained in your model. You will > need to delete them from the model, end then drop the tables from our > database yet again, or run reset once more. > I'm sorry, could someone gives me a clarification? Maybe I should describe it more clearly. My models.py and my database ARE in sync and they're with the tables and the fields I want. It's the admin interface that's out of sync, it's showing a table not existing in the database and mode, and when I tried to edit that table in the admin interface it will say: Something's wrong with your database installation. Make sure the appropriate database tables have been created, and make sure the database is readable by the appropriate user. What I am hoping to do is just to start the admin interface all over from scratch (in a clean slate) as if I've never used it, including creating the user account. Does django offer a facility to doing that? --~--~-~--~~~---~--~~ 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: New to django and python. error following tutorial w/ the shell
On 06-May-08, at 10:02 AM, Norman wrote: > Kenneth Gonsalves escribió: >> >> On 06-May-08, at 9:37 AM, Jason Ourscene wrote: >> >>> def __unicode__(self): >> >> def __unicode__(self): <- space after 'def'. If you use a >> python editor it will find errors like this >> > and what editor do you use? > some advice? textmate on mac and SPE or eric4 on linux -- regards kg http://lawgon.livejournal.com http://nrcfosshelpline.in/code/ --~--~-~--~~~---~--~~ 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: Database Migration Question
On Tue, May 6, 2008 at 11:57 AM, jack <[EMAIL PROTECTED]> wrote: > > Are there any Python/Django methods that represent generic database > commands such as creating a new table, renaming or dropping a column, > etc.? My thinking is that if these generic methods existed, so that > all I needed to do was specifiy the correct info abt my DBMS in the > Settings file, I could create my own migrations as custom Views. I > could invoke these via the web as well after having copied my latest > code to my production server. There isn't anything built into Python or Django, but there are a few projects running externally to Django that implement this sort of feature. Personally, I would recommend Django Evolution [1] - but then, I'm one of the developers of that project. If you search the django-users and django-developers archives for "schema evolution", you will find references to a few other projects. [1] http://code.google.com/p/django-evolution Yours, Russ Magee %-) --~--~-~--~~~---~--~~ 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: New to django and python. error following tutorial w/ the shell
Kenneth Gonsalves escribió: > > On 06-May-08, at 9:37 AM, Jason Ourscene wrote: > >> def __unicode__(self): > > def __unicode__(self): <- space after 'def'. If you use a > python editor it will find errors like this > and what editor do you use? some advice? -- Norman F. Sáez Ingeniería Civil Informática Universidad Técnica Federico Santa María Valparaíso, Chile. --~--~-~--~~~---~--~~ 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: New to django and python. error following tutorial w/ the shell
On 06-May-08, at 9:37 AM, Jason Ourscene wrote: > def __unicode__(self): def __unicode__(self): <- space after 'def'. If you use a python editor it will find errors like this -- regards kg http://lawgon.livejournal.com http://nrcfosshelpline.in/code/ --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
New to django and python. error following tutorial w/ the shell
So i got it django up and running on my mac and am totally excited to get started, i got a bit into the tutorial when i got to the point where it asked me to add the __unicode__ method to my model. When i add it to my model and try to use the shell i get this error. If you anyone can help me with this it would be great, im really excited to keep learning. ps. different subject, can anyone recommend a good noob python book. (i know general concepts of programming and messed with ruby for a bit, but want to jump into python.) Traceback (most recent call last): File "manage.py", line 11, in ? execute_manager(settings) File "/opt/local/lib/python2.4/site-packages/django/core/management/ __init__.py", line 272, in execute_manager utility.execute() File "/opt/local/lib/python2.4/site-packages/django/core/management/ __init__.py", line 219, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "/opt/local/lib/python2.4/site-packages/django/core/management/ base.py", line 72, in run_from_argv self.execute(*args, **options.__dict__) File "/opt/local/lib/python2.4/site-packages/django/core/management/ base.py", line 86, in execute output = self.handle(*args, **options) File "/opt/local/lib/python2.4/site-packages/django/core/management/ base.py", line 168, in handle return self.handle_noargs(**options) File "/opt/local/lib/python2.4/site-packages/django/core/management/ commands/shell.py", line 18, in handle_noargs loaded_models = get_models() File "/opt/local/lib/python2.4/site-packages/django/db/models/ loading.py", line 134, in get_models self._populate() File "/opt/local/lib/python2.4/site-packages/django/db/models/ loading.py", line 55, in _populate self.load_app(app_name, True) File "/opt/local/lib/python2.4/site-packages/django/db/models/ loading.py", line 70, in load_app mod = __import__(app_name, {}, {}, ['models']) File "/Users/jasoncalleiro/dev/mysite/../mysite/polls/models.py", line 6 def __unicode__(self): ^ SyntaxError: invalid syntax --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Database Migration Question
Are there any Python/Django methods that represent generic database commands such as creating a new table, renaming or dropping a column, etc.? My thinking is that if these generic methods existed, so that all I needed to do was specifiy the correct info abt my DBMS in the Settings file, I could create my own migrations as custom Views. I could invoke these via the web as well after having copied my latest code to my production server. If these methods do not exist, how difficult would it be to create them? Jack --~--~-~--~~~---~--~~ 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 sync admin interface with DB
On May 5, 2008, at 8:56 PM, Timothy Wu wrote: > Sounds like you need to update your Django models. > > I ran manage.py reset appname. All the problems I describe still > remain. The admin interface is still having problems. > No, resetting the app will not help if your models.py file still contains models for the tables you no longer need. In fact, resetting the app would have re-created the tables you no longer want, because they were still contained in your model. You will need to delete them from the model, end then drop the tables from our database yet again, or run reset once more. -- Martin Diers --~--~-~--~~~---~--~~ 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: What Django version should I use?
On May 5, 2008, at 11:18 AM, Daniel Strasser wrote: > > Is it recommended to use the development version for a project that > starts now (or in a week ;-)) To add to what others have said, use the development version, definitely, except I would strongly recommend that you use the newforms-admin branch. This is the future, but it will be some time before it is merged to the trunk. This branch usually does not lag behind the trunk for more than a couple weeks. It is the "right" way to do the admin backend, because it separates the admin configuration from the database model. The challenge for a new Django user, however, will be that any online documentation for the admin does not apply at all to newforms-admin. I'm fairly new at Django myself, however, and was able to pick of the differences very quickly. -- Martin Diers --~--~-~--~~~---~--~~ 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: What Django version should I use?
On 05-May-08, at 9:48 PM, Daniel Strasser wrote: > Is it recommended to use the development version for a project that > starts now (or in a week ;-)) yes - unless you want to miss out on a lot of goodies and are masochist enough to enjoy upgrading your project through a bunch of backward incompatible changes later when you are in production. -- regards kg http://lawgon.livejournal.com http://nrcfosshelpline.in/code/ --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
beautiful soup
I installed the basic blog app, and it works mostly fine, except that it is somehow connected to beautiful soup. I also downloaded beautifulsoup and I can't quite figure how to get it to interact properly with the admin section. When I try to add a blog entry, I get an error TemplateSyntaxError at /admin/blog/post/add/ 'inlines' is not a valid tag library: Could not load template library from django.templatetags.inlines, No module named inlines and it points to In template c:\python25\lib\site-packages\djtrunk\mysite\blog\templates \admin\blog\post\change_form.html, error at line 4 'inlines' is not a valid tag library: Could not load template library from django.templatetags.inlines, No module named inlines 1 {% extends "admin/change_form.html" %} 2 3 {% block extrahead %} 4 {% load adminmedia inlines %} . . . I know I am supposed to import beautiful soup somewhere, but where? --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
New snippet: Tenjin integration as a decorator
http://www.djangosnippets.org/snippets/739/ This provides basic Tenjin integration, using a decorator. Tenjin is a blazingly fast templating system, the fastest pure-python system available. You can find it here: http://www.kuwata-lab.com/tenjin/ For usage and configuration, see the example in the code. I modeled this after Robert Thomson's code for Mako integration. Tenjin does not provide its own error page, so Django's standard error handling will take over (which I prefer anyway). Also, you will notice that the decorator takes two arguments. The second is for a layout file, which can be specified in the render call, dramatically simplifying the structure of the templates as compared to Mako. -- Martin Diers --~--~-~--~~~---~--~~ 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: xml serialization with nested models
On Tue, May 6, 2008 at 8:52 AM, Explore <[EMAIL PROTECTED]> wrote: > > Hi. I have been trying to get django to return my models as xml. I > have tried using the xml serializer but i cannot get it to send back > anything but the initial model. > > I would like to get nested xml like below (where Department has a > ForeignKey to Organization). That may be what you want, but that's not what the Django serializer provides. The original design goal of the Django serializer was to allow for the definition of fixtures; output in the format you describe only serves to complicate the deserialization process. However, the idea is a good one. What you have requested has been suggested before. It is logged as ticket 4656 [1], and has been accepted as a feature request. [1] http://code.djangoproject.com/ticket/4656 As I see it, you have two options: 1) Write your own custom XML serializer that outputs the format you want. Serializers are actually pretty simple to write - it's deserializers that cause the most problems, so this probably isn't as difficult as you think. 2) Work out a patch to allow this sort of expansion in the Django serializers. If a patch (with tests and documentation) were to be provided, it would eventually find itself in the trunk. Yours, Russ Magee %-) --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
xml serialization with nested models
Hi. I have been trying to get django to return my models as xml. I have tried using the xml serializer but i cannot get it to send back anything but the initial model. I would like to get nested xml like below (where Department has a ForeignKey to Organization). My Org Department 1 Department 2 Department 3 I have tried a number of methods, including: u = Organization.objects.select_related().get(pk=1) d = u.department_set.all() data = serializers.serialize("xml", d) This only gives all departments Thanks for any help. --~--~-~--~~~---~--~~ 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: where can i download newformsadmin
Hmm seems to work now. I could not finish checking it out the other day. On May 6, 2:06 am, "Horst Gutmann" <[EMAIL PROTECTED]> wrote: > $ svn cohttp://code.djangoproject.com/svn/django/branches/newforms-admin > > Works for me. What error do you get? > > - Horst > > On Mon, May 5, 2008 at 7:56 PM, lowks <[EMAIL PROTECTED]> wrote: > > I tried checking out newformsadmin from svn but it errored out. When i > > try downoading the zip, it similarly errored out. Could someone point > > me somewhere where I can find newformsadmin ? --~--~-~--~~~---~--~~ 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: What Django version should I use?
Daniel Strasser wrote: This is a bit confusing for me, because for me, development versions are - yeah - for developers. And I'm not (yet?) :-) a Django core developer. The development version of django is basically the latest stable, 0.96, plus lots and lots and lots of bugfixes, feature additions, etc. With that come some backwards incompatible API changes. You don't need to be a core developer to use the development version. There are plenty of enhancements that make it worth while. :) Is it recommended to use the development version for a project that starts now (or in a week ;-)) By my personal recommendation, absolutely! The development version is much closer to 1.0 than 0.96. It would be easier to develop your new code against trunk: it will be that much easier to make the transition to 1.0. Have fun! Jeff Anderson signature.asc Description: OpenPGP digital signature
Re: Code works with Django's server, but not with Apache+mod_python?
When I installed my web at webfaction I did this to see which module python use, at settings.py import os import django, PIL logfile = open('path.log', 'w') django_path = django.__file__ pil_path = PIL.__file__ logfile.write('django - %\n pil - %s\n' % (django_path, pil_path)) logfile.close() ... With this code, you can see which module you are using. I can successfully install my web with this trip. Regards 2008/5/5 TP <[EMAIL PROTECTED]>: > > Could you have different PYTHONPATH settings for mod_python vs command > line where you're running the admin server? Different versions of PIL > or something between those two versions? libjpeg and friends installed > in non-standard locations where they're found by the command line > python but not the python being loaded by mod_python? > > On May 2, 5:02 pm, mw <[EMAIL PROTECTED]> wrote: > > Hello, > > > > I've emailed the mailing list in the past because of problems with PIL > > and and image field upload in the admin interface. The problem, just > > got weirder. > > > > I noticed that images were never validating as actual images and were > > constantly being rejected. Out of a hunch, I fired up the django > > built-in server and tried the same page with the same image. This > > time, the image validated and it was correctly uploaded. > > > > Does anyone happen to know what would then be stopping the code from > > validating the image upload when run through apache instead of the > > django development server? > > > > I'm using the SVN of django on OS X. > > > > Thanks in advance, > > mw > > > --~--~-~--~~~---~--~~ 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: deploying django at unix/linux homepage space without root access
Bing wrote: Now if I want to deploy the website so that other people can visit it under my homepage space, http://name.of.some.site/~user/ what should I do? You should use mod_python and apache. If that is too much trouble (probably is based on how your setup sounds), use fastcgi. Don't use the development server for production. I am looking at the http://www.djangoproject.com/documentation/modpython/ and am wondering if something can be done without bugging my system admin. Mod_python will most certainly involve the system admin-- especially since when the code changes on disk, apache must be reloaded. Is it possible that I can still use the existing default apache service without creating a new one on a different port? The best way to go about this would be to either 1) continuously bug your system admin for setup/restarts as needed, or 2) bug your system admin once, and have him set up fastcgi for you. You can restart the python process as needed in that situation. It makes for a friendlier way to have django run in a shared environment. http://www.djangoproject.com/documentation/fastcgi/ Jeff Anderson signature.asc Description: OpenPGP digital signature
Re: Few things ive been wondering
On 5/5/08, phillc ([EMAIL PROTECTED]) wrote: >fourth: > >i never understood this, why do people do > >somevar = "blah blah %s" % anothervar > >instead of "blah bla" + anothervar >? Because you can perform specific string formatting operations at the same time. Plus, the formatting and data are separated, not to mention the readability IMO is better as you'll see below. Take for example a float value of 3.141526. Depending upon the circumstance, you may wish to round this value but you don't want to lose the precision. >>> '%0.2f' % 3.1425 '3.14' It gets _much_ better as there is the ability to name that value for formatting. There are a couple of ways to tap into this but the one I use all the time is from a dictionary, here is a simplistic example. First, you need a dictionary, here's a simple one: >>> somedict = {} >>> somedict['first_name'] = 'Wilber' >>> somedict['last_name'] = 'Snodtgrass' >>> somedict['salutation'] = 'Mr.' Then, when ready, you can use string formatting like this: >>> 'Dear %(salutation)s %(first_name)s %(last_name)s,' % somedict 'Dear Mr. Wilber Snodtgrass,' Sure beats the snod out of: >>> 'Dear ' + somedict['salutation'] + \ ... ' ' + somedict['first_name'] + ' ' + \ ... somedict['last_name'] + ',' 'Dear Mr. Wilber Snodtgrass,' As you can see, complex string formatting is possible. My examples only show a the shiny tail-pipe of a very sweet and powerful vehicle. HTH Scott PS. If all you are doing is terminating a line, then this is fine: text_block + '/n' --~--~-~--~~~---~--~~ 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: Default Pluralize logic
On Tue, May 6, 2008 at 6:10 AM, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > Important, related, post on the dev list: > > "Ditch pluralisation entirely" > > http://groups.google.com/group/django-developers/browse_thread/thread/951d113483083ce9/83c18a7a4b2e136e?lnk=gst=plural#83c18a7a4b2e136e You might want to check the date on that thread before you pull it in for moral support. November 2005 was in the 'pre-magic-removal' era of Django - the discussion that is going on there was the start of some fundamental changes to the way you compose queries - changes that are now fully integrated into Django. Yours, Russ Magee %-) --~--~-~--~~~---~--~~ 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: Get first_name from User Model in to my Model
Are you trying to get first and last names from the User model? That would be either self.user.first_name and self.user.last_name (within model) or student.user.first_name and student.user.last_name (outside of model). Hope that helps a bit. On May 4, 8:13 pm, Jonathan Lukens <[EMAIL PROTECTED]> wrote: > Maybe are wanting to populate that field automatically and you are > looking for a custom save() method? This would do the trick: > ... > def save(self): >self.first_name = self.user.first_name >super(Student, self).save() > > You will also want to add blank=True or editable=False to the > CharField arguments, probably the latter, since if you are doing this > the the prepopulation from the user.first_name field is going to > override anything that is input in a form anyway... > > On May 4, 6:18 pm, chiefmoamba <[EMAIL PROTECTED]> wrote: > > > Hi, > > > I am having a problem getting data from the user model in to my model > > (below). I can get the usernames easy enough using "user = > > models.ForeignKey(User)", but how then do I get the first_name & > > last_name in to my model from the user model? > > > Any ideas appreciated, > > > Thanks, > > > Ed > > > class Student(models.Model): > > user = models.ForeignKey(User) > > first_name = models.CharField(maxlength=40) > > age = models.IntegerField() > > location = models.CharField(maxlength=40) > > > def __str__(self): > > return self.first_name > > > class Admin: > > list_display = ('user', 'age', 'location',) > > list_filter = ('user', 'location',) > > ordering = ('-user',) > > search_fields = ('user',) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Issues with EmailMultiAlternatives and Gmail
Hi, I've had trouble sending multipart (plain+html) emails to Gmail users. While emails are correctly displayed in any other email client, Gmail displays the plain text version instead of the HTML, although the HTML is set as primary. After googling I think this is a known issue with Gmail, but I haven't been able to find a work-around. Have you come across that issue before, and would you know how to fix that? Below is my code. Cheers! Julien from django.conf import settings from django.core.mail import EmailMultiAlternatives, SMTPConnection smtp_server='blabla' smtp_user='blabla' smtp_pass='blabla' def html_mail(subject, recipient, html_contents, text_contents, sender, recipient_name='', sender_name='', charset=None): from_email, to = named(sender, sender_name), named(recipient, recipient_name) msg = EmailMultiAlternatives(subject, html_contents, from_email, [to]) msg.content_subtype = "html" # Main content is now text/html msg.attach_alternative(text_contents, "text/plain") connection = SMTPConnection(host=smtp_server, username=smtp_user, password=smtp_pass) connection.send_messages([msg]) def named(mail,name): if name: return '%s <%s>' % (name,mail) return mail --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
deploying django at unix/linux homepage space without root access
I have a small django application which is running on a development server. The platform is linux and I am able to view the django-powered pages at the url like http://127.0.0.1:8000/ Now if I want to deploy the website so that other people can visit it under my homepage space, http://name.of.some.site/~user/ what should I do? I am looking at the http://www.djangoproject.com/documentation/modpython/ and am wondering if something can be done without bugging my system admin. Is it possible that I can still use the existing default apache service without creating a new one on a different port? Any hints? Many thanks in advance! --~--~-~--~~~---~--~~ 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: Default Pluralize logic
> So you still need to allow for the developer (me) to override the generated > plural. Only now it isn't as clear when I need to do that. With the > current rule, it is straightforward: if the word isn't pluralized by adding > an 's'. The idea is that you wouldn't have to override the generated plural all that often. However, in Django, there are no real restrictions as to what the name of the Model class should be in the first place which makes thinks a lot more challenging when it comes down to converting singular to plural. Flexibility vs Convention I guess. Important, related, post on the dev list: "Ditch pluralisation entirely" http://groups.google.com/group/django-developers/browse_thread/thread/951d113483083ce9/83c18a7a4b2e136e?lnk=gst=plural#83c18a7a4b2e136e Regards, -Alen On May 5, 2:59 pm, "Karen Tracey" <[EMAIL PROTECTED]> wrote: > On Mon, May 5, 2008 at 8:20 AM, [EMAIL PROTECTED] <[EMAIL PROTECTED]> > wrote: > > > > > Thank you for your replies. > > > Just to confirm, I am not referring to a perfect automatic pluralize > > solution. I am very well aware that a silver bullet solution would be > > very difficult, if even possible. > > > I will try make myself more clear now. What I am specifically > > referring to is the 'verbose_name_plural' of the model. > > This is what I have in mind: > > 1. Django initializes (contributes) the 'verbose_name_plural' on model > > class with a call to the pluralize logic to attempt find the relevant > > plural for the given singular. > > 2. If need be, developer overrides the 'verbose_name_plural' in the > > model to define specialized plural. > > So you still need to allow for the developer (me) to override the generated > plural. Only now it isn't as clear when I need to do that. With the > current rule, it is straightforward: if the word isn't pluralized by adding > an 's', I need to provide the proper plural myself. With this proposal, I > have no idea under what circumstances I need to provide the plural. Seems > like I have to go look at the pluralization rules file and try to figure out > if my exception is covered. Or just try it out with the default and see if > it comes out right. Both seem like more work, and more error-prone, than > just providing the proper plural if it isn't formed by adding an 's'. > > Karen > > > 3. Developer calls model_obj.verbose_name_plural in template. > > > Here is an example adapted from the "Diving into Python" book > > regarding the pluralization that I have in mind: > > > # plural.py # > > import re > > > def _regex_rules(lang): > > rules_file = file("manager/pluralrules/%s" % lang) > > for line in rules_file: > > pattern, search, replace = line.split() > > yield lambda word: re.search(pattern, word) and re.sub(search, > > replace, word) > > rules_file.close() > > > def pluralize(noun, lang='en'): > > """Returns a plural of a given noun""" > > for rule in _regex_rules(lang): > > result = rule(noun) > > if result: return result > > > # end - plural.py # > > > # ./pluralrules/en # > > [ml]ouse$ ([ml])ouse$ \1ice > > child$ child$ children > > booth$ booth$ booths > > foot$ foot$ feet > > ooth$ ooth$ eeth > > l[eo]af$ l([eo])af$ l\1aves > > sis$ sis$ ses > > man$ man$ men > > ife$ ife$ ives > > eau$ eau$ eaux > > lf$ lf$ lves > > [sxz]$ $ es > > [^aeioudgkprt]h$ $ es > > (qu|[^aeiou])y$ y$ ies > > $ $ s > > # end - ./pluralrules/en # > > > Change in the Django code > > > # django/db/models/options.py ## > > Replace: > > --- > > setattr(self, 'verbose_name_plural', > > meta_attrs.pop('verbose_name_plural', string_concat(self.verbose_name, > > 's'))) > > > With something like: > > --- > > setattr(self, 'verbose_name_plural', > > meta_attrs.pop('verbose_name_plural', pluralize(self.verbose_name, > > get_locale_code( > > > *Note: get_locale_code() would return the current locale code (e.g. > > 'en' for English). > > > # > > > As you can see in the django/db/models/options.py, a model class > > contribution is made by adding the attribute 'verbose_name_plural' > > with a simple 's' character append logic. > > I believe we can handle more than just 's' on initialization with a > > similar example as above. (Was very tempted to use the word 'simple' > > again. Can't stand the heat though. :-)) > > > Regards, > > -Alen Ribic > > > On May 5, 4:57 am, "Russell Keith-Magee" <[EMAIL PROTECTED]> > > wrote: > > > On Mon,
Re: IIS 6 PyISAPIe problems
I'm getting this error. What's missing? Any idea? === Internal Server Error An error occurred processing this request. Request handler failed Traceback (most recent call last): File "C:\Python25\Lib\Http\Isapi.py", line 42, in Request imp.load_source(Name, Env.SCRIPT_TRANSLATED).Request IOError: [Errno 2] No such file or directory === --~--~-~--~~~---~--~~ 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: Few things ive been wondering
see comments inline... On 5/5/08, phillc <[EMAIL PROTECTED]> wrote: > > there has been a few things that i feel have been holding back from > making my code structure/process better. i was hoping someone could > help me on some of these questions. > > first: > > How does one develop tests for django web apps? > im having trouble writing tests. > i understand there are view tests, but those are so overly complex to > write. > i was just wondering how other people approach it, and if anyone can > point me to some open source application that uses tests properly. > i would love to give test driven development a try, but right now, i > feel that my code is too bound to code in my view, which im having > trouble making unit tests for. (id love to see a django project > somewhere that was test driven) > My tests are pretty much limited to model functions, I do not test a great deal of my view logic. Just my preference. > second: > > i have a model object, that "has many" of another object, which "has > many" of another object. (relations) > i want to display each in groups based on their parents > which is better design? > pass the top most parent to the template, and have the template go > through each of the top obect then each of the next object > =or= > have the view do it and pass it to the template > > I do as much of this as possible within my model, ie I have a number of models with a self join "parent" All of those models have a recusive function called get_children that can provide me with all of the children and grandchildren, etc... > third: > > in the same situation, where i have several relations > i want to save data, (say i was unable to use model forms) > my forms allow input of the parent, and each of the children model > objects. > is it better to put my save logic in the new form object, or in the > model? > if you say new form object, is there ever a time that you would put > all of your saving logic in the model instead of the form? > > I put any and all model required save logic within the model. My perspective is that if it is of a fundamental nature to the data, it goes in the model, if it is simply fundamental to a specific view or form, I will put it there. > fourth: > > i never understood this, why do people do > > somevar = "blah blah %s" % anothervar > > instead of "blah bla" + anothervar > ? > > fifth: > > in my models, a model object is only aware of the objects above it, > and not below it. > in C, i remember i just declared all functions, with no body to it, at > the top of the file > then all functions were aware of all functions. > how do i do this in python? > > > thanks a ton for your input =) > > > --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Few things ive been wondering
there has been a few things that i feel have been holding back from making my code structure/process better. i was hoping someone could help me on some of these questions. first: How does one develop tests for django web apps? im having trouble writing tests. i understand there are view tests, but those are so overly complex to write. i was just wondering how other people approach it, and if anyone can point me to some open source application that uses tests properly. i would love to give test driven development a try, but right now, i feel that my code is too bound to code in my view, which im having trouble making unit tests for. (id love to see a django project somewhere that was test driven) second: i have a model object, that "has many" of another object, which "has many" of another object. (relations) i want to display each in groups based on their parents which is better design? pass the top most parent to the template, and have the template go through each of the top obect then each of the next object =or= have the view do it and pass it to the template third: in the same situation, where i have several relations i want to save data, (say i was unable to use model forms) my forms allow input of the parent, and each of the children model objects. is it better to put my save logic in the new form object, or in the model? if you say new form object, is there ever a time that you would put all of your saving logic in the model instead of the form? fourth: i never understood this, why do people do somevar = "blah blah %s" % anothervar instead of "blah bla" + anothervar ? fifth: in my models, a model object is only aware of the objects above it, and not below it. in C, i remember i just declared all functions, with no body to it, at the top of the file then all functions were aware of all functions. how do i do this in python? thanks a ton for your input =) --~--~-~--~~~---~--~~ 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: DateField error mysql 5.0.45
On Mon, May 5, 2008 at 4:01 PM, unixdude_from_mars <[EMAIL PROTECTED]> wrote: > I noticed code that worked fine with an earlier version of mysql > accessing a datefield is now broken... Does anyone know if this is > already in bug track or is there a simple fix. > Broken how? Datefields and MySQL certainly work in general, on recent MySQL levels, so there is some crucial information you have left out of the problem description that makes it extremely difficult to provide any useful response. Since you know the symptoms you are seeing, I recommend you do some searches on likely keywords here: http://code.djangoproject.com/query Karen --~--~-~--~~~---~--~~ 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: Subclassing a form, changing one field into required = False
On 5 mei, 14:39, "Karen Tracey" <[EMAIL PROTECTED]> wrote: > On Mon, May 5, 2008 at 7:08 AM, LaundroMat <[EMAIL PROTECTED]> wrote: > > On 1 mei, 13:43, "Karen Tracey" <[EMAIL PROTECTED]> wrote: > > > On Thu, May 1, 2008 at 7:22 AM, LaundroMat <[EMAIL PROTECTED]> wrote: > > > > > Hi - > > > > > Would it be possible to subclass a form class, and in that subclass > > > > define that one of the fields that were required in the parent class > > > > are no longer required in the subclass? > > > > You mean like this? > > > > >>> from django import newforms as forms > > > >>> class Form1(forms.Form): > > > > ... f1 = forms.CharField() > > > ... f2 = forms.CharField() > > > ... f3 = forms.CharField() > > > ...>>> class Form2(forms.Form): > > > > ... f1 = forms.CharField(required=False) > > > ... > > > > >>> f1inst = Form1({'f2': 'x', 'f3': 'y'}) > > > >>> f2inst = Form2({'f2': 'x', 'f3': 'y'}) > > > >>> f1inst.is_valid() > > > False > > > >>> f2inst.is_valid() > > > True > > > > Karen > > > Yes, but I'd like Form2 be a subclass of Form1, so that it also has > > the f2 and f3 attributes. > > Oops, I forgot to base Form2 on Form1. So you mean like this: > > >>> from django import newforms as forms > >>> class Form1(forms.Form): > > ... f1 = forms.CharField() > ... f2 = forms.CharField() > ... f3 = forms.CharField() > ...>>> class Form2(Form1): > > ... f1 = forms.CharField(required=False) > ...>>> f1inst = Form1({'f2': 'x', 'f3': 'y'}) > >>> f2inst = Form2({'f2': 'x', 'f3': 'y'}) > >>> f1inst.is_valid() > False > >>> f2inst.is_valid() > True > >>> f2inst.fields > > {'f1': , 'f2': > , 'f3': > } > > > > which seems to do what you want? Or am I missing something again? > > Karen Dang. There I was, trying to access f2inst's fields by treating them as if they were attributes (ie f2inst.f1, f2inst.f2 etc), which of course did not work. Thanks for the help! --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
DateField error mysql 5.0.45
I noticed code that worked fine with an earlier version of mysql accessing a datefield is now broken... Does anyone know if this is already in bug track or is there a simple fix. james --~--~-~--~~~---~--~~ 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: The connection was reset
On May 5, 2:01 pm, msoulier <[EMAIL PROTECTED]> wrote: > Seems like an issue with the built-in web server. In fact, if I modify handlers/wsgi.py, and print the request object before it gets to get_response(), suddenly it's fine. try: request = WSGIRequest(environ) print "DEBUG:", request response = self.get_response(request) So it sounds like something going into get_response was perhaps not initialized? Mike --~--~-~--~~~---~--~~ 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 sync admin interface with DB
> I was able to populate the table, but the admin interface was having > problem, it was still expecting the old table columns. =/ Sounds like you need to update your Django models. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
dinero y amistad
Hola Les escribo un breve mensaje para invitarles a que se registren gratis en Amigos y ganes al igual que yo, mas de 100 U$ por día solo por invitara amigos a registrarse gratis. Registrate gratis, desde el siguiente enlace: http://amigos.com/go/g959630 Luego de registrarte gratis, ingresa a la siguiente pagina (http:// www.amigoss.negociosenred.info ) donde se explica paso a paso como ganar 3000 U$ al mes simplemente recomendando a otras personas a que se registren gratuitamente.No es una broma, es algo real, Ya he recibido dos cheques en mi casavia correo aereo de 50US$ c/u.Saludos. soledad --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
dinero y amistad
Hola Les escribo un breve mensaje para invitarles a que se registren gratis en Amigos y ganes al igual que yo, mas de 100 U$ por día solo por invitara amigos a registrarse gratis. Registrate gratis, desde el siguiente enlace: http://amigos.com/go/g959630 Luego de registrarte gratis, ingresa a la siguiente pagina (http:// www.amigoss.negociosenred.info ) donde se explica paso a paso como ganar 3000 U$ al mes simplemente recomendando a otras personas a que se registren gratuitamente.No es una broma, es algo real, Ya he recibido dos cheques en mi casavia correo aereo de 50US$ c/u.Saludos. soledad --~--~-~--~~~---~--~~ 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: redirect issue
nvm I figured this one out, now I just cant get it to actually display the data from the object that I add. On May 5, 1:51 pm, woot4moo <[EMAIL PROTECTED]> wrote: > When I add an object to my db I get this problem on the > redirect:http://127.0.0.1:8000/Final/apple/edit/mysite/apple/instead of just > Final/apple > > So the question is how do I strip off the excess of it going to mysite/ > apple so it stops blowing up on the get page, or rather how do I re- > direct to avoid the 404? --~--~-~--~~~---~--~~ 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: IIS 6 PyISAPIe problems
Ben, Where is django? Make sure it's on your pythonpath (or "module search path" as they appear to be calling it below) Adam On Mon, May 5, 2008 at 1:11 PM, shocks <[EMAIL PROTECTED]> wrote: > > Hi > > I have followed the Django IIS installation guide on the Django > website but I'm getting the following error when I point to the > helloworld.py example: > > Internal Server Error > An error occurred processing this request. > > Request handler failed > > Traceback (most recent call last): > File "C:\Python25\Lib\Http\Isapi.py", line 42, in Request > imp.load_source(Name, Env.SCRIPT_TRANSLATED).Request > File "\\?\C:\Inetpub\wwwroot\slamprwebsite\helloworld.py", line 1, > in > from django.http import HttpResponse > ImportError: No module named django.http > > > Additional Information > > > Module Search Path: > > C:\Python25 > C:\WINDOWS\system32\python25.zip > C:\Python25\Lib > C:\Python25\DLLs > C:\Python25\Lib\lib-tk > c:\windows\system32\inetsrv > > Any ideas. I managed to get this working on another Win 2003 Server > box but not this one. > > Thanks > Ben > > > --~--~-~--~~~---~--~~ 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 : Select category -> show subcategory
First of all, I recommend that you read chapter 17 of Django Book (if you haven't already) http://www.djangobook.com/en/1.0/chapter17/ Moving on, you have to create a view, as we are working on Django's admin, then i recommend that you create one like project/app/ admin_views.py with something similar to this code: from indica.geral.models import * from django.http import HttpResponse from django.template import RequestContext from django.utils import simplejson from django.contrib.admin.views.decorators import staff_member_required def country_getStates(request): id = request.GET.get('id','') result = [u.__dict__ for u in State.objects.filter(country=id)] return HttpResponse(simplejson.dumps(result), mimetype='application/ javascript') country_getStates = staff_member_required(country_getStates) Then, you have to customize the change_form.html template with the JS call, something like this (as you can see, i am using JQuery): {% extends "admin/change_form.html" %} {% block extrahead %} http://SERVERNAME/js/jquery-1.2.3.min.js" type="text/ javascript"> $(function(){ $("select#id_country").change(function(){ $.getJSON("/admin/bd1/country/getStates/",{id: $(this).val()}, function(j){ var options = ''; for (var i = 0; i < j.length; i++) { options += ''; } $("select#id_state").html(options); }) }) }) {% endblock %} Create a JS file and put this second script tag in it, that way will be easier to maintain your template. At urls.py you need to add a pattern to reach the view: (r'^admin/bd1/country/getStates/$', 'project.app.admin_views.country_getStates'), This is the classic example of a country -> state interaction, the same for your category -> subcategory need. []s, Diego Ucha On 5 maio, 03:49, martyn <[EMAIL PROTECTED]> wrote: > Thank you, it's just what I wanted, but do I have to write a new > template (admin/model_name/etc...) ? > Or can I define this directly in my model (onchange actions...) ? > > I have the django Book (definitive guide to django) but I can't find > this. > > On 4 mai, 02:26, Diego Ucha <[EMAIL PROTECTED]> wrote: > > > HelloMartyn, > > > The main interaction, that i see you need is: > > (On Product form) User select Category -> Subcategory field is auto- > > filled -> User select a subcategory based on the category selected. > > > Then you will have to use some JS Library (I prefer JQuery, besides > > there are some discussion about those libs on the list). > > > For filling this subcategory field, in terms of data transmission, i > > use JSon, because JQuery has a fine JSon parser, in few lines it's all > > done. > > > []s, > > Diego Ucha > > > On May 2, 6:05 am,martyn<[EMAIL PROTECTED]> wrote: > > > > Hi, > > > > I've created a simple product model : > > > > class Produit(models.Model): > > > nom = models.CharField(maxlength=200) > > > slug = models.SlugField(prepopulate_from=('nom',)) > > > description = models.TextField(blank=True) > > > published = models.BooleanField(default=True) > > > prix_ht = models.DecimalField(max_digits=30, decimal_places=2) > > > famille = models.ForeignKey('Famille') > > > sous_categorie = models.ForeignKey('SousCategorie') > > > clic > > > > class Admin: > > > pass > > > > I've got also Category and SubCategory : > > > > class Categorie(models.Model): > > > nom = models.CharField(maxlength=200) > > > slug = models.SlugField(prepopulate_from=('nom',)) > > > class Admin: > > > pass > > > > def __str__(self): > > > return self.nom > > > > class SousCategorie(models.Model): > > > nom = models.CharField(maxlength=200) > > > slug = models.SlugField(prepopulate_from=('nom',)) > > > categorie = models.ForeignKey('Categorie') > > > class Admin: > > > pass > > > > def __str__(self): > > > return self.nom > > > > Is there a way in django admin, in the Product form, to select the > > > category, then the subcategories of this category only are shown in > > > the select list. > > > > Thanks a lot --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
IIS 6 PyISAPIe problems
Hi I have followed the Django IIS installation guide on the Django website but I'm getting the following error when I point to the helloworld.py example: Internal Server Error An error occurred processing this request. Request handler failed Traceback (most recent call last): File "C:\Python25\Lib\Http\Isapi.py", line 42, in Request imp.load_source(Name, Env.SCRIPT_TRANSLATED).Request File "\\?\C:\Inetpub\wwwroot\slamprwebsite\helloworld.py", line 1, in from django.http import HttpResponse ImportError: No module named django.http Additional Information Module Search Path: C:\Python25 C:\WINDOWS\system32\python25.zip C:\Python25\Lib C:\Python25\DLLs C:\Python25\Lib\lib-tk c:\windows\system32\inetsrv Any ideas. I managed to get this working on another Win 2003 Server box but not this one. Thanks Ben --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
The connection was reset
Hi, I'm currently playing with my Django web interface on a windows XP box with Python 2.5, Django 0.96. Sometimes when I send a redirect in view code, Firefox says, "The connection was reset while the page was loading." Seems like an issue with the built-in web server. Sample code: elif request.method == 'POST': log.debug("in a POST request") request.session['error'] = "Operations not yet implemented" log.debug("sending a redirect") return HttpResponseRedirect(baseurl + 'clients/') Has anyone else seen this? Thanks, Mike --~--~-~--~~~---~--~~ 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: where can i download newformsadmin
$ svn co http://code.djangoproject.com/svn/django/branches/newforms-admin Works for me. What error do you get? - Horst On Mon, May 5, 2008 at 7:56 PM, lowks <[EMAIL PROTECTED]> wrote: > I tried checking out newformsadmin from svn but it errored out. When i > try downoading the zip, it similarly errored out. Could someone point > me somewhere where I can find newformsadmin ? > > > --~--~-~--~~~---~--~~ 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 render of RadioSelect
Karen, That patch is actually kind of beautiful. Just in case someone else is looking at this as of the current codebase the custom renderer would like like this: class MyRenderer(RadioFieldRenderer): def render(self): return mark_safe(u'\n%s\n' % u'\n'.join([u'%s' % w for w in self])) class SearchForm(forms.Form): shape = forms.ChoiceField(widget=forms.RadioSelect(renderer=MyRenderer)) I'd still rather have access to each of the items within the template though. I'm trying to match up each of the radio buttons with an image, and it'd be easier to handle within the template. Thanks, Mike. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
where can i download newformsadmin
I tried checking out newformsadmin from svn but it errored out. When i try downoading the zip, it similarly errored out. Could someone point me somewhere where I can find newformsadmin ? --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
redirect issue
When I add an object to my db I get this problem on the redirect: http://127.0.0.1:8000/Final/apple/edit/mysite/apple/ instead of just Final/apple So the question is how do I strip off the excess of it going to mysite/ apple so it stops blowing up on the get page, or rather how do I re- direct to avoid the 404? --~--~-~--~~~---~--~~ 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: Newbie
Michael, Thanks for taking the time out to answer all my questions. Much appreciated. I think I'm quite sold on Django/Python now. Will start digging into it right away. Thanks, Rajath On 5/5/08, Michael Newman <[EMAIL PROTECTED]> wrote: > > > > > - Is it possible to create WML files (or for that matter any customised > > output that is not out there) easily? Especially by way of XML/XSLT. > > Django is really flexible with it's template and HttpResponse system. > You can specify headers, types and serializations on the fly. Granted > these types of systems aren't as popular as JSON or other types, but I > believe that for an all encompassing framework, Django provides you > with the greatest flexibility on this aspect. Also because it is all > python, you can do anything python can do. > > > - If so, are there many standard templates that can be downloaded and > customised? > > Believe it or not, no, and I wouldn't want it any other way. Templates > are written in pure html with variables punched in. So if there is an > HTML template that you like you can take that and adapt it to fit your > new Django site. Or, as I prefer, you can design your site however you > like, but I am an (x)HTML/CSS guy. > > > - Is there an IDEs that can be used for development? > > Django is python so all python IDEs, Komodo, Wingware, vim, emacs, > etc., work with django modules. There are plugins throughout the web > for specific django-only python (models) and for django templates for > just about any IDE. As i said before the templates are just HTML, so > any HTML IDE will work with Django templates. I, personally, am a big > fan of Textmate and VIM, both with django plugins. > > > - Given my basic needs, do you think Django is good, or some other tech > is better? > > I might be a bit biased, but Django is great and very flexible. Don't > really know precisely what your needs are, and i am really not that > familiar with these really in depth cell phone file types. Out of the > box Django is really powerful and the more you learn python and the > django internals, you can really do some spectacular things really > quickly. IMHO for content management, I can't imagine a better > system. > > Enjoy diving in! > > Michael > > > --~--~-~--~~~---~--~~ 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: Newbie
> - Is it possible to create WML files (or for that matter any customised > output that is not out there) easily? Especially by way of XML/XSLT. Django is really flexible with it's template and HttpResponse system. You can specify headers, types and serializations on the fly. Granted these types of systems aren't as popular as JSON or other types, but I believe that for an all encompassing framework, Django provides you with the greatest flexibility on this aspect. Also because it is all python, you can do anything python can do. > - If so, are there many standard templates that can be downloaded and > customised? Believe it or not, no, and I wouldn't want it any other way. Templates are written in pure html with variables punched in. So if there is an HTML template that you like you can take that and adapt it to fit your new Django site. Or, as I prefer, you can design your site however you like, but I am an (x)HTML/CSS guy. > - Is there an IDEs that can be used for development? Django is python so all python IDEs, Komodo, Wingware, vim, emacs, etc., work with django modules. There are plugins throughout the web for specific django-only python (models) and for django templates for just about any IDE. As i said before the templates are just HTML, so any HTML IDE will work with Django templates. I, personally, am a big fan of Textmate and VIM, both with django plugins. > - Given my basic needs, do you think Django is good, or some other tech is > better? I might be a bit biased, but Django is great and very flexible. Don't really know precisely what your needs are, and i am really not that familiar with these really in depth cell phone file types. Out of the box Django is really powerful and the more you learn python and the django internals, you can really do some spectacular things really quickly. IMHO for content management, I can't imagine a better system. Enjoy diving in! Michael --~--~-~--~~~---~--~~ 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: Upgraded to Trunk - redirrect urls now tweaked
On Mon, May 5, 2008 at 12:17 PM, [EMAIL PROTECTED] < [EMAIL PROTECTED]> wrote: > > I upgraded to trunk for my project. All of a sudden, redirect URLs are > not working right. I have to add a following slash to get them to > work. > > Example: http://www.stpaulswired.org/liquid > Working: http://www.stpaulswired.org/liquid/ > > Any tips on what I might have missed? > > Lemme know. > You don't mention what you upgraded from, so it's hard to be sure. Possibly you are hitting this: http://code.djangoproject.com/wiki/BackwardsIncompatibleChanges#ChangetoAPPEND_SLASHbehaviour Karen --~--~-~--~~~---~--~~ 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: using multiple AdminSites
there's a ticket for this: http://code.djangoproject.com/ticket/5392 thanks to brosner on #django Derek --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Upgraded to Trunk - redirrect urls now tweaked
I upgraded to trunk for my project. All of a sudden, redirect URLs are not working right. I have to add a following slash to get them to work. Example: http://www.stpaulswired.org/liquid Working: http://www.stpaulswired.org/liquid/ Any tips on what I might have missed? Lemme know. Dave --~--~-~--~~~---~--~~ 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: What Django version should I use?
Django keeps the subversion trunk stable, and changes the documentation to reflect the trunk. So I would use the subversion trunk. On Mon, May 5, 2008 at 11:18 AM, Daniel Strasser <[EMAIL PROTECTED]> wrote: > > Hi there > > I'm new to both Django and Python, but I'm so fascinated about Django > that I don't want to use PHP for a new project that is coming up soon. > > Now I'm playing around with the latest "stable" release of Django > (0.96), but both the tutorials and the documentation expects that you > are using the development version (I know the older docs/tuts are > online, too). This is a bit confusing for me, because for me, > development versions are - yeah - for developers. And I'm not > (yet?) :-) a Django core developer. > > Is it recommended to use the development version for a project that > starts now (or in a week ;-)) > > Thanks > Daniel > > > --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
What Django version should I use?
Hi there I'm new to both Django and Python, but I'm so fascinated about Django that I don't want to use PHP for a new project that is coming up soon. Now I'm playing around with the latest "stable" release of Django (0.96), but both the tutorials and the documentation expects that you are using the development version (I know the older docs/tuts are online, too). This is a bit confusing for me, because for me, development versions are - yeah - for developers. And I'm not (yet?) :-) a Django core developer. Is it recommended to use the development version for a project that starts now (or in a week ;-)) Thanks Daniel --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
djangopeople down
I can not access to djangopeople.net... Have you noticed it? Anyone knows the reason? Technical problems? Traffic, bugs??? --~--~-~--~~~---~--~~ 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 sync admin interface with DB
Hi, I am having a big trouble. For some reason I've messed things up and admin interface is showing a table that I already dropped by accessing mysql client directly (oh no...should I not do that?). I don't know exactly how I got to that state. I first created the table, then I decided to change some field name as well as adding new ones. Then I couldn't populate the table with a script I was using, because that syncdb command does't quite sync when you're changing the field names. So I ended up dropping the table using the mysql client and re-created it by syncing it again. I was able to populate the table, but the admin interface was having problem, it was still expecting the old table columns. =/ Actually, it's worse than this. I don't know how I does it but all the sudden the admin interface was not able to log-on with the original username. (Now the username for mysql client and the username for the admin interface is not the same..wans't it the same before?!) I must either be very confused or mess it up somehow, or both. Is there a way to bring everything back to a clean slate? I am just starting out my models.py so I can afford to start the Django app all-over. (I do not want to restart the project, however, since I'm on a shared host and that was already generated on sigh-up through its interface, which I am not familiar with yet) Timothy --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
IOError with Apache/mod_python
A symptom has just developed on our production server (Apache/mod_python/Python 2.3). Sporadically, a 'print' statement (used for logging during development) will fail with the following error: exceptions.IOError [Errno 9] Bad file descriptor In Django development, 'print' statements go to the console. I don't know where the print statements are going to under mod_python, though. I'm sure the end solution is to use a better logging mechanism but I'm really curious why a print statement would crash the app with the error above. It's especially odd that this only happens every hundred requests or so. Thanks for helping! -- Joel --~--~-~--~~~---~--~~ 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: Code works with Django's server, but not with Apache+mod_python?
Could you have different PYTHONPATH settings for mod_python vs command line where you're running the admin server? Different versions of PIL or something between those two versions? libjpeg and friends installed in non-standard locations where they're found by the command line python but not the python being loaded by mod_python? On May 2, 5:02 pm, mw <[EMAIL PROTECTED]> wrote: > Hello, > > I've emailed the mailing list in the past because of problems with PIL > and and image field upload in the admin interface. The problem, just > got weirder. > > I noticed that images were never validating as actual images and were > constantly being rejected. Out of a hunch, I fired up the django > built-in server and tried the same page with the same image. This > time, the image validated and it was correctly uploaded. > > Does anyone happen to know what would then be stopping the code from > validating the image upload when run through apache instead of the > django development server? > > I'm using the SVN of django on OS X. > > Thanks in advance, > mw --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Introducing djangohosting.ch
Hello Djangonauts! I would like to announce djangohosting.ch, a webhosting service for your Django sites. We provide a web interface (written in Django, of course) which includes a one-click Django installer, making it easy to get started with your Django site. The reason for building an own web interface was that there were no existing control panels that matched our requirements – we wanted something that is easily extendable and allows to manage users on several servers. After hacking something together with PHP and phpMyAdmin we quickly realized that this wasn't the way to go. So we chose Django because it is an actively maintained framework, written in a great programming language and coming with features making it easy to quickly develop a web application. Of course, we'll keep adding new things to the web interface in the future. Another great thing is that each user gets its own full-featured lighttpd web server that can be configured to one's needs. Also, custom applications listening on specific ports (like the Django development server) can be set up easily. You can find details about the hosting on our website (www.djangohosting.ch). I'll be happy to answer any questions or comments. Greetings from Switzerland, Thomas Steinacher djangohosting.ch P.S.: Stay tuned for django-cms, a content management system for Django which will be released very soon. --~--~-~--~~~---~--~~ 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: Filefield upload_tol
Hi Mike, Thanks for your attention on this. Kg solved this a few moments back. As suspected, a bit of basic muppetry on my part. Solution was only to change: Upload_to = '/tmp' TO: Upload_to = 'tmp' Nice. -Original Message- From: django-users@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Mike H Sent: 05 May 2008 15:21 To: django-users@googlegroups.com Subject: Re: Filefield upload_tol I can replicate this by putting in a file path that does not exist in the HIP form. The validation fails for the file field but the error is not rendered. edit_inline is known to be buggy - some validation faliures on models that are being edited inline aren't rendered, but the user is told there is an error. I think there are a number of tickets logged, but the official word is to wait until newforms-admin is complete. (I think, anyone know better?) Cheers, Mike On 5 May 2008, at 14:52, Ben Eliott wrote: > > Hi kg, > > Class HIP has a 1-to-many with Property (many HIPs / 1 Property) . The > offending field is HIP.hip > > #CODE > class Property(models.Model): >"""Model of a property""" > > >reference = models.CharField(max_length=20) >Archive = models.BooleanField() >SSTC = models.BooleanField() >price_prefix = > models.IntegerField(max_length=1,choices=PRICE_PREFIX,default=2) > #temp >price = models.DecimalField(max_digits=10,decimal_places=2) >address_1 = models.CharField(max_length=50) >address_2 = models.CharField(max_length=50) >address_3 = models.CharField(max_length=50,blank=True) >address_4 = models.CharField(max_length=50,blank=True) >postcode = models.CharField(max_length=10) >property_type = > models.CharField(max_length=30,choices=TYPES,default='House') >bedrooms = models.IntegerField() >reception_rooms = models.IntegerField(null=True,blank=True) >summary = models.CharField(max_length=200) >description = models.TextField(blank=True) >lease_years = models.IntegerField(null=True,blank=True) >ground_rent = > models > .DecimalField(null=True,max_digits=10,decimal_places=2,blank=True) >service_charge = > models > .DecimalField(null=True,max_digits=10,decimal_places=2,blank=True) >created_at = models.DateTimeField(auto_now_add=True) >modified_at = models.DateTimeField(auto_now=True) > > class HIP(models.Model): >hip = models.FileField(upload_to='/tmp',core=True) >property = > models > .ForeignKey(Property,edit_inline=models.TABULAR,num_in_admin=10,ma > x_num_in_admin=10,min_num_in_admin=10) > > #END > > If I change the upload_to to ='/full/path/to/tmp', (so long as > MEDIA_ROOT = '') it works fine! As soon as I switch to MEDIA_ROOT = > '/full/path/to/' and upload_to = '/tmp' (all slash permutation tried!) > it's 'Please correct the error below'. > > Maybe this will be of help: the MEDIA_URL is: 'http://example.com/tmp/ > (there is a further tmp subdir within that) and when the files save > correctly the admin form shows the link as the absolute path that was > written in upload_to clicking to http//example.com +appended with the > same absolute path 'http://www.example.com/absolute/path/to/file.txt'. > > > -Original Message- > From: django-users@googlegroups.com > [mailto:[EMAIL PROTECTED] On Behalf Of Kenneth Gonsalves > Sent: 05 May 2008 14:29 > To: django-users@googlegroups.com > Subject: Re: Filefield upload_tol > > > > > On 05-May-08, at 6:46 PM, Ben Eliott wrote: > >> Thanks for for your swift attention. >> It reloads the same form with the message at the top: 'Please correct >> the error below.' (although it doesn't actually show any error >> below). > > please paste your model here > > -- > > regards > kg > http://lawgon.livejournal.com > http://nrcfosshelpline.in/code/ > > > > > > > > -- > No virus found in this incoming message. > Checked by AVG. > Version: 7.5.524 / Virus Database: 269.23.8/1415 - Release Date: > 05/05/2008 06:01 > > > > -- No virus found in this incoming message. Checked by AVG. Version: 7.5.524 / Virus Database: 269.23.8/1415 - Release Date: 05/05/2008 06:01 --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
reverse: TypeError: dict objects are unhashable
I get this error when I try to resolve some url pattern name. It seems that mem_args is dict object, but why? % python2.5 manage.py shell >>> from django.core.urlresolvers import reverse >>> reverse('staticpages-staticpage_delete', {'object_id': 4}) Traceback (most recent call last): File "", line 1, in File "/home/sector119/devel/django_src/django/core/urlresolvers.py", line 297, in reverse return iri_to_uri(u'/' + get_resolver(urlconf).reverse(viewname, *args, **kwargs)) File "/home/sector119/devel/django_src/django/utils/functional.py", line 128, in wrapper if mem_args in cache: TypeError: dict objects are unhashable urls.py: urlpatterns = patterns('views.generic', url(r'^$', 'simple.redirect_to', {'url': 'staticpage/'}), url(r'^staticpage/$', 'list_detail.object_search', staticpage_list_info, name='staticpages- staticpage_list'), url(r'page/(?P\d+)/$', 'list_detail.object_search', staticpage_list_info), url(r'^staticpage/(?P\d+)/$', 'list_detail.object_detail', staticpage_detail_info, name='staticpages-staticpage_detail'), url(r'staticpage/create/$', 'create_update.create_object', staticpage_create_update_info, name='staticpages- staticpage_create'), url(r'staticpage/(?P\d+)/update/$', 'create_update.update_object', staticpage_create_update_info, name='staticpages-staticpage_update'), url(r'staticpage/(?P[\d+/]+)/delete/$', 'create_update.delete_object', staticpage_delete_info, name='staticpages-staticpage_delete'), --~--~-~--~~~---~--~~ 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: using frames in django
That is what I figured on doing...I was just seeing if there was an easier way of doing it... Thanks On May 5, 7:10 am, LaundroMat <[EMAIL PROTECTED]> wrote: > On 5 mei, 05:26, Gboro54 <[EMAIL PROTECTED]> wrote: > > > > > > > Hi everyone...I want to use frames in a web app i am building..I have > > a display.html that has the frames sets and takes 2 other html > > files...the one problem is the other 2 pages have variables binded to > > them...I am not sure how to get this to work...any advice would be > > apprciated...Thanks(code provided below for the html) > > > sidbar.html > > > > > > > > > > > > > > > > width="100" align="left"> > > > > > > > main.html > > > > > > > > > > > > > > > > > > > > > > > height="100" align="left"/> > > > align="top"/> > > > > Welcome to Bass Log Online > > > > > > > > > display.html > > > > > > > > > > > > > > > > > > > > > Just use urls in your display.html file, and let urlconf.py translate > those to views. Within those views, you can render your template & > pass along your variables.- Hide quoted text - > > - Show quoted text - --~--~-~--~~~---~--~~ 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: Filefield upload_tol
Hi Kg, You're beautiful, you know that don't you? It worked a treat. And just in time moments before the Chelsea game starts too. When I said all slash permutations tried, I did of course mean, all but that one Thanks a million. Ben -Original Message- From: django-users@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Kenneth Gonsalves Sent: 05 May 2008 15:14 To: django-users@googlegroups.com Subject: Re: Filefield upload_tol On 05-May-08, at 7:22 PM, Ben Eliott wrote: > hip = models.FileField(upload_to='/tmp',core=True) try upload_to='tmp' <--- no '/' -- regards kg http://lawgon.livejournal.com http://nrcfosshelpline.in/code/ -- No virus found in this incoming message. Checked by AVG. Version: 7.5.524 / Virus Database: 269.23.8/1415 - Release Date: 05/05/2008 06:01 --~--~-~--~~~---~--~~ 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: Filefield upload_tol
I can replicate this by putting in a file path that does not exist in the HIP form. The validation fails for the file field but the error is not rendered. edit_inline is known to be buggy - some validation faliures on models that are being edited inline aren't rendered, but the user is told there is an error. I think there are a number of tickets logged, but the official word is to wait until newforms-admin is complete. (I think, anyone know better?) Cheers, Mike On 5 May 2008, at 14:52, Ben Eliott wrote: > > Hi kg, > > Class HIP has a 1-to-many with Property (many HIPs / 1 Property) . The > offending field is HIP.hip > > #CODE > class Property(models.Model): >"""Model of a property""" > > >reference = models.CharField(max_length=20) >Archive = models.BooleanField() >SSTC = models.BooleanField() >price_prefix = > models.IntegerField(max_length=1,choices=PRICE_PREFIX,default=2) > #temp >price = models.DecimalField(max_digits=10,decimal_places=2) >address_1 = models.CharField(max_length=50) >address_2 = models.CharField(max_length=50) >address_3 = models.CharField(max_length=50,blank=True) >address_4 = models.CharField(max_length=50,blank=True) >postcode = models.CharField(max_length=10) >property_type = > models.CharField(max_length=30,choices=TYPES,default='House') >bedrooms = models.IntegerField() >reception_rooms = models.IntegerField(null=True,blank=True) >summary = models.CharField(max_length=200) >description = models.TextField(blank=True) >lease_years = models.IntegerField(null=True,blank=True) >ground_rent = > models > .DecimalField(null=True,max_digits=10,decimal_places=2,blank=True) >service_charge = > models > .DecimalField(null=True,max_digits=10,decimal_places=2,blank=True) >created_at = models.DateTimeField(auto_now_add=True) >modified_at = models.DateTimeField(auto_now=True) > > class HIP(models.Model): >hip = models.FileField(upload_to='/tmp',core=True) >property = > models > .ForeignKey(Property,edit_inline=models.TABULAR,num_in_admin=10,ma > x_num_in_admin=10,min_num_in_admin=10) > > #END > > If I change the upload_to to ='/full/path/to/tmp', (so long as > MEDIA_ROOT = '') it works fine! > As soon as I switch to MEDIA_ROOT = '/full/path/to/' and upload_to = > '/tmp' (all slash permutation tried!) it's 'Please correct the error > below'. > > Maybe this will be of help: the MEDIA_URL is: 'http://example.com/tmp/ > (there is a further tmp subdir within that) and when the files save > correctly the admin form shows the link as the absolute path that was > written in upload_to clicking to http//example.com +appended with the > same absolute path 'http://www.example.com/absolute/path/to/file.txt'. > > > -Original Message- > From: django-users@googlegroups.com > [mailto:[EMAIL PROTECTED] On Behalf Of Kenneth Gonsalves > Sent: 05 May 2008 14:29 > To: django-users@googlegroups.com > Subject: Re: Filefield upload_tol > > > > > On 05-May-08, at 6:46 PM, Ben Eliott wrote: > >> Thanks for for your swift attention. >> It reloads the same form with the message at the top: 'Please correct >> the error below.' (although it doesn't actually show any error >> below). > > please paste your model here > > -- > > regards > kg > http://lawgon.livejournal.com > http://nrcfosshelpline.in/code/ > > > > > > > > -- > No virus found in this incoming message. > Checked by AVG. > Version: 7.5.524 / Virus Database: 269.23.8/1415 - Release Date: > 05/05/2008 06:01 > > > > --~--~-~--~~~---~--~~ 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: Filefield upload_tol
On 05-May-08, at 7:22 PM, Ben Eliott wrote: > hip = models.FileField(upload_to='/tmp',core=True) try upload_to='tmp' <--- no '/' -- regards kg http://lawgon.livejournal.com http://nrcfosshelpline.in/code/ --~--~-~--~~~---~--~~ 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: Filefield upload_tol
Hi kg, Class HIP has a 1-to-many with Property (many HIPs / 1 Property) . The offending field is HIP.hip #CODE class Property(models.Model): """Model of a property""" reference = models.CharField(max_length=20) Archive = models.BooleanField() SSTC = models.BooleanField() price_prefix = models.IntegerField(max_length=1,choices=PRICE_PREFIX,default=2) #temp price = models.DecimalField(max_digits=10,decimal_places=2) address_1 = models.CharField(max_length=50) address_2 = models.CharField(max_length=50) address_3 = models.CharField(max_length=50,blank=True) address_4 = models.CharField(max_length=50,blank=True) postcode = models.CharField(max_length=10) property_type = models.CharField(max_length=30,choices=TYPES,default='House') bedrooms = models.IntegerField() reception_rooms = models.IntegerField(null=True,blank=True) summary = models.CharField(max_length=200) description = models.TextField(blank=True) lease_years = models.IntegerField(null=True,blank=True) ground_rent = models.DecimalField(null=True,max_digits=10,decimal_places=2,blank=True) service_charge = models.DecimalField(null=True,max_digits=10,decimal_places=2,blank=True) created_at = models.DateTimeField(auto_now_add=True) modified_at = models.DateTimeField(auto_now=True) class HIP(models.Model): hip = models.FileField(upload_to='/tmp',core=True) property = models.ForeignKey(Property,edit_inline=models.TABULAR,num_in_admin=10,ma x_num_in_admin=10,min_num_in_admin=10) #END If I change the upload_to to ='/full/path/to/tmp', (so long as MEDIA_ROOT = '') it works fine! As soon as I switch to MEDIA_ROOT = '/full/path/to/' and upload_to = '/tmp' (all slash permutation tried!) it's 'Please correct the error below'. Maybe this will be of help: the MEDIA_URL is: 'http://example.com/tmp/ (there is a further tmp subdir within that) and when the files save correctly the admin form shows the link as the absolute path that was written in upload_to clicking to http//example.com +appended with the same absolute path 'http://www.example.com/absolute/path/to/file.txt'. -Original Message- From: django-users@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Kenneth Gonsalves Sent: 05 May 2008 14:29 To: django-users@googlegroups.com Subject: Re: Filefield upload_tol On 05-May-08, at 6:46 PM, Ben Eliott wrote: > Thanks for for your swift attention. > It reloads the same form with the message at the top: 'Please correct > the error below.' (although it doesn't actually show any error below). please paste your model here -- regards kg http://lawgon.livejournal.com http://nrcfosshelpline.in/code/ -- No virus found in this incoming message. Checked by AVG. Version: 7.5.524 / Virus Database: 269.23.8/1415 - Release Date: 05/05/2008 06:01 --~--~-~--~~~---~--~~ 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: child edit causes duplication with model inheritance
Thanks! On May 4, 2008, at 4:37 AM, James Bennett wrote: > > On Sun, May 4, 2008 at 3:29 AM, bobhaugen <[EMAIL PROTECTED]> > wrote: >> Does that mean newforms-admin includes qs-ref? That is, newforms- >> admin includes all of the most current svn trunk? > > The ideal way to find out this sort of information is to watch the > development timeline: > > http://code.djangoproject.com/timeline > > And specifically the log of the newforms-admin branch: > > http://code.djangoproject.com/log/django/branches/newforms-admin > > > -- > "Bureaucrat Conrad, you are technically correct -- the best kind of > correct." > > > --~--~-~--~~~---~--~~ 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: Filefield upload_tol
On 05-May-08, at 6:46 PM, Ben Eliott wrote: > Thanks for for your swift attention. > It reloads the same form with the message at the top: 'Please correct > the error below.' (although it doesn't actually show any error below). please paste your model here -- regards kg http://lawgon.livejournal.com http://nrcfosshelpline.in/code/ --~--~-~--~~~---~--~~ 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: Filefield upload_tol
Hi kg, Thanks for for your swift attention. It reloads the same form with the message at the top: 'Please correct the error below.' (although it doesn't actually show any error below). Best, Ben -Original Message- From: django-users@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Kenneth Gonsalves Sent: 05 May 2008 13:39 To: django-users@googlegroups.com Subject: Re: Filefield upload_tol On 05-May-08, at 5:33 PM, Ben Eliott wrote: > Hi, I'm getting started in the (highly enjoyable!) admin models - > FileField upload works when I give upload_to the full absolute > filepath. > However, as soon as I try and use MEDIA_ROOT in settings.py it baulks. what do you mean by 'baulks' - what is the error message? -- regards kg http://lawgon.livejournal.com http://nrcfosshelpline.in/code/ -- No virus found in this incoming message. Checked by AVG. Version: 7.5.524 / Virus Database: 269.23.8/1415 - Release Date: 05/05/2008 06:01 --~--~-~--~~~---~--~~ 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: djangoAMF: django and flash
Thanks so much!! It did the trick! Lorenzo sserrano ha scritto: > Hi > If you are using a 64bit arch, there is a bug with a write function. > You can find the reported bug and a patch here: > http://sourceforge.jp/tracker/?atid=9591_id=2585=browse > > Kind Regards, Sebastian.- > > > On 3 mayo, 08:30, Lorenzo <[EMAIL PROTECTED]> wrote: > >> Hi, >> I need to link a flash movie with Django, so I userddjangoAMF. >> I followed the tutorial >> (http://djangoamf.sourceforge.jp/index.php?UserManual_en) and seems to >> work fine, but when I put the results inside a textbox in my flash >> application, it understand data as a float number! >> >> In django I use a simple helloworld function: >> - >> def HelloWorld(req): >> return "HelloWorld" >> -- >> In flash I followed the so the handleResult function is: >> - >> function handleResult(re:ResultEvent):Void { >> this.message_txt.text = re.result;} >> >> - >> >> The result is that in message_txt I find a strange number like >> "4.432432e-123" that seems somehow related to the string (if I change >> string the number change! otherwise it remain the same). >> >> Someone has experience with this kind of problem? >> >> Thanks, >> >> Lorenzo >> > > > > --~--~-~--~~~---~--~~ 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: Default Pluralize logic
On Mon, May 5, 2008 at 8:20 AM, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > Thank you for your replies. > > Just to confirm, I am not referring to a perfect automatic pluralize > solution. I am very well aware that a silver bullet solution would be > very difficult, if even possible. > > I will try make myself more clear now. What I am specifically > referring to is the 'verbose_name_plural' of the model. > This is what I have in mind: > 1. Django initializes (contributes) the 'verbose_name_plural' on model > class with a call to the pluralize logic to attempt find the relevant > plural for the given singular. > 2. If need be, developer overrides the 'verbose_name_plural' in the > model to define specialized plural. So you still need to allow for the developer (me) to override the generated plural. Only now it isn't as clear when I need to do that. With the current rule, it is straightforward: if the word isn't pluralized by adding an 's', I need to provide the proper plural myself. With this proposal, I have no idea under what circumstances I need to provide the plural. Seems like I have to go look at the pluralization rules file and try to figure out if my exception is covered. Or just try it out with the default and see if it comes out right. Both seem like more work, and more error-prone, than just providing the proper plural if it isn't formed by adding an 's'. Karen > 3. Developer calls model_obj.verbose_name_plural in template. > > Here is an example adapted from the "Diving into Python" book > regarding the pluralization that I have in mind: > > # plural.py # > import re > > > def _regex_rules(lang): >rules_file = file("manager/pluralrules/%s" % lang) >for line in rules_file: >pattern, search, replace = line.split() >yield lambda word: re.search(pattern, word) and re.sub(search, > replace, word) >rules_file.close() > > > def pluralize(noun, lang='en'): >"""Returns a plural of a given noun""" >for rule in _regex_rules(lang): >result = rule(noun) >if result: return result > > # end - plural.py # > > # ./pluralrules/en # > [ml]ouse$ ([ml])ouse$ \1ice > child$ child$ children > booth$ booth$ booths > foot$ foot$ feet > ooth$ ooth$ eeth > l[eo]af$l([eo])af$ l\1aves > sis$sis$ses > man$man$men > ife$ife$ives > eau$eau$eaux > lf$ lf$ lves > [sxz]$ $ es > [^aeioudgkprt]h$$ es > (qu|[^aeiou])y$ y$ ies > $ $ s > # end - ./pluralrules/en # > > Change in the Django code > > # django/db/models/options.py ## > Replace: > --- > setattr(self, 'verbose_name_plural', > meta_attrs.pop('verbose_name_plural', string_concat(self.verbose_name, > 's'))) > > With something like: > --- > setattr(self, 'verbose_name_plural', > meta_attrs.pop('verbose_name_plural', pluralize(self.verbose_name, > get_locale_code( > > *Note: get_locale_code() would return the current locale code (e.g. > 'en' for English). > > # > > As you can see in the django/db/models/options.py, a model class > contribution is made by adding the attribute 'verbose_name_plural' > with a simple 's' character append logic. > I believe we can handle more than just 's' on initialization with a > similar example as above. (Was very tempted to use the word 'simple' > again. Can't stand the heat though. :-)) > > Regards, > -Alen Ribic > > > On May 5, 4:57 am, "Russell Keith-Magee" <[EMAIL PROTECTED]> > wrote: > > On Mon, May 5, 2008 at 1:16 AM, [EMAIL PROTECTED] > > > > <[EMAIL PROTECTED]> wrote: > > > > > > Is it? Maybe. I don't know if anyone has proposed smartening-up > Django's > > > > pluralization rules in the past > > > > > I had a look through the mailing-list archive and couldn't spot > > > anything directly related. > > > > Then you haven't looked too hard. Pluralization comes up regularly, > > both in the context of the pluralize filter, and the > > verbose_name/verbose_name_plural option. And if you're calling > > pluralization a simple task, you _really_ haven't done your research. > > > > The short version is that pluralization is _hard_. Automatic > > pluralization, which seems to be what you want, is an effectively > > impossible task, especially in English. English doesn't have regular > > rules for pluralization for anything but trivial cases. About the only > > way to do it effectively is to have a dictionary of all possible > > plurals - and then you hit the religious wars over whether the plural > > of
Re: Another installation problem
Or run Debian testing. Why switch distros or even distro flavors if you don't have to? :) Python 2.5 and most of the packages that are needed for Django are fine straight from apt on testing/unstable. gav Tom Novelli wrote: > Debian Etch is meant to be stable, not up to date (except for security > fixes), so it defaults to Python 2.4. You can install 2.5 but most of > the python-* packages are not available for 2.5 because they were not > deemed stable or didn't build at all. I needed support for Postgres, > LDAP, Oracle and found it was easiest to stick with Python 2.4. If > you really need 2.5, you're probably better off running a leading-edge > distro like Ubuntu or Gentoo. > > Good luck... > Tom > > > On Sat, May 3, 2008 at 12:42 AM, LRP <[EMAIL PROTECTED]> wrote: >> Hi Folks, >> >> I've been trying for days now to correctly install python2.5 and >> psycop2 on my Debian Etch system so I can work with postgresql8.1, >> django, and web2py. >> >> I've installed python2.5 from the Debian repository and made it the >> default choice. When I call python from the CLI I get Python2.5. >> >> But no matter how I try to install psycop2, I can't get django or >> web2py to recognize it. On django it comes up as refusal to connect to >> postgresql; on web2py it comes up as an error message saying "global >> name psycopg2 is not defined'" >> >> Psycopg2 seems to want to install against python2.4. I've tried >> symlinks from /usr/lib/python2.5/site-packages to /usr/lib/2.4/site- >> packages/psycopg2, but that doesn't work; nor have various other >> installation methods that I"ve tried. >> >> Can anyone show me how to correctly install and configure the packages >> I need to run SVN django on Debian Etch and postgresql8.1? Must be >> many others who've confronted the same issues. >> >> Many thanks, >> >> LRP >> > >> > > > --~--~-~--~~~---~--~~ 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: GeoDjangoFriendly?
On Mon, May 5, 2008 at 4:07 AM, tupixo <[EMAIL PROTECTED]> wrote: > > > You may recognize my name from that forum topic. > > > > I've been working for over a week to get PostGIS installed correctly > > for my hosting at WebFaction. The support team is very responsive and > > helpful and we have worked through a lot of issues. That said, it > > still doesn't work correctly. > > > > This is definitely not something they seem to do a lot, so there's no > > set process to actually get everything working. It seems to be a > > one-off thing with a slightly different process for every user. > > > > I'd be glad to share what I've done to get thus far in the process, if > > you're interested. > > > > I want to reiterate that the support guys at WebFaction have really > > worked hard on this and have been very helpful. It just seems like > > it's something that's somewhat non-standard for them. > > > > Of course, if you have a slice at SliceHost, you can install anything > > you want. The limit is only your knowledge and capabilities. > > > > /alex > > WebFaction had a few issues with GeoDjango at first but I think > they've now resolved them because they were able to setup GeoDjango on > 3 of my accounts with no problem. > > Kevin. Hmmm...I wonder why mine is still not working after nearly two weeks of back and forth with them. Can you fix it? :) /alex --~--~-~--~~~---~--~~ 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 Template for_loop by user
On Mon, May 5, 2008 at 7:50 AM, chiefmoamba <[EMAIL PROTECTED]> wrote: > > Hi, > > I'm trying to get a for loop to display data by user. So for example I > have the following that will display all 'courses' running in my > project: > > {% if course %} >There are Courses >The current courses we are running are: {{course|join:", "}} p> > {% else %} >There are currently no courses running. > {% endif %} > > But what I'd ideally like if for the user who is logged in to see just > the courses he/she is on. > > Can any of you suggest how I might do that? > > Thanks for your help - always much appreciated! > Put logic in your view function so that the course template variable provided to the template is filtered to include only courses that request.user is in. Karen --~--~-~--~~~---~--~~ 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: Subclassing a form, changing one field into required = False
On Mon, May 5, 2008 at 7:08 AM, LaundroMat <[EMAIL PROTECTED]> wrote: > On 1 mei, 13:43, "Karen Tracey" <[EMAIL PROTECTED]> wrote: > > On Thu, May 1, 2008 at 7:22 AM, LaundroMat <[EMAIL PROTECTED]> wrote: > > > > > Hi - > > > > > Would it be possible to subclass a form class, and in that subclass > > > define that one of the fields that were required in the parent class > > > are no longer required in the subclass? > > > > You mean like this? > > > > >>> from django import newforms as forms > > >>> class Form1(forms.Form): > > > > ... f1 = forms.CharField() > > ... f2 = forms.CharField() > > ... f3 = forms.CharField() > > ...>>> class Form2(forms.Form): > > > > ... f1 = forms.CharField(required=False) > > ... > > > > >>> f1inst = Form1({'f2': 'x', 'f3': 'y'}) > > >>> f2inst = Form2({'f2': 'x', 'f3': 'y'}) > > >>> f1inst.is_valid() > > False > > >>> f2inst.is_valid() > > True > > > > Karen > > Yes, but I'd like Form2 be a subclass of Form1, so that it also has > the f2 and f3 attributes. > Oops, I forgot to base Form2 on Form1. So you mean like this: >>> from django import newforms as forms >>> class Form1(forms.Form): ... f1 = forms.CharField() ... f2 = forms.CharField() ... f3 = forms.CharField() ... >>> class Form2(Form1): ... f1 = forms.CharField(required=False) ... >>> f1inst = Form1({'f2': 'x', 'f3': 'y'}) >>> f2inst = Form2({'f2': 'x', 'f3': 'y'}) >>> f1inst.is_valid() False >>> f2inst.is_valid() True >>> f2inst.fields {'f1': , 'f2': , 'f3': } >>> which seems to do what you want? Or am I missing something again? Karen --~--~-~--~~~---~--~~ 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: Filefield upload_tol
On 05-May-08, at 5:33 PM, Ben Eliott wrote: > Hi, I'm getting started in the (highly enjoyable!) admin models - > FileField upload works when I give upload_to the full absolute > filepath. > However, as soon as I try and use MEDIA_ROOT in settings.py it baulks. what do you mean by 'baulks' - what is the error message? -- regards kg http://lawgon.livejournal.com http://nrcfosshelpline.in/code/ --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Filefield upload_tol
Hi, I'm getting started in the (highly enjoyable!) admin models - FileField upload works when I give upload_to the full absolute filepath. However, as soon as I try and use MEDIA_ROOT in settings.py it baulks. Permissions are wide open, I've tried every combination of slashes & paths -- but it only likes it when upload_to gets given the absolute path. Any suggestions or even hints of ideas will be most welcome - it's bound to be some small, simple thing! Thank you. Ben --~--~-~--~~~---~--~~ 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: Default Pluralize logic
Thank you for your replies. Just to confirm, I am not referring to a perfect automatic pluralize solution. I am very well aware that a silver bullet solution would be very difficult, if even possible. I will try make myself more clear now. What I am specifically referring to is the 'verbose_name_plural' of the model. This is what I have in mind: 1. Django initializes (contributes) the 'verbose_name_plural' on model class with a call to the pluralize logic to attempt find the relevant plural for the given singular. 2. If need be, developer overrides the 'verbose_name_plural' in the model to define specialized plural. 3. Developer calls model_obj.verbose_name_plural in template. Here is an example adapted from the "Diving into Python" book regarding the pluralization that I have in mind: # plural.py # import re def _regex_rules(lang): rules_file = file("manager/pluralrules/%s" % lang) for line in rules_file: pattern, search, replace = line.split() yield lambda word: re.search(pattern, word) and re.sub(search, replace, word) rules_file.close() def pluralize(noun, lang='en'): """Returns a plural of a given noun""" for rule in _regex_rules(lang): result = rule(noun) if result: return result # end - plural.py # # ./pluralrules/en # [ml]ouse$ ([ml])ouse$ \1ice child$ child$ children booth$ booth$ booths foot$ foot$ feet ooth$ ooth$ eeth l[eo]af$l([eo])af$ l\1aves sis$sis$ses man$man$men ife$ife$ives eau$eau$eaux lf$ lf$ lves [sxz]$ $ es [^aeioudgkprt]h$$ es (qu|[^aeiou])y$ y$ ies $ $ s # end - ./pluralrules/en # Change in the Django code # django/db/models/options.py ## Replace: --- setattr(self, 'verbose_name_plural', meta_attrs.pop('verbose_name_plural', string_concat(self.verbose_name, 's'))) With something like: --- setattr(self, 'verbose_name_plural', meta_attrs.pop('verbose_name_plural', pluralize(self.verbose_name, get_locale_code( *Note: get_locale_code() would return the current locale code (e.g. 'en' for English). # As you can see in the django/db/models/options.py, a model class contribution is made by adding the attribute 'verbose_name_plural' with a simple 's' character append logic. I believe we can handle more than just 's' on initialization with a similar example as above. (Was very tempted to use the word 'simple' again. Can't stand the heat though. :-)) Regards, -Alen Ribic On May 5, 4:57 am, "Russell Keith-Magee" <[EMAIL PROTECTED]> wrote: > On Mon, May 5, 2008 at 1:16 AM, [EMAIL PROTECTED] > > <[EMAIL PROTECTED]> wrote: > > > > Is it? Maybe. I don't know if anyone has proposed smartening-up > > Django's > > > pluralization rules in the past > > > I had a look through the mailing-list archive and couldn't spot > > anything directly related. > > Then you haven't looked too hard. Pluralization comes up regularly, > both in the context of the pluralize filter, and the > verbose_name/verbose_name_plural option. And if you're calling > pluralization a simple task, you _really_ haven't done your research. > > The short version is that pluralization is _hard_. Automatic > pluralization, which seems to be what you want, is an effectively > impossible task, especially in English. English doesn't have regular > rules for pluralization for anything but trivial cases. About the only > way to do it effectively is to have a dictionary of all possible > plurals - and then you hit the religious wars over whether the plural > of octopus is octopus, octopuses, or octopodes. > > Even if you could get English sorted out, then you get the i18n > problem. A few eastern European languages have some very interesting > pluralization rules which further complicates the dream of an > automatic solution. > > So, we have settled with the a naive solution, manually assisted, with > template helpers that cover 95% of cases. "Add an s" works for a good > majority of cases - if that isn't correct, you can manually correct it > in verbose_name_plural. The template filter can handle all the english > cases (worst case being different extensions for 1 and many). This > doesn't cover the needs of the previously mentioned eastern European > languages, but accommodating those languages while keeping the simple > case simple is almost impossible, so users of those languages can > write a custom template tag if they need one. > > Yours, > Russ Magee %-)
Re: Change render of RadioSelect
On Mon, May 5, 2008 at 2:46 AM, Michael Irani <[EMAIL PROTECTED]> wrote: > > Hello, > I'm trying to manipulate the rendering for RadioSelect so that the > form element shows up within my form differently than a . So far > I've come across two options... Use straight form tags in my view, or > to rework RadioFieldRenderer and RadioInput from widgets.py locally so > that I can have a custom renderer. And then use that custom renderer > as the renderer for RadioSelect > > I was wondering if there was a way to bipass these options and just > get at the independant radio buttons that make up the RadioSelect. > Meaning to be able to get all the 2-tuple key-value pairs that makeup > the RadioSelect widget. > RadioSelect allows for you to provide a custom rendering object. See: http://code.djangoproject.com/ticket/4228 Does that not let you do what you want without changing your Django source locally? Karen --~--~-~--~~~---~--~~ 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 for_loop by user
Hi, I'm trying to get a for loop to display data by user. So for example I have the following that will display all 'courses' running in my project: {% if course %} There are Courses The current courses we are running are: {{course|join:", "}} {% else %} There are currently no courses running. {% endif %} But what I'd ideally like if for the user who is logged in to see just the courses he/she is on. Can any of you suggest how I might do that? Thanks for your help - always much appreciated! Ed --~--~-~--~~~---~--~~ 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: child edit causes duplication with model inheritance
On May 4, 3:37 am, "James Bennett" <[EMAIL PROTECTED]> wrote: > On Sun, May 4, 2008 at 3:29 AM, bobhaugen <[EMAIL PROTECTED]> wrote: > > Does that mean newforms-admin includes qs-ref? That is, newforms- > > admin includes all of the most current svn trunk? > > The ideal way to find out this sort of information is to watch the > development timeline: > > http://code.djangoproject.com/timeline > > And specifically the log of the newforms-admin branch: > > http://code.djangoproject.com/log/django/branches/newforms-admin Thanks. If I read that last one correctly, queryset-factor was merged into trunk on 4-26, and newforms-admin merged trunk on 4-28 (and appears to do so regularly), so the answer to my question is "yes". --~--~-~--~~~---~--~~ 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: Another installation problem
Debian Etch is meant to be stable, not up to date (except for security fixes), so it defaults to Python 2.4. You can install 2.5 but most of the python-* packages are not available for 2.5 because they were not deemed stable or didn't build at all. I needed support for Postgres, LDAP, Oracle and found it was easiest to stick with Python 2.4. If you really need 2.5, you're probably better off running a leading-edge distro like Ubuntu or Gentoo. Good luck... Tom On Sat, May 3, 2008 at 12:42 AM, LRP <[EMAIL PROTECTED]> wrote: > > Hi Folks, > > I've been trying for days now to correctly install python2.5 and > psycop2 on my Debian Etch system so I can work with postgresql8.1, > django, and web2py. > > I've installed python2.5 from the Debian repository and made it the > default choice. When I call python from the CLI I get Python2.5. > > But no matter how I try to install psycop2, I can't get django or > web2py to recognize it. On django it comes up as refusal to connect to > postgresql; on web2py it comes up as an error message saying "global > name psycopg2 is not defined'" > > Psycopg2 seems to want to install against python2.4. I've tried > symlinks from /usr/lib/python2.5/site-packages to /usr/lib/2.4/site- > packages/psycopg2, but that doesn't work; nor have various other > installation methods that I"ve tried. > > Can anyone show me how to correctly install and configure the packages > I need to run SVN django on Debian Etch and postgresql8.1? Must be > many others who've confronted the same issues. > > Many thanks, > > LRP > > > --~--~-~--~~~---~--~~ 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-contact-form, Akismet and UnicodeEncodeError
Forgot to mention, I'm using python2.5. Help me, Obi-Wan GoogleGroup, you're my only hope. //emil On 5 Maj, 02:15, Emil <[EMAIL PROTECTED]> wrote: > Hi folks. > > I'm having this annoying problem that I don't have the skill to solve. > I'm using James Bennetts django-contact-form (r46 from svn) and I'm > subclassing the AkismetContactForm class that's included. I have the > latest revision of akismet.py too. My django version is trunk, r6626, > which is post-unicode-branch-merge. > > I discovered that typing any form of non-ascii character into a form > field gives me a UnicodeEncodeError, I've pasted the traceback I get > athttp://dpaste.com/48248/. > > What gives? I figure that if django-contact-form's AkismetContactForm > class or akismet.py can't handle unicode properly (which would be > surprising) or if this was a common problem, I'd be able to find some > search results on it, or find something in some issue tracker > somewhere, but I've got nothing. > > Any help would be greatly appreciated. > > //emil --~--~-~--~~~---~--~~ 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: GeoDjangoFriendly?
You can install anything you want on Slicehost or any other VPS; provided that you have enough linux skills to do everything yourself. There's plenty of help out there on the web, slicehost have some great tutorials for setting up your slice, and mod_wsgi is very easy to setup as a low memory alternative to mod_python. I have a 256MB slice, and for $20 per month it's excellent. If you can do it at home, you can do it on a VPS. Rich On May 5, 7:07 pm, tupixo <[EMAIL PROTECTED]> wrote: > > You may recognize my name from that forum topic. > > > I've been working for over a week to get PostGIS installed correctly > > for my hosting at WebFaction. The support team is very responsive and > > helpful and we have worked through a lot of issues. That said, it > > still doesn't work correctly. > > > This is definitely not something they seem to do a lot, so there's no > > set process to actually get everything working. It seems to be a > > one-off thing with a slightly different process for every user. > > > I'd be glad to share what I've done to get thus far in the process, if > > you're interested. > > > I want to reiterate that the support guys at WebFaction have really > > worked hard on this and have been very helpful. It just seems like > > it's something that's somewhat non-standard for them. > > > Of course, if you have a slice at SliceHost, you can install anything > > you want. The limit is only your knowledge and capabilities. > > > /alex > > > On Sun, May 4, 2008 at 9:43 AM, Justin Bronn <[EMAIL PROTECTED]> wrote: > > > > > Anyone have experience/opinions on hosting GeoDjango with PostGIS on > > > > WebFaction or Slicehost (or any other of the DjangoFriendly hosts)? > > > > I'm wondering if WebFaction shared account allows you enough freedom > > > > to install all the geodjango dependencies... > > > > While I don't personally use WebFaction and/or Slicehost, others have > > > mentioned they've had success running on WebFaction: > > > http://forum.webfaction.com/viewtopic.php?id=957 > > > > Because I'm not familiar w/the way WebFaction sets things up I'd try > > > the GeoDjango installation instructions first over what is posted in > > > that forum topic: > > > http://code.djangoproject.com/wiki/GeoDjangoInstall > > WebFaction had a few issues with GeoDjango at first but I think > they've now resolved them because they were able to setup GeoDjango on > 3 of my accounts with no problem. > > Kevin. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
fixtures loading post qs-rf
Hi, before the qs-rf branch was merged into trunk I was loading some data regarding users (of which I had two kinds, buyers and sellers) by using four different models: user, user extension, buyer and seller (the last two with a OneToOne relation with user extension). Since the qs-rf branch has been merged into trunk there is no need anymore for the user extension model (though the user model is still needed with a separate table in the database) and I noticed I can load the data by simply referring, in the fixtures, to the buyer model (which inherits from the user) and to the seller model (which also inherits from the user). In other words it doesn't seem to be needed to load the data separately for the user model. The problem is that now (after qs-rf merge) even if I specify a value for the pk, such value is not taken into account and the data are loaded with the first available pk rather than the specified one. Is there something I should take into account when loading fixtures for a model that inherits from another model? Is it ok to specify all the data (for the base and derived model) directly in the derived model? Any help would be very appreciated. Thanks Francesco --~--~-~--~~~---~--~~ 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: using frames in django
On 5 mei, 05:26, Gboro54 <[EMAIL PROTECTED]> wrote: > Hi everyone...I want to use frames in a web app i am building..I have > a display.html that has the frames sets and takes 2 other html > files...the one problem is the other 2 pages have variables binded to > them...I am not sure how to get this to work...any advice would be > apprciated...Thanks(code provided below for the html) > > sidbar.html > > > > > > > > width="100" align="left"> > > > > main.html > > > > > > > > > > > > height="100" align="left"/> > align="top"/> > > Welcome to Bass Log Online > > > > > display.html > > > > > > > > > > > > Just use urls in your display.html file, and let urlconf.py translate those to views. Within those views, you can render your template & pass along your variables. --~--~-~--~~~---~--~~ 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: Subclassing a form, changing one field into required = False
On 1 mei, 13:43, "Karen Tracey" <[EMAIL PROTECTED]> wrote: > On Thu, May 1, 2008 at 7:22 AM, LaundroMat <[EMAIL PROTECTED]> wrote: > > > Hi - > > > Would it be possible to subclass a form class, and in that subclass > > define that one of the fields that were required in the parent class > > are no longer required in the subclass? > > You mean like this? > > >>> from django import newforms as forms > >>> class Form1(forms.Form): > > ... f1 = forms.CharField() > ... f2 = forms.CharField() > ... f3 = forms.CharField() > ...>>> class Form2(forms.Form): > > ... f1 = forms.CharField(required=False) > ... > > >>> f1inst = Form1({'f2': 'x', 'f3': 'y'}) > >>> f2inst = Form2({'f2': 'x', 'f3': 'y'}) > >>> f1inst.is_valid() > False > >>> f2inst.is_valid() > True > > Karen Yes, but I'd like Form2 be a subclass of Form1, so that it also has the f2 and f3 attributes. --~--~-~--~~~---~--~~ 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: manually rendered templates not recognized for translation?
This was because all the templates should have the "html" extension to get translated. On Apr 1, 11:32 am, omat <[EMAIL PROTECTED]> wrote: > Hi, > > I am sending notification e-mails to members on some actions. The > message body comes from a template: > > {% load i18n %} > {% blocktrans %} > Your application is created successfully. > Thanks. > {% endblocktrans %} > > I load and render the template to form the body of the message. It > works alright but when I build the translation file, the text is not > recognized to be translated and does not appear in the translation > file. > > How can I make xgettext to process those templates? > > Thanks,oMat --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Newbie
Hi all, I'm new to this whole area of web development. New to Django, Python, et al. I've only done some C,C++ coding for mobile phones before, but have a need to get into it now. Specifically planning on a creating a website that caters to PC and different devices like mobile phones, PDAs, etc. I have briefly evaluated a few CMSs and web frameworks, and overall, Django ( djangoproject.com) seems very promising. I have a few questions I'm interested to find out before I get too deep into my studies of Python and Django. - Is it possible to create WML files (or for that matter any customised output that is not out there) easily? Especially by way of XML/XSLT. - If so, are there many standard templates that can be downloaded and customised? - Is there an IDEs that can be used for development? - Given my basic needs, do you think Django is good, or some other tech is better? Thanks, Rajath --~--~-~--~~~---~--~~ 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: GeoDjangoFriendly?
> You may recognize my name from that forum topic. > > I've been working for over a week to get PostGIS installed correctly > for my hosting at WebFaction. The support team is very responsive and > helpful and we have worked through a lot of issues. That said, it > still doesn't work correctly. > > This is definitely not something they seem to do a lot, so there's no > set process to actually get everything working. It seems to be a > one-off thing with a slightly different process for every user. > > I'd be glad to share what I've done to get thus far in the process, if > you're interested. > > I want to reiterate that the support guys at WebFaction have really > worked hard on this and have been very helpful. It just seems like > it's something that's somewhat non-standard for them. > > Of course, if you have a slice at SliceHost, you can install anything > you want. The limit is only your knowledge and capabilities. > > /alex > > On Sun, May 4, 2008 at 9:43 AM, Justin Bronn <[EMAIL PROTECTED]> wrote: > > > > Anyone have experience/opinions on hosting GeoDjango with PostGIS on > > > WebFaction or Slicehost (or any other of the DjangoFriendly hosts)? > > > I'm wondering if WebFaction shared account allows you enough freedom > > > to install all the geodjango dependencies... > > > While I don't personally use WebFaction and/or Slicehost, others have > > mentioned they've had success running on WebFaction: > > http://forum.webfaction.com/viewtopic.php?id=957 > > > Because I'm not familiar w/the way WebFaction sets things up I'd try > > the GeoDjango installation instructions first over what is posted in > > that forum topic: > > http://code.djangoproject.com/wiki/GeoDjangoInstall WebFaction had a few issues with GeoDjango at first but I think they've now resolved them because they were able to setup GeoDjango on 3 of my accounts with no problem. Kevin. --~--~-~--~~~---~--~~ 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 : Select category -> show subcategory
Thank you, it's just what I wanted, but do I have to write a new template (admin/model_name/etc...) ? Or can I define this directly in my model (onchange actions...) ? I have the django Book (definitive guide to django) but I can't find this. On 4 mai, 02:26, Diego Ucha <[EMAIL PROTECTED]> wrote: > HelloMartyn, > > The main interaction, that i see you need is: > (On Product form) User select Category -> Subcategory field is auto- > filled -> User select a subcategory based on the category selected. > > Then you will have to use some JS Library (I prefer JQuery, besides > there are some discussion about those libs on the list). > > For filling this subcategory field, in terms of data transmission, i > use JSon, because JQuery has a fine JSon parser, in few lines it's all > done. > > []s, > Diego Ucha > > On May 2, 6:05 am,martyn<[EMAIL PROTECTED]> wrote: > > > Hi, > > > I've created a simple product model : > > > class Produit(models.Model): > > nom = models.CharField(maxlength=200) > > slug = models.SlugField(prepopulate_from=('nom',)) > > description = models.TextField(blank=True) > > published = models.BooleanField(default=True) > > prix_ht = models.DecimalField(max_digits=30, decimal_places=2) > > famille = models.ForeignKey('Famille') > > sous_categorie = models.ForeignKey('SousCategorie') > > clic > > > class Admin: > > pass > > > I've got also Category and SubCategory : > > > class Categorie(models.Model): > > nom = models.CharField(maxlength=200) > > slug = models.SlugField(prepopulate_from=('nom',)) > > class Admin: > > pass > > > def __str__(self): > > return self.nom > > > class SousCategorie(models.Model): > > nom = models.CharField(maxlength=200) > > slug = models.SlugField(prepopulate_from=('nom',)) > > categorie = models.ForeignKey('Categorie') > > class Admin: > > pass > > > def __str__(self): > > return self.nom > > > Is there a way in django admin, in the Product form, to select the > > category, then the subcategories of this category only are shown in > > the select list. > > > Thanks a lot --~--~-~--~~~---~--~~ 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 render of RadioSelect
Hello, I'm trying to manipulate the rendering for RadioSelect so that the form element shows up within my form differently than a . So far I've come across two options... Use straight form tags in my view, or to rework RadioFieldRenderer and RadioInput from widgets.py locally so that I can have a custom renderer. And then use that custom renderer as the renderer for RadioSelect I was wondering if there was a way to bipass these options and just get at the independant radio buttons that make up the RadioSelect. Meaning to be able to get all the 2-tuple key-value pairs that makeup the RadioSelect widget. Thanks, Mike. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---