Re: Django Developer Needed
On 22-Jun-07, at 5:41 AM, Noah Gift wrote: > > unique interactive web applications, etc. current plans include a > > python-based CMS such as django on Linux. > > you could also inform them that django is not a CMS - if they are > expecting one, they may be in for a disappointment. > > I think your being a bit misleading. Of course you can use django > for a CMS. It certainly doesn't hurt that CMS was the problem > domain being addressed while Django was being written either. Just > take a look at 99% of the jobs on django-users. "Hi, I work for a > newspaper.". So yes it can be a CMS if you write the code for > it, and it is probably one of the problems django does best. > Saying django is not a CMS is kind of like Elvis saying he wasn't > influenced by the Blues... :) Let us be clear - django is a web framework meant for developers - not a cms meant for end users. Yes, you can build a cms with django - and you can build a whole lot of other things. For that matter, you can built a cms with python-cgi also - but that doesnt make python- cgi a cms. I dont know enough about elvis to comment on your last statement ;-) -- regards kg http://lawgon.livejournal.com http://nrcfosshelpline.in/web/ --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
flatpages and i18n???
Hi, Is there a way to specify different flatpages for the same url, but for a different language??? So it would default to the one page if there's only one defined, but if language is fr-fr and there's a page of the same url defined for tha language, it would return that version instead. I'll haphazardly guess that no, there isn't. I'm definitely willing to give that a go, however: a simple change to the model to allow for a language column, and to the middleware, to put in the logic to pick which version to use, should work, but surely someone here would have an opinion on how best to approach this. Please share if that's the case. Thank you! -- __ Eric St-Jean[EMAIL PROTECTED] --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
using recaptcha with django's contrib comments module
Hi, Short form of my question: i have a custom view which does some work and then calls django.contrib.comments.views.comments.post_free_comment; i've customized the templates/comments/free_preview.html, and i would like my custom view to somehow pass an additional variable to that template, without having to do the whole form validation and re-instantiation that post_free_comment does. How? Very long form, skip if you understand the short form: I integrated recaptcha[1] into the django.contrib.comments comment form of a little blog app that i wrote with django (based on the django website blog app, actually, but with tagging). So i wanted to keep using most of the code from django.contrib.comments (view, validation, actual posting, ...) while also using recaptcha. The hack i came up with to do so with minimal work, was to copy and customize templates/comments/free_preview.html, incorporating the recaptcha code into it. The django.contrib.comments.views.comments.post_free_comment view does everything i need (except for the captcha) for both previewing and posting. It's in the preview that i show the captcha, using the aforementionned template (no unnecessary requests to the recaptcha servers that way). But then, if it's the actual comment post (not the for-previewing post), i need to actually check that the user solved it. No problem: i redirected the /comments/postfree/ view to a custom view. If it's the previewing step, or if it's the posting step and the user solved the captcha it just goes return post_free_comment(request) which does the rest of the validation, and posts the comment. My small problem is that at that point, i need to pass a simple variable to free_preview.html, which is the error code that recaptcha sent us (such as "the user can't read warped text"), so that the captcha on the refreshed screen will have error text[2] the problem is that to instantiate that template with its form, FreeComment's post_free_comment view uses a ton of code, and i had to duplicate a lot of it into my own view: try: options, target, security_hash = request.POST['options'], request.POST['target'], request.POST['gonzo'] except KeyError: raise Http404, _("One or more of the required fields wasn't submitted") content_type_id, object_id = target.split(':') # target is something like '52:5157' option_list = options.split(',') new_data = request.POST.copy() new_data['content_type_id'] = content_type_id new_data['object_id'] = object_id new_data['ip_address'] = request.META['REMOTE_ADDR'] new_data['is_public'] = IS_PUBLIC in option_list manipulator = PublicFreeCommentManipulator() return render_to_response('comments/free_preview.html', { 'comment': "", 'comment_form': oldforms.FormWrapper(manipulator, new_data, None), 'options': options, 'target': target, 'hash': security_hash, 'recaptcha_error': recatpcha_resp_text[1], }, context_instance=RequestContext(request)) (see http://dpaste.com/hold/12801/ for nicely formatted view) all of that only to pass an extra var ('recaptcha_error') to the template... the rest of that code is verbatim from the default view. after all this rambling, my question is quite simple: after having validated the captcha, if there was an error with it, i'd prefer to just call django.contrib.comments.views.comments.post_free_comment so that *it* bothers itself with refreshing the preview form, rendering my customized template, and so that i don't duplicate the above code. But how can i pass some value to the template when i'm not the one instantiating it? Should i add the error text to the session and have the template somehow retrieve that? Can a custom templatetag have access to session data? It all works; i just want it Pretty, and i'm sure there's a stupid solution that i'm too newb to see. thank you for your kind attention... [1] http://recaptcha.net [2] See http://recaptcha.net/apidocs/captcha Basically, a little js function goes to the recaptcha server, which returns a form that gets inserted into the page (so that happens on the client side). If there was an error in the previous recaptcha validation, the validation server will have returned an error code. You add this error code to the url that the client will use to fetch the captcha again, which will then contain a nice little message telling the user what he did wrong. -- --~--~-~--~~~---~--~~ 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 gro
Re: admin: suggestions for how to warn users that an object is being viewed for editing
On 6/22/07, ToddG <[EMAIL PROTECTED]> wrote: > Rails has an implementation you could look at for an example, likely > simpler to read than something like Hibernate... not sure how/if > anything could be hooked/monkey'd into the django-admin though. This is best handled by your database (assuming you're using a real database); set the appropriate transaction isolation level, and your DB will helpfully toss back an exception if you try to edit something that's changed since you retrieved it. -- "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: Ticket #3297 & Newforms Image Uploading
On 6/23/07, Bryan Veloso <[EMAIL PROTECTED]> wrote: > > > Can't paste the code from the actual app (am under NDA) but the logic > > in saving the image from form data is here: > > > > http://dpaste.com/12731/ > > The only problem with this, and probably why I'm looking to use #3297 > (which actually didn't work too well anyway), is because I have as > many as 15 file upload fields on one page. All the examples I've seen > only take care of one image on a certain form at a time and I don't > want to duplicate the code up to 15 times. BTW, Had a typo in the dpaste code. Line 19 should say: img_obj.save_image_file(uploaded['filename'], uploaded['content']) You don't have to duplicate code, well not duplicate too much. That's why the image validation method in the form is separate from the *_clean methods. In my app, I had to allow up to four simultaneous uploads. You have to set a limit to the number of uploads because if you don't you will be bound to hit the limits of your server anyway. Create a form with the number of image fields numbered in sequence. For example: img_fld1 img_fld2 img_fld3 ... Then when you do your processing in your view, simply wrap the code that saves the images in a loop: for n in range(0, MAX_NUM_UPLOADS): img_manip = ImageAttachment.AddManipulator() img_obj = img_manip.save() uploaded = clean_data['img_fld%d' % n] obj.save_image_file(uploaded['filename'], uploaded['content']) For validation, I haven't tried it yet, but I think you should be able to implement it using __getattr__ to handle it. That way you don't have to duplicate validation code. -- _nimrod_a_abing_ http://abing.gotdns.com/ http://www.preownedcar.com/ --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: admin: suggestions for how to warn users that an object is being viewed for editing
One approach: optimistic locking. http://en.wikipedia.org/wiki/Optimistic_concurrency_control Rails has an implementation you could look at for an example, likely simpler to read than something like Hibernate... not sure how/if anything could be hooked/monkey'd into the django-admin though. --~--~-~--~~~---~--~~ 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: mod_python/apache config
On Jun 23, 9:42 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > Hi, > > I'm trying to configure mod_python on apache on a home Ubuntu machine > -- hoping to direct 127.0.0.1:80 to a django project, let's call it > foo. > > in my /etc/apache2/httpd.conf, I'm told by this django > page:http://www.djangoproject.com/documentation/modpython/ > > to add this: > > SetHandler python-program > PythonHandler django.core.handlers.modpython > SetEnv DJANGO_SETTINGS_MODULE mysite.settings > PythonDebug On > > > So for my root site, would I want to do this? > > SetHandler python-program > PythonHandler django.core.handlers.modpython > SetEnv DJANGO_SETTINGS_MODULE foo.settings > PythonDebug On > If you are going to have them both within the one VirtualHost, you must use PythonInterpreter directive to force each Django instance to run in a different Python sub interpreter. You also need to make sure in your settings.py file that you have set SESSION_COOKIE_NAME to different values for each Django site else there sessions will interfere with each other. Graham > I want to store images and such in /var/www/images. Templates that > refer to images and css can just refer to them in that fashion. So an > in a template would load the right > image -- though the template does not live in /var/www. Right? > > Also, what is the easiest way to restart Apache so that changes to > the /var/www/httpd.conf stick? > > Any help would be greatly appreciated. > > Thanks, > Ivan Kirigin --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: UnicodeDecodeError with SelectDateWidget
On Fri, 2007-06-22 at 15:06 -0700, Boo wrote: > Hi All. > My form: > > class EditProfileForm(forms.Form): > birthday = > forms.DateField(widget=SelectDateWidget(years=range(1968, 1988)), > label=_('Birthday')) > > > If USE_I18N = True in settings, I receive an error: > > Request Method: GET > Exception Type: UnicodeDecodeError > Exception Value: 'ascii' codec can't decode byte 0xd0 in position 0: > ordinal not in range(128) > Exception Location: /usr/local/lib/python2.4/site-packages/django/ > newforms/widgets.py in render, line 173 At the moment, the solution is probably to use the Unicode branch. There are a number of problems with Unicode and ASCII interchange in trunk and that is why we have the Unicode branch in development. Regards, Malcolm --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Custom Form Validation
Sorry, accidentally hit the submit button. Here's your example finished (don't forget self in the def!): def clean_lines(self): if not format_is_correct( lines ): raise forms.ValidationError('Bug..') return self.cleaned_data.get(lines) Good luck! - whiteinge On Jun 22, 4:54 pm, Mario Gonzalez <[EMAIL PROTECTED]> wrote: > Hello, I've got a model like: > > class RecepcionForm(forms.Form): > drivers = > forms.ModelChoiceField(queryset=Driver.objects.all().order_by('- > name')) > lines = forms.CharField() > >def clean_lines(): > if not format_is_correct( lines ): > raise forms.ValidationError('Bug..') > > "lines" is a string with a special format, ex: "23, 24,1,0" and I > want to validate it with clean(), I've been reading the documentation > and writing some lines but I think my English is not good enough. > > Can you help me? Regards! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Custom Form Validation
You're nearly there, you just need to return your cleaned value. Here's one of mine: if self.cleaned_data.get(field_name) > assets.get_usable_assets(): raise ValidationError(u'You only have %s points available for betting.' % assets.get_usable_assets()) return self.cleaned_data.get(field_name) On Jun 22, 4:54 pm, Mario Gonzalez <[EMAIL PROTECTED]> wrote: > Hello, I've got a model like: > > class RecepcionForm(forms.Form): > drivers = > forms.ModelChoiceField(queryset=Driver.objects.all().order_by('- > name')) > lines = forms.CharField() > >def clean_lines(): > if not format_is_correct( lines ): > raise forms.ValidationError('Bug..') > > "lines" is a string with a special format, ex: "23, 24,1,0" and I > want to validate it with clean(), I've been reading the documentation > and writing some lines but I think my English is not good enough. > > Can you help me? Regards! --~--~-~--~~~---~--~~ 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: Install a django site
> I am new to Django. I have a django project that I would like to run. > How should I do? I have installed django, i don't know how to run the > project. > Are you wanting to learn how to write a program? If so, maybe go through the tutorial first: http://www.djangoproject.com/documentation/tutorial01/ Or are you trying to install a project that has already been written? Kelvin --~--~-~--~~~---~--~~ 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: mod_python/apache config
Howdy Ivan: I'll try to take a stab at a few of your questions. [snip] > > So for my root site, would I want to do this? > > SetHandler python-program > PythonHandler django.core.handlers.modpython > SetEnv DJANGO_SETTINGS_MODULE foo.settings > PythonDebug On > > If you wanted your entire site to be a Django project, this is what you would do. You may need to add the PythonPath in there if the initial configuration doesn't work: PythonPath "['/var/www/project'] + sys.path" > I want to store images and such in /var/www/images. Templates that > refer to images and css can just refer to them in that fashion. So an > in a template would load the right > image -- though the template does not live in /var/www. Right? > You have a couple of options. The docs suggest you setup static files under a separate, non-mod_python server. If you *really* want to serve the files under this apache process, you need to tell mod_python to ignore them. SetHandler None To use /var/www/images, you may need to setup an alias... Alias /images /var/www/images Alternatively, you could setup virtualhosts, if your home network would work with them. > Also, what is the easiest way to restart Apache so that changes to > the /var/www/httpd.conf stick? > The httpd.conf is located in /var/www? That seems to be a very unorthodox place. Anyways, to make sure the changes stick you typically need to do at least a: /etc/init.d/apache reload To get any changes in settings.py to stick, you'll need to restart apache. /etc/init.d/apache restart or apache2ctl -k restart Sometimes under some circumstances you will actually need to stop and start apache. > Any help would be greatly appreciated. I hope the above is somewhat helpful. Don't hesitate asking for clarification, and I'm sure somebody else will chime in with their .02 sometime. Cheers, Kelvin -- Kelvin Nicholson Voice: +886 9 52152 336 Voice: +1 503 715 5535 GPG Keyid: 289090AC Data: [EMAIL PROTECTED] Skype: yj_kelvin Site: http://www.kelvinism.com --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Install a django site
Hello I am new to Django. I have a django project that I would like to run. How should I do? I have installed django, i don't know how to run the project. Thanks, Cristian --~--~-~--~~~---~--~~ 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: object serialization problem
Malcolm Tredinnick wrote: > On Thu, 2007-06-21 at 20:23 -0700, dailer wrote: > > seems like a very simple example based on > > http://www.djangoproject.com/documentation/0.96/serialization/: > > > > def exportCountryCodeFixture(): > > from django.core import serializers > > from mysite.models import CountryCode > > > > out = open("CountryCode.xml", "w") > > serializers.serialize("xml", CountryCode.objects.all(), stream=out > > > > causes this error: > [...] > > AttributeError: 'file' object has no attribute 'getvalue' > > Yes. This was a bug in the 0.96 release. It's been fixed subsequently. > > You could grab the contents of django/core/serializers from a recent > subversion checkout and drop that into your current 0.96 code if you > didn't want to move entirely up to tracking subversion's trunk. The > fixes are very self-contained. > > Regards, > Malcolm thx. Wow. I'm suprised since I'm just learning both python & django I tend to think "Ok, what dumb thing am I doing now?" --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
mod_python/apache config
Hi, I'm trying to configure mod_python on apache on a home Ubuntu machine -- hoping to direct 127.0.0.1:80 to a django project, let's call it foo. in my /etc/apache2/httpd.conf, I'm told by this django page: http://www.djangoproject.com/documentation/modpython/ to add this: SetHandler python-program PythonHandler django.core.handlers.modpython SetEnv DJANGO_SETTINGS_MODULE mysite.settings PythonDebug On So for my root site, would I want to do this? SetHandler python-program PythonHandler django.core.handlers.modpython SetEnv DJANGO_SETTINGS_MODULE foo.settings PythonDebug On I want to store images and such in /var/www/images. Templates that refer to images and css can just refer to them in that fashion. So an in a template would load the right image -- though the template does not live in /var/www. Right? Also, what is the easiest way to restart Apache so that changes to the /var/www/httpd.conf stick? Any help would be greatly appreciated. Thanks, Ivan Kirigin --~--~-~--~~~---~--~~ 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: Scalability where file uploads are involved
On Jun 22, 9:51 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > I've done some preliminary work integrating Tramline with django > applications. It wasn't difficult to set up and the performance was > impressive. We are looking at this solution now for all of our media > handling in Django going forward. > > http://infrae.com/products/tramline If using Tramline, just take note of: https://issues.apache.org/jira/browse/MODPYTHON-76 The author of Tramline recommends a patch be made to mod_python but in the bigger scheme of things haven't been able to work out definitively why it should be necessary and whether it is just a workaround for problems in certain versions of underlying Apache code. We have identified another issue in mod_python filter code which was fixed, but author seemed to fix this itself didn't resolve problem. Anyway, this is not to deter you from trying Tramline as I think the concept is quite interesting and could help to improve performance. Personally I would have written a dedicated C based Apache module to do it, but then things like this are much easier to do in mod_python that using Apache C module API. :-) Graham > On Jun 7, 12:38 pm, "Nimrod A. Abing" <[EMAIL PROTECTED]> wrote: > > > Hello, > > > I am currently doing research on scaling one of the sites I made using > > Django. I have looked at Chapter 21 of the in-progress Django Book. I > > plan to follow the track recommending 3 django servers behind perlbal > > + 1 dedicated media server + 1 dedicated database server. > > > The current setup for the site I am working on uses a single machine > > for the whole site. I have Apache +mod_pythonon one IP address > > serving Django requests. For media, I have lighttpd running on another > > IP address on the same machine. Postgresql is also running on the same > > machine. > > > This site allows users to upload pictures. Those uploaded pictures are > > then served by lighttpd. While this works quite well in our single > > machine setup I am dumbfounded as to how to handle file/image uploads > > when we finally move to a load-balanced setup with a dedicated media > > server. > > > The only thing I can think of right now is to share a directory on the > > dedicated media server and have each server in the Django cluster > > mount that share either through NFS or Samba. But I don't think it's a > > good idea to do it this way. > > > Does anyone know how else this can be done? > > > Thanks in advance. > > -- > > _nimrod_a_abing_ > > >http://www.preownedcar.com/http://abing.gotdns.com/ --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Ticket #3297 & Newforms Image Uploading
> Can't paste the code from the actual app (am under NDA) but the logic > in saving the image from form data is here: > > http://dpaste.com/12731/ The only problem with this, and probably why I'm looking to use #3297 (which actually didn't work too well anyway), is because I have as many as 15 file upload fields on one page. All the examples I've seen only take care of one image on a certain form at a time and I don't want to duplicate the code up to 15 times. --~--~-~--~~~---~--~~ 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: virtualhosts, mod_python, and Django's cache
On Jun 22, 10:45 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > I will try it out. If you say it is stable, it most likely is. Do > you have a tutorial for getting it configured? If not, I can make one > as I go along. Thanks for all your help. Instructions linked off http://www.modwsgi.org (maps to Google code site): http://code.google.com/p/modwsgi/wiki/InstallationInstructions Extra Django stuff in: http://code.google.com/p/modwsgi/wiki/IntegrationWithDjango Daemon process (fastcgi like) feature not really covered much in documentation yet but given how you are having issues with two applications intermingling data, may be better to be using daemon process feature so that they are forced into separate processes. Thus no risk of there being some back door method of data leaking between sub interpreters. The daemon process feature is controlled through additional WSGIDaemonProcess/WSGIProcessGroup directives. Details for these in: http://code.google.com/p/modwsgi/wiki/ConfigurationDirectives Hop on other to the mod_wgsi Google group if you start playing and need some help which appears to be mod_wsgi specific. Graham > On Jun 22, 5:43 am, Graham Dumpleton <[EMAIL PROTECTED]> > wrote: > > > On Jun 22, 2:40 pm, "Jeremy Dunck" <[EMAIL PROTECTED]> wrote: > > > > On 6/21/07, Graham Dumpleton <[EMAIL PROTECTED]> wrote: > > > > > To be honest I haven't ever done anything with Django past the hello > > > > world examples, > > > > Graham, thank you for frequently answering questions that fall in the > > > gap between Django and mod_python, especially given your more recent > > > work onmod_wsgi. > > > No problem. Invariably people using Django or even other packages such > > as TurboGears or Pylons never actually come over to the mod_python > > list when they have problems, so me coming here is the only way I can > > find out and understand what issues people are having which may relate > > to mod_python. My ulterior motive of course is to make sure I know > > what the problems are with mod_python so I can do it right in > >mod_wsgi. Also, hopefully answering questions will give me some > > credibility when it comes to trying to convince people thatmod_wsgi > > is a good idea and that the code that is already available and ready > > to release is stable like I claim it is. :-) > > > Graham --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Custom Form Validation
Hello, I've got a model like: class RecepcionForm(forms.Form): drivers = forms.ModelChoiceField(queryset=Driver.objects.all().order_by('- name')) lines = forms.CharField() def clean_lines(): if not format_is_correct( lines ): raise forms.ValidationError('Bug..') "lines" is a string with a special format, ex: "23, 24,1,0" and I want to validate it with clean(), I've been reading the documentation and writing some lines but I think my English is not good enough. Can you help me? Regards! --~--~-~--~~~---~--~~ 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: suggestions for how to warn users that an object is being viewed for editing
Hi Tim- I like your second suggestion: > Another alternative might be to make your own admin-ish interface > and, by tracking a "last updated on " and "last > updated by "" field, for which when Joe requested this > custom admin page, it would stash those values as hidden fields. > If, when the POST came around, the current values don't match > the ones that have been riding along with the admin form, then > the user should have to confirm that they *really* *have* > coordinated with the other user on the matter before the new > admin would allow them to save the record. Any idea how to hook this into the generic admin pages? I'd like to use as much of the out-of-box machinery as possible. I thought about using specific URL confs, but the default admin doesn't seem to indicate 'state' ('new', 'update', etc) via the URL... so I can't use that as a hook. Thanks- Julian --~--~-~--~~~---~--~~ 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: MySQLdb trouble
And dangit how odd. MySQLdb works fine when I run >manage.py shell. On Jun 22, 1:16 pm, rtconner <[EMAIL PROTECTED]> wrote: > When I try to use MySQL .. I get this error.. > > ImproperlyConfigured: Error loading MySQLdb module: No module named > pkg_resources > args = ('Error loading MySQLdb module: No module named > pkg_resources',) > > Django works fine, as long as I don't connect to the database. I used > the latest SVN version of DJango as of a few days ago. Any ideas why > I'm getting this error? My egg is included in the PYTHONPATH, its > called MySQL_python-1.2.2-py2.4-linux-i686.egg. If you look at the > error, I think it finds MySQLdb just fine.. it just can't find the > pkg_resources module within it. Is that supposed to be part of MySQLdb? --~--~-~--~~~---~--~~ 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: suggestions for how to warn users that an object is being viewed for editing
> In playing with the admin, I've found I can log in as two users via > two different browsers and edit the same object- no warning is given > that the object is being edited elsewhere, and of course the last to > save-'wins.' Given the stateless nature of RESTful web applications, the only gospel is the actual sequencing of the POST requests. As you describe, "last to save wins". E.g. Joe pulls up the admin page for an object and then goes on vacation. Is Jane locked out of editing the page until he explicitly releases the page via a commit or a cancel? Or what happens if Joe's browser/OS crashes after fetching the page? He may never be able to cancel/commit the changes. In theory, you could have a "last requested for editing on ", perhaps along with a "last requested for editing by " field on your model that you hook into before handing it off to the admin (perhaps via a wrapper around your URL dispatcher in your urls.py?) However, that would only serve as guidance for the 2nd requester, in the hopes that they noticed that "oh, Joe requested this for editing just 5 minutes ago...perhaps I ought to coordinate with him". Another alternative might be to make your own admin-ish interface and, by tracking a "last updated on " and "last updated by "" field, for which when Joe requested this custom admin page, it would stash those values as hidden fields. If, when the POST came around, the current values don't match the ones that have been riding along with the admin form, then the user should have to confirm that they *really* *have* coordinated with the other user on the matter before the new admin would allow them to save the record. I prefer the second method if it's a needed feature and have used it in some apps from my pre-Django life. I don't like to trust users to recognize when something might be stale. However, having Django do the work for you...I don't think there's anything of the sort currently. -tim --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
UnicodeDecodeError with SelectDateWidget
Hi All. My form: class EditProfileForm(forms.Form): birthday = forms.DateField(widget=SelectDateWidget(years=range(1968, 1988)), label=_('Birthday')) If USE_I18N = True in settings, I receive an error: Request Method: GET Exception Type: UnicodeDecodeError Exception Value: 'ascii' codec can't decode byte 0xd0 in position 0: ordinal not in range(128) Exception Location: /usr/local/lib/python2.4/site-packages/django/ newforms/widgets.py in render, line 173 --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
admin: suggestions for how to warn users that an object is being viewed for editing
Hi- In playing with the admin, I've found I can log in as two users via two different browsers and edit the same object- no warning is given that the object is being edited elsewhere, and of course the last to save-'wins.' For what we need, I think I can include all the interesting fields in the list view, and can make the assumption that if a user looks at the detail/full view, there's a very high probability they're editing the contents. Rather than add a 'being_edited' field to every model, I think it'd make more sense to have a new admin model- admin_objects_being_edited. Then, I think the following pseudo-code would meet our needs: request->obj details view check to see if this object is listed in admin_objects_being_edited object is being edited? warn user (display user doing editing), allow to proceed or cancel Proceed (or not being edited): add this object primary key to admin_objects_being_edited display normal details view/editing form And on exiting the details/editing page: remove this objects primary key from admin_objects_being_edited update object as normal Can this be done? I get the impression it's doable, possibly using app/model specific admin pages and/or signals. Any suggestions appreciated! Thanks- Julian --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
admin object change history: how to include changed values, selectively (by model)
Hi there- the django admin ap looks like it's going to work out very nicely for an internal application I'm working on. The history pages (for object changes) are almost perfect, but for some objects we need to know what the values of the fields were, not just the names of the fields changed. I also need this to be selective, based on the model name (some models are human edited, eg an integer here, a small string there- some are machine updated- big text blobs etc.) I understand how to make app/model specific admin pages, but I can't fully comprehend how the history items are being created, and can't see a way to extend things the way I need. Any suggestions? Thanks in advance, Julian --~--~-~--~~~---~--~~ 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: Problem with checkboxes
I'm working on learning Django, and I'm having trouble getting a basic "todo" app working. I'm listing all my todo items in my template, with a checkbox next to each one for "done". I have an update button that goes to a view that updates all the item's done values. But, it's not working. It doesn't store my updates. I can edit it through the admin without problems, but I can't get it to work with my code. Here's my view: * from django.shortcuts import render_to_response from django.http import Http404, HttpResponse, HttpResponseRedirect from django_test.todo.models import TodoItem def list(request): todos = [] for item in TodoItem.objects.all(): todo_dict = {} todo_dict['todo_title'] = item.Title todo_dict['todo_description'] = item.Description todo_dict['done'] = item.Done todo_dict['id']= item.id todos.append(todo_dict) return render_to_response(' todo.html', {'todos': todos}) def new(request): todo = TodoItem(Title=request.POST['Title'], Description=request.POST['Description'], Done=False) todo.save() return HttpResponseRedirect('/list/') def update(request): checked = request.POST.getlist('doneArray') for item in TodoItem.objects.all (): try: checked.index(item.id) item.Done=True except: item.Done=False item.save return HttpResponseRedirect('/list/') and here's my template code: http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd "> http://www.w3.org/1999/xhtml";> To-do List To-do List {% for item in todos %} {{ item.todo_title }} {{ item.todo_description }} {% endfor %} Add new todo: Title: Description: What am I doing wrong? And is there a better way for me to check which item's done status has changed, besides iterating through my whole list of items? Thanks for any help you can give to a django newbie! --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
MySQLdb trouble
When I try to use MySQL .. I get this error.. ImproperlyConfigured: Error loading MySQLdb module: No module named pkg_resources args = ('Error loading MySQLdb module: No module named pkg_resources',) Django works fine, as long as I don't connect to the database. I used the latest SVN version of DJango as of a few days ago. Any ideas why I'm getting this error? My egg is included in the PYTHONPATH, its called MySQL_python-1.2.2-py2.4-linux-i686.egg. If you look at the error, I think it finds MySQLdb just fine.. it just can't find the pkg_resources module within it. Is that supposed to be part of MySQLdb? --~--~-~--~~~---~--~~ 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 Question - How do I get my burger and fries from BK and not Mickey D's?
Dirk, Thanks for your comment! I simplified my use case for the sake of clarity, but in my actual application it does make sense to have Dishes and Restaurants to be many-to-many. Does anyone have any insight as to my original question? Can the choices of dish be narrowed to only dishes at a particular Restaurant somehow using the Admin class or other magic? Wiley On Jun 23, 1:13 am, "Dirk van Oosterbosch, IR labs" <[EMAIL PROTECTED]> wrote: > Hi Wiley, > > I would say your data model -as you describe it- makes more sense if > Dishes has a foreign key to Restaurants. Because it seems a typical > dish (say mc_burger) can only be ordered in one restaurant (mcD). > Then you don't need the foreign key Restaurants in IndividualMeals. > > ... However, this is debatable. It might not be the best data model > if you want to scale things up later on (like add more dishes). See, > you have double dishes (mc_fries AND bk_fries). That is redundant (if > the dishes are equal). So maybe Restaurants should have a many2many > relation with Dishes. Then you can specify which dishes can be > ordered from which Restaurants. > On the other hand, when you want to extend the information about the > dishes, (a dish might have a price or a volume), you'll run into > problems there. ... > > HTH > dirk > > On 22-jun-2007, at 13:24, Wiley wrote: > > > > > > > I'm a true novice programmer, brand new to django, but lovin' it so > > far. I was wondering if there was any way to do something a little > > tricky via the Admin classes that could help me not write a custom > > view. > > > Basically I'd love to do all my data entry from the Admin interface, > > but I need to filter a set of choices on one Admin input interface > > based on a choice I make further up the form. > > > I live in a world with: > > > 2 restaurants (McDonalds and Burger King) > > 4 menu items, the same type of food at each restaurant (mc_burger, > > mc_fries, bk_burger, bk_fries) > > > Each time I eat at one of those restaurants I want to make a record of > > the meal in my database. So I do the data entry through the django > > Admin backend. If I select "Burger King" as the restaurant that I eat > > my meal at, when it comes time to select the dishes I ate, I really > > only want to see bk_fries and bk_burger, cuz I ate at BK and not > > mickey D's. > > > Can this be done just using the Admin class in models.py? > > > Here's the sample code that I'm working with in model.py: > > > class Restaurant(models.Model): > >def __str__(self): > >return self.name > > >name = models.CharField('Restaurant Name', maxlength=200, blank=True) > >class Admin: > >fields = ( > >('Restaurant Name' , {'fields': ('name',)}), > >) > >pass > > > class Dishes(models.Model) > >def __str__(self): > >return self.name > > >name = models.CharField('Restaurant Name', maxlength=200, blank=True) > >class Admin: > >fields = ( > >('Dish Name' , {'fields': ('name',)}), > >) > >pass > > > class IndividualMeal(models.Model): > >def __str__(self): > >return self.name > > >restaurant_name = models.ForeignKey(Restaurant, > > verbose_name="restaurant") > >date_of_visit = models.DateTimeField('date of visit') > >dishes = models.ManyToManyField(Dish, verbose_name="individual > > dishes") > >class Admin: > >fields = ( > >('Restaurant Name' , {'fields': ('restaurant_name',)}), > >('Date of Visit', {'fields': ('date_of_visit',)}), > >('Dishes', {'fields': ('dishes',)}), > >) > >pass > > - > Dirk van Oosterbosch > de Wittenstraat 225 > 1052 AT Amsterdam > the Netherlands > > http://labs.ixopusada.com > - --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
RE: 'retrieve': the missing permission?
> > I just wonder why this permission is not part of the default > > permissions (like add, change and delete)? > > > > David > > > No more thoughts about that? I'm really surprised that it only happens > to me, maybe I will be luckier on the users' mailing-list? Chapter 18 of the Django book (http://www.djangobook.com/en/beta/chapter18/) says this : " For instance, although the admin is quite useful for reviewing data (see above), it's not designed with that purpose as a goal: note the lack of a "can view" permission (see Chapter 12). Django assumes that if people are allowed to view content in the admin, they're also allowed to edit it." Chris --~--~-~--~~~---~--~~ 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 Question - How do I get my burger and fries from BK and not Mickey D's?
Hi Wiley, I would say your data model -as you describe it- makes more sense if Dishes has a foreign key to Restaurants. Because it seems a typical dish (say mc_burger) can only be ordered in one restaurant (mcD). Then you don't need the foreign key Restaurants in IndividualMeals. ... However, this is debatable. It might not be the best data model if you want to scale things up later on (like add more dishes). See, you have double dishes (mc_fries AND bk_fries). That is redundant (if the dishes are equal). So maybe Restaurants should have a many2many relation with Dishes. Then you can specify which dishes can be ordered from which Restaurants. On the other hand, when you want to extend the information about the dishes, (a dish might have a price or a volume), you'll run into problems there. ... HTH dirk On 22-jun-2007, at 13:24, Wiley wrote: > > I'm a true novice programmer, brand new to django, but lovin' it so > far. I was wondering if there was any way to do something a little > tricky via the Admin classes that could help me not write a custom > view. > > Basically I'd love to do all my data entry from the Admin interface, > but I need to filter a set of choices on one Admin input interface > based on a choice I make further up the form. > > I live in a world with: > > 2 restaurants (McDonalds and Burger King) > 4 menu items, the same type of food at each restaurant (mc_burger, > mc_fries, bk_burger, bk_fries) > > Each time I eat at one of those restaurants I want to make a record of > the meal in my database. So I do the data entry through the django > Admin backend. If I select "Burger King" as the restaurant that I eat > my meal at, when it comes time to select the dishes I ate, I really > only want to see bk_fries and bk_burger, cuz I ate at BK and not > mickey D's. > > Can this be done just using the Admin class in models.py? > > Here's the sample code that I'm working with in model.py: > > class Restaurant(models.Model): > def __str__(self): > return self.name > > name = models.CharField('Restaurant Name', maxlength=200, blank=True) > class Admin: > fields = ( > ('Restaurant Name' , {'fields': ('name',)}), > ) > pass > > class Dishes(models.Model) > def __str__(self): > return self.name > > name = models.CharField('Restaurant Name', maxlength=200, blank=True) > class Admin: > fields = ( > ('Dish Name' , {'fields': ('name',)}), > ) > pass > > class IndividualMeal(models.Model): > def __str__(self): > return self.name > > restaurant_name = models.ForeignKey(Restaurant, > verbose_name="restaurant") > date_of_visit = models.DateTimeField('date of visit') > dishes = models.ManyToManyField(Dish, verbose_name="individual > dishes") > class Admin: > fields = ( > ('Restaurant Name' , {'fields': ('restaurant_name',)}), > ('Date of Visit', {'fields': ('date_of_visit',)}), > ('Dishes', {'fields': ('dishes',)}), > ) > pass > > > > > - Dirk van Oosterbosch de Wittenstraat 225 1052 AT Amsterdam the Netherlands http://labs.ixopusada.com - --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Re: Re: Re: Re: Uploading multiple images via edit inline give errors when doing auto resizing ..
Ich bin zur Zeit abwesend. Anliegen werden nicht bearbeitet. Ausnahmen bestätigen die Regel. mfg Light Lan --~--~-~--~~~---~--~~ 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: Uploading multiple images via edit inline give errors when doing auto resizing ..
[EMAIL PROTECTED] schrieb: > Ich bin zur Zeit abwesend. Anliegen werden nicht bearbeitet. > Ausnahmen best�tigen die Regel. > > mfg Light Lan > > > > > > I'm sorry about the spamming, autoresponse now should not be sent to this addresse anymore, should... greetz Paul Rauch --~--~-~--~~~---~--~~ 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: Re: Re: Re: Re: Re: Re: Re: Uploading multiple images via edit inline give errors when doing auto resizing ..
Ich bin zur Zeit abwesend. Anliegen werden nicht bearbeitet. Ausnahmen bestätigen die Regel. mfg Light Lan --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
ANN: PyLucid v0.8.0alpha2...
A new PyLucid CMS snapshot released. - http://www.pylucid.org changes: + Inline Editing with template tag list and tinyTextile help page. + reimplemented: create a cms page, delete pages and "Select a page to edit it". + better _install section login. + CMS page view cache. + better update routines. + and more... The PyLucid v0.8.0alpha2 Package is preinstalled. A local django enviroment, a preinstalled SQLite database file and a presetuped settings.py is included. You should only run "standalone_linux.sh" or "standalone_w32.cmd" to start a local development server and test PyLucid. Normal CMS page request: http://localhost:8000/ Django admin panel: http://localhost:8000/_admin/ Install section link (password is "12345678"): http://localhost:8000/_install/ preinstalled user: username: "test" userpassword: "12345678" download: http://sourceforge.net/project/showfiles.php?group_id=146328&package_id=172512 btw. the test page http://www.pylucid.de used the new alpha Version. (It runs via CGI on apache with SQLite) -- Mfg. Jens Diemer A django powered CMS: http://www.pylucid.org --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Re: Re: Re: Re: Re: Re: Uploading multiple images via edit inline give errors when doing auto resizing ..
Ich bin zur Zeit abwesend. Anliegen werden nicht bearbeitet. Ausnahmen bestätigen die Regel. mfg Light Lan --~--~-~--~~~---~--~~ 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: Re: Re: Re: Re: Re: Uploading multiple images via edit inline give errors when doing auto resizing ..
Ich bin zur Zeit abwesend. Anliegen werden nicht bearbeitet. Ausnahmen bestätigen die Regel. mfg Light Lan --~--~-~--~~~---~--~~ 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: Re: Re: Re: Uploading multiple images via edit inline give errors when doing auto resizing ..
Ich bin zur Zeit abwesend. Anliegen werden nicht bearbeitet. Ausnahmen bestätigen die Regel. mfg Light Lan --~--~-~--~~~---~--~~ 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: Re: Re: Uploading multiple images via edit inline give errors when doing auto resizing ..
Ich bin zur Zeit abwesend. Anliegen werden nicht bearbeitet. Ausnahmen bestätigen die Regel. mfg Light Lan --~--~-~--~~~---~--~~ 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: Re: Uploading multiple images via edit inline give errors when doing auto resizing ..
Ich bin zur Zeit abwesend. Anliegen werden nicht bearbeitet. Ausnahmen bestätigen die Regel. mfg Light Lan --~--~-~--~~~---~--~~ 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: Uploading multiple images via edit inline give errors when doing auto resizing ..
Ich bin zur Zeit abwesend. Anliegen werden nicht bearbeitet. Ausnahmen bestätigen die Regel. mfg Light Lan --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Uploading multiple images via edit inline give errors when doing auto resizing ..
Hi I have the following model, which is just for images and is edited inline in a different model. Before I added the def save(self) for the image thumbnail creating, I could upload multiple images in the Admin "Property" model in one go. But now i want to resize each image, and this works if I upload the image via the PropertyImage model, but if i do it via the Related module "Property" I get an error. What am i doing wrong? or why would this not work via edit inline? Thanks! #Model class PropertyImage(models.Model): caption = models.CharField(maxlength=30, help_text="Displayed as the cation and ALT tag.", core=True) sortOrder = models.IntegerField(null=True, blank=True, verbose_name="Sort Order", help_text="0 to high number, 0 is displayed 1st.") imageheight = models.IntegerField(editable=False, null=True) imagewidth = models.IntegerField(editable=False, null=True) imagefile = models.ImageField(upload_to='uploads',height_field='imageheight',width_field='imagewidth',help_text="Will be resized to max 800 x max 800 pixel.") category = models.CharField(maxlength=3, choices=CATEGORY_CHOICES) property = models.ForeignKey(Property, edit_inline=models.TABULAR, num_in_admin=8, min_num_in_admin=8, max_num_in_admin=15, num_extra_on_change=1) def save(self): #Image resize to 800 x 800 (max) also stores new size in table. from PIL import Image IMAGE_RESIZE = (800, 800) image = Image.open(self.get_imagefile_filename()) if image.mode not in ('L', 'RGB'): image = image.convert('RGB') image.thumbnail(IMAGE_RESIZE, Image.ANTIALIAS) NEW_SIZE = image.size self.imageheight = NEW_SIZE[1] self.imagewidth = NEW_SIZE[0] image.save(self.get_imagefile_filename()) #finish image resize super(PropertyImage, self).save() def __str__(self): return self.imagefile class Admin: pass Error: IOError at /admin/Property_Management/property/3/ [Errno 2] No such file or directory: '' Request Method: POST Request URL:http://192.168.1.2:8080/admin/Property_Management/property/3/ Exception Type: IOError Exception Value:[Errno 2] No such file or directory: '' Exception Location: C:\Python25\Lib\site-packages\PIL\Image.py in open, line 1888 Python Executable: c:\python25\python.exe Python Version: 2.5.0 VariableValue IMAGE_RESIZE(800, 800) Image self --~--~-~--~~~---~--~~ 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: Introducing DjangoSites.Org
It would be great if there was some sort of "Thanks for the submission! We will post your site after it is reviewed.." notice after submitting each site. Right now it just dumps you back in the homepage w/ no feedback as to whether the site submission was received or not. Otherwise, looks great so far! Thanks for putting this up.. And fwiw, my account confirmation email came immediately and the account worked fine. Nate. -- comix + blather = http://brainfag.com/ --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Database Field spanning multiple columns
Hi, We use a lot of IP Adresses and Networks in FFSomething. Currently the default IPAdressField which works more or less good. To make it easier to work with IP Networks, i wan't to create a generic IP field type. Now my problem: To make this field working on every database, i thought about this: the actuall column are one 128 bit integer and a 8 byte prefix column. The ip is saved as a 128 bit integer value + the perfix length in a second column. Using plain integer has advantages: - db sort works out of the box - inrange etc is easy math offloaded to the database I looked arround, but havn't found a example except the rather complicated ForeignKey stuff how to implement fields spanning two columns and overloading stuff. any tips welcome :) kindly regards 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 -~--~~~~--~~--~--~---
Re: project directory - simple question
On Fri, Jun 22, 2007 at 06:32:51PM +0300, KpoH wrote: > > put in your "mysite_classes" directory empty file named __init__.py > it will indicate that this is python module, and from now you can import > it, or it's contents. Thanks ut this is not what I was looking for. I know how to import a module what I don't know is ho to *refer to that module*. (And I already have __init__.py since it is built there by django-admin and is necessary to import settings.py.) In an application called myapp.settings can be referenced as: import myapp.settings or (not exactly the same thing): from django.conf import settings the latter is general and does not require you know in advance the name of your application. What I need is a way to import from my project w/o knowing the name of the project. sandro *:-) --~--~-~--~~~---~--~~ 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: project directory - simple question
put in your "mysite_classes" directory empty file named __init__.py it will indicate that this is python module, and from now you can import it, or it's contents. sandro dentella пишет: > hi, > > while writing application that are meant to be used in many > different > projects *and* that allow projects to overwrite single methods/ > classes I > need to have a way to refer to the application project in a general > way > (not by name, since I don't know in the application which will be > the > name). > > Is there a simple way to do this? > > Suppose I have a directory schema like this: > > mysite/settings.py > templates/ >mysite_classes/__init__.py > personalized_classes.py > > I'd like to know how to say in a general way: > > from mysite.mysite_classes import personalized_classes > > > now I'm doing this using __import__ and and storing the project dir > in a > variable set inside settings.py, but I'd like to know if it exists a > more > standard way since it seems to me a pretty common thing to do. > > thanks > sandro > *:-) > > > > > -- Artiom Diomin, Development Dep, "Comunicatii Libere" S.R.L. http://www.asterisksupport.ru http://www.asterisk-support.com --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
project directory - simple question
hi, while writing application that are meant to be used in many different projects *and* that allow projects to overwrite single methods/ classes I need to have a way to refer to the application project in a general way (not by name, since I don't know in the application which will be the name). Is there a simple way to do this? Suppose I have a directory schema like this: mysite/settings.py templates/ mysite_classes/__init__.py personalized_classes.py I'd like to know how to say in a general way: from mysite.mysite_classes import personalized_classes now I'm doing this using __import__ and and storing the project dir in a variable set inside settings.py, but I'd like to know if it exists a more standard way since it seems to me a pretty common thing to do. thanks sandro *:-) --~--~-~--~~~---~--~~ 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: Apache auth
Sean, On 22 Jun 2007, at 10:26 am, Sean Mc Allister wrote: Hi, I haven't seen this error myself yet, but you could try to use the patch here: http://code.djangoproject.com/ticket/3583 SmileyChris was so nice as to improve my initial patch, and possibly this will sooner or later even make it into trunk. Can I ask what mod_python/apache versions you are using? I can fairly consistently get this error, however I have to replace: SetHandler python-program with: SetHandler none or else I get a 404 from django. Perhaps I am missing something? Thanks, Dave -- David Reynolds [EMAIL PROTECTED] smime.p7s Description: S/MIME cryptographic signature
Re: Introducing DjangoSites.Org
> still havent got the mail, but the login is working > > I created a login for bfordham the other day, never got an email, account isn't working. --B --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
UnicodeDecodeError when use date filter
Database and all project in UTF. Using unicode branch. in template (after generic view): {% for entry in latest %} Posted by {{ entry.author }} - {{ entry.pub_date|date:"j N Y, H:i" }} {% endfor %} Have exception: Traceback (most recent call last): File "c:\web\Python24\lib\site-packages\django\template\__init__.py" in render_node 757. result = node.render(context) File "c:\web\Python24\lib\site-packages\django\template \defaulttags.py" in render 136. nodelist.append(node.render(context)) File "c:\web\Python24\lib\site-packages\django\template\__init__.py" in render 793. return self.filter_expression.resolve(context) File "c:\web\Python24\lib\site-packages\django\template\__init__.py" in resolve 606. obj = func(obj, *arg_vals) File "c:\web\Python24\lib\site-packages\django\template \defaultfilters.py" in date 417. return format(value, arg) File "c:\web\Python24\lib\site-packages\django\utils\dateformat.py" in format 258. df = DateFormat(value) File "c:\web\Python24\lib\site-packages\django\utils\dateformat.py" in __init__ 114. self.timezone = LocalTimezone(dt) File "c:\web\Python24\lib\site-packages\django\utils\tzinfo.py" in __init__ 28. self._tzname = unicode(time.tzname[self._isdst(dt)]) UnicodeDecodeError at /en/blog/ 'ascii' codec can't decode byte 0xc3 in position 0: ordinal not in range(128) In settings: TIME_ZONE = 'Europe/Kiev' If i use template without date filter like this: Posted by {{ entry.author }} - {{ entry.pub_date }} i have no bug 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: Development / Production Setup
> I'm obviously missing something basic. I'm 99% sure I should be able > to say something like: > > media="screen" /> Assuming you have SVN... Make sure you have this enabled in your TEMPLATE_CONTEXT_PROCESSORS (it is by default): http://www.djangoproject.com/documentation/templates_python/#django-core-context-processors-media Use RequestContext (generic views do automatically). It's made easy with http://www.djangosnippets.org/snippets/3/ In your template, you'll have the {{ MEDIA_URL }} context variable ready for your enjoyment (which will equal settings.MEDIA_URL) --~--~-~--~~~---~--~~ 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: ANN: Django-fr.org is out!
On 6/22/07, Ramiro Morales <[EMAIL PROTECTED]> wrote: > /me raises hand > > I'm there right now. Alone. :) Dice que estas en #django-es en freenode o un otra network? Estoy en #django-es ahora. (Como se dice "network"?) --~--~-~--~~~---~--~~ 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: ANN: Django-fr.org is out!
On 6/21/07, Jeremy Dunck <[EMAIL PROTECTED]> wrote: > > I don't speak French, but this is very nice to see. > > Is there any interest in a #django-es for Spanish? I speak a little > of that and would like to improve. I could help with Django and > others could help me with Spanish. ;-) > /me raises hand I'm there right now. Alone. :) Also take a look to http://groups.google.es/group/django-es and http://django.es/ Regards, -- Ramiro Morales --~--~-~--~~~---~--~~ 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: ANN: Django-fr.org is out!
On 6/22/07, Christian Markwart Hoeppner <[EMAIL PROTECTED]> wrote: > > Hey! I was just thinking about this. Count me in. Anyone else in to get > #django-es and django-es.org/com/es up? Spanish people need spanish > django ;) > I'm GMT-6, which I think will only be an issue while there are fewer than 10 people on the channel. :) --~--~-~--~~~---~--~~ 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: virtualhosts, mod_python, and Django's cache
I will try it out. If you say it is stable, it most likely is. Do you have a tutorial for getting it configured? If not, I can make one as I go along. Thanks for all your help. On Jun 22, 5:43 am, Graham Dumpleton <[EMAIL PROTECTED]> wrote: > On Jun 22, 2:40 pm, "Jeremy Dunck" <[EMAIL PROTECTED]> wrote: > > > On 6/21/07, Graham Dumpleton <[EMAIL PROTECTED]> wrote: > > > > To be honest I haven't ever done anything with Django past the hello > > > world examples, > > > Graham, thank you for frequently answering questions that fall in the > > gap between Django and mod_python, especially given your more recent > > work onmod_wsgi. > > No problem. Invariably people using Django or even other packages such > as TurboGears or Pylons never actually come over to the mod_python > list when they have problems, so me coming here is the only way I can > find out and understand what issues people are having which may relate > to mod_python. My ulterior motive of course is to make sure I know > what the problems are with mod_python so I can do it right in > mod_wsgi. Also, hopefully answering questions will give me some > credibility when it comes to trying to convince people that mod_wsgi > is a good idea and that the code that is already available and ready > to release is stable like I claim it is. :-) > > Graham --~--~-~--~~~---~--~~ 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: Ticket #3297 & Newforms Image Uploading
On 6/22/07, Dirk van Oosterbosch, IR labs <[EMAIL PROTECTED]> wrote: > This is what I did for the field validation http://dpaste.com/12715/ > > the code to save the field data is in the view that uses this form. > Nice! Would you maybe be willing to share your view code too? Can't paste the code from the actual app (am under NDA) but the logic in saving the image from form data is here: http://dpaste.com/12731/ Oh, and make sure you add the following enctype attribute to your form: ... -- _nimrod_a_abing_ http://abing.gotdns.com/ http://www.preownedcar.com/ --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: User data shared between two websites
James is correct. Steps 3-5 above actually refer to automatic login(user stored in session) and session sharing, not just sharing users. However, I assumed you would want to do this as well. On Jun 21, 4:14 pm, "James Bennett" <[EMAIL PROTECTED]> wrote: > On 6/21/07, Petey <[EMAIL PROTECTED]> wrote: > > > Is there a way to use the same authentication tables between multiple > > sites? I want users on one of my websites to be able to use the same > > login on another without duplicating the tables. Is this possible. I > > couldn't tell if the add-on sites module could server that purpose or > > not. > > Instances of django.contrib.auth.User on multiple sites which share a > single database are automatically shared among all of those sites; you > don't need to do anything special or make any changes. > > The sites framework in django.contrib.sites is there to make it easier > to specify that certain objects are tied to specific sites, for cases > where you need to enforce such a restriction. > > -- > "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: Scalability where file uploads are involved
I've done some preliminary work integrating Tramline with django applications. It wasn't difficult to set up and the performance was impressive. We are looking at this solution now for all of our media handling in Django going forward. http://infrae.com/products/tramline On Jun 7, 12:38 pm, "Nimrod A. Abing" <[EMAIL PROTECTED]> wrote: > Hello, > > I am currently doing research on scaling one of the sites I made using > Django. I have looked at Chapter 21 of the in-progress Django Book. I > plan to follow the track recommending 3 django servers behind perlbal > + 1 dedicated media server + 1 dedicated database server. > > The current setup for the site I am working on uses a single machine > for the whole site. I have Apache + mod_python on one IP address > serving Django requests. For media, I have lighttpd running on another > IP address on the same machine. Postgresql is also running on the same > machine. > > This site allows users to upload pictures. Those uploaded pictures are > then served by lighttpd. While this works quite well in our single > machine setup I am dumbfounded as to how to handle file/image uploads > when we finally move to a load-balanced setup with a dedicated media > server. > > The only thing I can think of right now is to share a directory on the > dedicated media server and have each server in the Django cluster > mount that share either through NFS or Samba. But I don't think it's a > good idea to do it this way. > > Does anyone know how else this can be done? > > Thanks in advance. > -- > _nimrod_a_abing_ > > http://www.preownedcar.com/http://abing.gotdns.com/ --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Newbie Question - How do I get my burger and fries from BK and not Mickey D's?
I'm a true novice programmer, brand new to django, but lovin' it so far. I was wondering if there was any way to do something a little tricky via the Admin classes that could help me not write a custom view. Basically I'd love to do all my data entry from the Admin interface, but I need to filter a set of choices on one Admin input interface based on a choice I make further up the form. I live in a world with: 2 restaurants (McDonalds and Burger King) 4 menu items, the same type of food at each restaurant (mc_burger, mc_fries, bk_burger, bk_fries) Each time I eat at one of those restaurants I want to make a record of the meal in my database. So I do the data entry through the django Admin backend. If I select "Burger King" as the restaurant that I eat my meal at, when it comes time to select the dishes I ate, I really only want to see bk_fries and bk_burger, cuz I ate at BK and not mickey D's. Can this be done just using the Admin class in models.py? Here's the sample code that I'm working with in model.py: class Restaurant(models.Model): def __str__(self): return self.name name = models.CharField('Restaurant Name', maxlength=200, blank=True) class Admin: fields = ( ('Restaurant Name' , {'fields': ('name',)}), ) pass class Dishes(models.Model) def __str__(self): return self.name name = models.CharField('Restaurant Name', maxlength=200, blank=True) class Admin: fields = ( ('Dish Name' , {'fields': ('name',)}), ) pass class IndividualMeal(models.Model): def __str__(self): return self.name restaurant_name = models.ForeignKey(Restaurant, verbose_name="restaurant") date_of_visit = models.DateTimeField('date of visit') dishes = models.ManyToManyField(Dish, verbose_name="individual dishes") class Admin: fields = ( ('Restaurant Name' , {'fields': ('restaurant_name',)}), ('Date of Visit', {'fields': ('date_of_visit',)}), ('Dishes', {'fields': ('dishes',)}), ) pass --~--~-~--~~~---~--~~ 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: ANN: Django-fr.org is out!
> Is there any interest in a #django-es for Spanish? I speak a little > of that and would like to improve. I could help with Django and > others could help me with Spanish. ;-) Hey! I was just thinking about this. Count me in. Anyone else in to get #django-es and django-es.org/com/es up? Spanish people need spanish django ;) Chris Hoeppner www.pixware.org --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: i18n problem with newforms
Thanks. Its working --~--~-~--~~~---~--~~ 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: 'retrieve': the missing permission?
2007/6/20, David Larlet <[EMAIL PROTECTED]>: > 2007/6/20, Gábor Farkas <[EMAIL PROTECTED]>: > > > > David Larlet wrote: > > > 2007/6/18, David Larlet <[EMAIL PROTECTED]>: > > >> Hi, > > >> > > >> I've just tried to use the permission_required decorator for my views > > >> and I realise that there is a missing 'retrieve' permission. It's a > > >> bit odd because others ones follow the CRUD permissions. > > >> > > >> Am I missing something here? > > >> > > >> The patch is trivial: > > >> Add 'retrieve' to the auth.management._get_all_permissions function, > > >> but I don't want to hack my django code so I wonder why this choice > > >> had been done? (I suspect the admin goal which is driven by the > > >> User.is_staff field but auth can be used elsewhere). > > >> > > >> David > > >> > > > > > > Am I the only one who deal with this kind of permission issue? Or > > > maybe there is an evident solution that I haven't found yet? > > > > > > you can create your own permissions: > > > > http://www.djangoproject.com/documentation/model-api/#permissions > > > > I know this solution which require to modify all my models or, easier, > to hack the auth.management._get_all_permissions function as I said > before. > > I just wonder why this permission is not part of the default > permissions (like add, change and delete)? > > David > No more thoughts about that? I'm really surprised that it only happens to me, maybe I will be luckier on the users' mailing-list? David --~--~-~--~~~---~--~~ 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: virtualhosts, mod_python, and Django's cache
On Jun 22, 2:40 pm, "Jeremy Dunck" <[EMAIL PROTECTED]> wrote: > On 6/21/07, Graham Dumpleton <[EMAIL PROTECTED]> wrote: > > > To be honest I haven't ever done anything with Django past the hello > > world examples, > > Graham, thank you for frequently answering questions that fall in the > gap between Django and mod_python, especially given your more recent > work onmod_wsgi. No problem. Invariably people using Django or even other packages such as TurboGears or Pylons never actually come over to the mod_python list when they have problems, so me coming here is the only way I can find out and understand what issues people are having which may relate to mod_python. My ulterior motive of course is to make sure I know what the problems are with mod_python so I can do it right in mod_wsgi. Also, hopefully answering questions will give me some credibility when it comes to trying to convince people that mod_wsgi is a good idea and that the code that is already available and ready to release is stable like I claim it is. :-) Graham --~--~-~--~~~---~--~~ 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: Ticket #3297 & Newforms Image Uploading
On 22-jun-2007, at 6:22, Nimrod A. Abing wrote: > I have managed to do > so either by processing in the view or extending the form. As of now, > all processing of all forms occur in the view and validation for file > and image fields in a method of the form. > > This is what I did for the field validation http://dpaste.com/12715/ > the code to save the field data is in the view that uses this form. Nice! Would you maybe be willing to share your view code too? Thnx dirk --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Travel Turkey Free Holiday in Antalya
Travel Turkey Free Holiday in Antalya http://holidayfree.blogcu.com http://holidayfree.blogspot.com http://besthotel.blogcu.com http://fantastictigar.blogspot.com http://comicworldturkey.blogspot.com/ http://iphoneword.blogspot.com/ http://newsupercars.blogspot.com/ Birlikte çok güleceğiz...Happy Men and Women ! HER KONUDA KOMİK VE İLGİNÇ BLOGLARIM MEVCUTTUR... http://bluetigar.blogcu.com ( Asıl blogtur. Gülme garantilidir. Her gün güncellenir, 500 sayfanın üzerindedir. Binlerce komik resim, karikatür, fıkra, yazı, video, oyun vs. sizi bekliyor. Gülmek istiyorsanız mutlaka bakın... Gülme Garantilidir...Asıl blogdur.) YENİ BLOGLARIM http://cemyilmazfan.blogcu.com ( Cem Yılmaz Hakkında her şeyi burada bulabilirsiniz... Gülmeye devam...) http://dunyaguzelleri.blogcu.com/ ( Dünya Güzellerini burada bulabilirsiniz...) http://ruyatatilrehberi.blogcu.com ( Rüya Tatil Rehberi ile rüya gibi tatil yerlerini tanıyacaksınız... ) http://dizimatik.blogcu.com ( Televizyondaki tüm dizeler hakkında detaylı bilgileri burada bulabilirsiniz... ) DİĞER BLOGLARIM http://mavikaplan.blogcu.com ( Asıl bloğun devamı sayılır, gülmeye devam etmek isteyenler için...) http://bluetigar.blogspot.com ( Mavi Kaplan Efsanesi Yurtdışı Sitesi. Komik resimler, videolar, yazılar...) http://bluetigar.onpunto.com ( Mavi Kaplan Efsanesi Onpunto Şubesi. Komik resimler, videolar, yazılar...) http://superkomik.blogcu.com ( Adı üstünde sadece süper komik şeyler bulunur...) http://bombakomik.blogcu.com ( En Bomba Komik şeyleri burada bulabileceksiniz.. ) http://koskomiksempanze.blogcu.com ( Koskomik Şempanzede gülmekten yerlere yatacaksınız...) http://bluetigarturkey.blogcu.com ( Mavi Kaplan Efsanesi Şubelerinden biri. Gülmeye devam...) http://salakileavanak.blogcu.com ( Hayatımızdaki komik salaklıkları ve avanaklıkları burada bulabileceksiniz.. ) http://komocko.blogcu.com ( Komocko nedir ? Bilmiyorsanız ve çok aşırı gülmek istiyorsanız mutlaka bakın...) http://komocko.blogspot.com ( Komocko nedir ? Bilmiyorsanız ve çok aşırı gülmek istiyorsanız mutlaka bakın...Devamıdır...) http://komikefsane.blogcu.com/ ( Komik ama efsane olamadı henüz ama çok güleceğiniz kesin. ) http://komikssk.blogcu.com ( Komik Ssk ile çok güleceksiniz... ) http://ayranicefsanesi.blogcu.com/ ( Nazmi Ayraniç'in maceralarına çok güleceksiniz. ) http://nobran.blogcu.com ( Nobran konular merkezinde çok güleceksiniz ) http://cimbomgalatasaray.blogcu.com/ ( Galatasaray'ın Gayri Resmi Sitesi. Hiçbir yerde bulamayacağınız resimler, videolar, yazılar...) http://yasafenerbahce.blogcu.com/ ( Fenerbahçe Sitesi. Hiçbir yerde bulamayacağınız resimler, videolar, yazılar...) http://adsanse.blogcu.com ( Bloğunuza Adsense'den Reklam alarak para kazanın ! Ayrıntılı bilgiyi burada bulabilirsiniz... ) http://adsenseileparakazan.blogcu.com ( Adsense ve Adwords hakkında Herşey ) http://emesenci.blogcu.com ( Msn üzerine her türlü bilgi ve programlar ) http://iphonedunyasi.blogcu.com ( Iphone hakkında Herşey ) http://lcdtv.blogcu.com ( Lcd ve Plazma Tv Hakkında Herşey ) http://morlahana.blogcu.com ( Yemek üzerine Herşey ) http://muzikhaberleri.blogcu.com ( Güncel ve ilginç Müzik haberleri... ) http://sozlermuzikler.blogcu.com ( Yerli Yabancı Şarkı Sözleri... ) http://sozmuzik.blogcu.com ( Yerli Yabancı Şarkı Sözleri - 2... ) http://haberdunyasi.blogcu.com ( Güncel ve ilginç haberler... ) http://maviaraba.blogcu.com ( Arabalar hakkında Herşey ) http://mimber.blogcu.com ( Ciddi konular, okumanızı tavsiye ederim... ) http://omurboyuask.blogcu.com ( Aşk ile ilgili Konular ) http://astrolojist.blogcu.com ( Astroloji ve Burçlar ) http://omurboyusaglik.blogcu.com ( Sağlıkla ilgili Konular ) http://dis.blogcu.com ( Diş üzerine Herşey ) http://sacdokulmesi.blogcu.com ( Saç ve Saç sağlığı üzerine Herşey ) http://www.paratikla.com/signup.php?r=7740 ( Tıkla para kazan sitesi ) http://isminizinanlami.blogcu.com/ ( İsminizin anlamını burada bulabilirsiniz... ) http://antalyarehberi.onpunto.com ( Antalya hakkında Her türlü bilgiyi bulabilirsiniz ) http://kocaeliveizmit.blogcu.com ( Kocaeli ve İzmit hakkında Her türlü bilgiyi bulabilirsiniz... ) http://bilimhabercisi.blogcu.com ( Bilim ve teknoloji hakkında herşeyi burada bulabilirsiniz...) --~--~-~--~~~---~--~~ 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: i18n problem with newforms
On Fri, 2007-06-22 at 02:20 -0700, Scater wrote: [...] > django rev 5511 > in i18n i have two languages: english and russian. > DEFAULT_CHARSET = 'utf-8' > all files in utf-8 > when i use russian as active language i has error: [...] > UnicodeDecodeError at /ru/contacts/ > 'ascii' codec can't decode byte 0xd0 in position 24: ordinal not in > range(128) Use the Unicode branch if you want to use non-ASCII characters at the moment. Regards, Malcolm --~--~-~--~~~---~--~~ 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: Apache auth
Hi, I haven't seen this error myself yet, but you could try to use the patch here: http://code.djangoproject.com/ticket/3583 SmileyChris was so nice as to improve my initial patch, and possibly this will sooner or later even make it into trunk. cheers, Sean David Reynolds wrote: > Hi, > > I've been playing with the apache auth from djangosnippets [0] and > I've had it working, but it now seems to be erroring a lot with the > following error: > > Mod_python error: "PythonAccessHandler historymagazine.modpython" > > Traceback (most recent call last): > > File "/usr/lib/python2.4/site-packages/mod_python/apache.py", line > 287, in HandlerDispatch > log=debug) > > File "/usr/lib/python2.4/site-packages/mod_python/apache.py", line > 464, in import_module > module = imp.load_module(mname, f, p, d) > > File "/var/www/django/historymagazine/modpython.py", line 2, in ? > from django.core.handlers.base import BaseHandler > > ImportError: No module named django.core.handlers.base > > Anyone have any ideas why this might be happening? > > Thanks, > > David > > [0 - http://www.djangosnippets.org/snippets/62/] > --David Reynolds > [EMAIL PROTECTED] > > --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
i18n problem with newforms
this is the form code: class ContactForm(forms.Form): subject = forms.CharField(max_length=255, label=_('Subject')) email = forms.EmailField(label=_('Email')) message = forms.CharField(max_length=1024, widget=Textarea, label=_('Message')) this is the view code: def contacts_form(request, language = None): if request.method == 'POST': form = ContactForm(request.POST) if form.is_valid(): # Do form processing here... return HttpResponseRedirect('/url/on_success/') else: form = ContactForm() return render_to_response('contacts/contacts_form.html', {'form': form}) django rev 5511 in i18n i have two languages: english and russian. DEFAULT_CHARSET = 'utf-8' all files in utf-8 when i use russian as active language i has error: Traceback (most recent call last): File "c:\web\Python24\lib\site-packages\django\template\__init__.py" in render_node 738. result = node.render(context) File "c:\web\Python24\lib\site-packages\django\template\__init__.py" in render 793. return self.encode_output(output) File "c:\web\Python24\lib\site-packages\django\template\__init__.py" in encode_output 772. return str(output) File "c:\web\Python24\lib\site-packages\django\utils\encoding.py" in __str__ 31. return self.__unicode__().encode(settings.DEFAULT_CHARSET) File "c:\web\Python24\lib\site-packages\django\newforms\forms.py" in __unicode__ 76. return self.as_table() File "c:\web\Python24\lib\site-packages\django\newforms\forms.py" in as_table 154. return self._html_output(u'%(label)s%(errors)s% (field)s%(help_text)s', u'%s', '', u'%s', False) File "c:\web\Python24\lib\site-packages\django\newforms\forms.py" in _html_output 139. output.append(normal_row % {'errors': bf_errors, 'label': label, 'field': unicode(bf), 'help_text': help_text}) UnicodeDecodeError at /ru/contacts/ 'ascii' codec can't decode byte 0xd0 in position 24: ordinal not in range(128) i have seen "http://groups.google.ru/group/django-users/browse_thread/ thread/4baccb642ab6213e/ab6c37c6605544c0?lnk=gst&q=i18n +newforms&rnum=1#ab6c37c6605544c0" but there was no solution in that thread --~--~-~--~~~---~--~~ 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: Order_by lower...
Thanks for your answer On 22 juin, 01:58, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > On Thu, 2007-06-21 at 06:41 -0700, greg wrote: > > Hi, > > > Please help me ! > > > I just wanna know how to order my queryset by lowering my field > > before, like in SQL (ORDER BY LOWER(my_field) 'cause in this field > > I've upper et lower case and by default my result is not sorted as I > > want. > > At the moment you cannot do this with theorder_byfield or any ordering > options on a Queryset. The reason is because all the ordering is done at > the database level and there is no way to pass through functions like > LOWER() to that level. > > You could try sub-clasing QuerySet and adding extra code to do that. Off > the top of my head, I'm not sure how hard that would be to do, or even > if it's possible. > > The alternative is to sort the results in Python. > > Regards, > Malcolm --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Bug: caching & save() ?
I do bulk updates on the database, particularly when importing data from an external source. This seems to cause a caching issue. I tracked down the issue to: $ manage shell >> from models import Book >> bb = Book.objects.all() >> for b in bb: >>b.title = "xx" >>b.save() >> ^Z $ manage shell >> from models import Book >> bb = Book.objects.all() >> for b in bb: >>b.title = "yy" >>b.save() >> print bb[0].title xx >> cc = Book.objects.all() >> print cc[0].title yy Why is the first query set not displaying the book's new name? Why do I have to create a new query set? This does sound somewhat counterintuitive. FYI, I'm using v0.96 and sqlite3. JJ. --~--~-~--~~~---~--~~ 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: two way edit ManyToManyField in admin interface
Oh, sorry. It works. Even, I found a mention about that in documentation. Thanks. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Mysql sleeping queries
On Tue, 2007-06-19 at 06:51 +0100, David Reynolds wrote: > Morning, > > We are experiencing a problem with Mysql with django. Since an svn > up yesterday (which seems to be revision 5492) we have lots of > sleeping (hanging) mysql processes and we keep hitting our limit of > processes (which we weren't doing before). Anyone have any idea why > it may be doing this? One (hopefully) final update to this thread. After a fair bit of discussion here and on the developer's list, we've pulled the changes that were causing these problems out of the code. So if everybody who was seeing the problems wants to update to [5511], things should be back to normal. Apologies for the length of the threads involved and thanks to everybody who has worked on diagnosing, understanding and solving the problems so far. This is why we like people testing trunk. Regards, Malcolm --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: newforms, unicode and umlauts
thanks for your answer. I´ve been trying to solve this for about 8 hours ... finally giving up. so, I´ll switch to the unicode-branch. Am 22.06.2007 um 02:02 schrieb Malcolm Tredinnick: > > On Thu, 2007-06-21 at 16:23 +0200, va:patrick.kranzlmueller wrote: >> the code below does not give a validation error when typing umlauts, >> but the umlauts are not saved to the database. >> >> al_re = re.compile(r'^\w+$', re.UNICODE) >> >> def clean_last_name(self): >> if 'last_name' in self.cleaned_data: >> if not al_re.search(self.cleaned_data['last_name']): >> raise forms.ValidationError('Error message.') >> return self.cleaned_data['last_name'] >> >> when doing "print self.cleaned_data" I´m getting this: >> 'last_name': u'M\xfcller', >> >> how am I supposed to deal with umlautes when using newforms? >> btw: all our data is utf-8 > > There are lots of little bugs like this on trunk at the moment. If you > want to use non-ASCII characters, switch to using the Unicode branch. > It's completely up-to-date with trunk (merged about twice a week, > providing there are no risky changes on trunk that haven't settled). > > Part of the problem is that newforms (on trunk) tries hard to be > unicode-aware, but the transition from unicode to byestrings is not > handled well in other places in the framework. That is why we are > making > all the changes on Unicode branch (which will soon be on trunk). > > Regards, > Malcolm > > > > > --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---