Automatically block requests from bad IP addresses

2012-02-11 Thread Addy Yeow
I was looking for a Django solution to automatically block requests from bad IP addresses to some of my apps. After searching for a while without much luck, I attempted to write a simple Python script that: - parses my Apache access log - block IP that made too many requests within a set interval

What Can I use?

2012-02-11 Thread coded kid
Hey guys, anyone know about a django package I can use for comment in django site? The one I see is Django-comment but it's not maintained anymore. What other one do you know about? Thanks. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post

Re: Generating a list of available templates

2012-02-11 Thread bb6xt
Here's my two cents. Hope it helps some. from proj.settings import TEMPLATE_DIRS, INSTALLED_APPS import os def recursive_search(path): result = [] for i in os.listdir(path): if not os.path.isdir(os.path.join(path, i)): result.append(i) else: result.extend(recu

How do I sort choices by their localized label?

2012-02-11 Thread Salvatore Iovene
Hi, I have the following custom field: from django.utils.translation import ugettext_lazy as _ COUNTRIES = ( ('GB', _('United Kingdom')), ('AF', _('Afghanistan')), ('AX', _('Aland Islands')), ('AL', _('Albania')), ('DZ', _('Algeria')), . . . ) class CountryField(m

compare two querysets

2012-02-11 Thread Sells, Fred
I've got a use case where I need to find the fields that are different between two querysets in the same model and then use those fields to modify another queryset in that model. The first two represent "masks" of allowed fields for a specific version while the third is the actual data. Assessmen

Re: How do I sort choices by their localized label?

2012-02-11 Thread Kevin Harvey
Have you tried sorting them at the template level? A filter like dictsort might do the trick https://docs.djangoproject.com/en/dev/ref/templates/builtins/?from=olddocs#dictsort -- You received this message because you are subscribed to the Google Groups "Django users" group. To view this discu

Re: What Can I use?

2012-02-11 Thread Kevin Harvey
I always look at djangopackages.com for questions like this: http://djangopackages.com/grids/g/commenting/ -- You received this message because you are subscribed to the Google Groups "Django users" group. To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/

Re: django discarding MySQL results for "in" operator

2012-02-11 Thread Jon
Karen Tracey gmail.com> writes: > > > On Mon, Jan 5, 2009 at 3:37 PM, JonUK flinttechnology.co.uk> wrote: > > > > Apologies as this is a repost, but I'm completely stuck! > I'm using django 1.0.2 and the tagging app to retrieve a tag via a > database "in" query, and something is causing th

Re: Generating a list of available templates

2012-02-11 Thread Patrick Wellever
Thanks for weighing in, that is helpful, and last night I was playing around with a somewhat similar approach. It's not exactly what I was hoping for, because it still isn't really integrated with the way Django uses template loaders. This solution works for TEMPLATE_DIRS and INSTALLED_APPS, bu

Re: User .get_all_permissions() vs. .has_perm() inconsistency

2012-02-11 Thread dslowik
Yes, I have to agree entirely.. I bungled the OP. Here is what the code snippet should have been: >>> from django.contrib.auth.models import User >>> u = User.objects.get(username='clint') >>> u.get_all_permissions() set([u'wb.delete_libraryitem', u'wb.change_libraryitem']) >>> u.has_perm("wb.add_l

Mod_Wsgi + Apache 2.2 + Threads + httplib2

2012-02-11 Thread Phyllipe
I have a python file that works as well, it connects in another website, doing something like that: 'response, content = self.http.request('http://www.spoj.pl/', 'POST', headers=self.headers, body=urlencode(self.bodyLogin))' It goes inside a class, when I run it in a thread it does not works. If I

Re: list_editable raising a MultiValueDictKeyError

2012-02-11 Thread Luigi Panzeri
I added the missing form inputs as follows: if ($('.editable').length > 0) { $('.action-select').each(function(i, el) { var item_id = $(el).val(); $('form').append(""); }); } It seems a bug On Feb 7, 9:10 pm, Nick wrote: > Whenever I use list_editable inside of the django admin atte

Re: How do I sort choices by their localized label?

2012-02-11 Thread ajohnston
I think this should work: >>> COUNTRIES = ( ... ('GB', _('United Kingdom')), ... ('AF', _('Afghanistan')), ... ('AX', _('Aland Islands')), ... ('AL', _('Albania')), ... ('DZ', _('Algeria')),) >>> sorted(COUNTRIES, key=lambda COUNTRIES: COUNTRIES[1]) [('AF', 'Afghanistan'), ('AX', 'Aland Islands')

Re: How do I sort choices by their localized label?

2012-02-11 Thread ajohnston
Sorry I just realized that even though that sorts them correctly, it doesn't solve your problem. Have you tried setting the choices in your form, like: class SomeFormUsingCountryField(forms.Form): def __init__(self, *args, **kwargs): super(SomeFormUsingCountryField, self).__init__(*ar

Re: Mod_Wsgi + Apache 2.2 + Threads + httplib2

2012-02-11 Thread Phyllipe
My server config: Apache/2.2.14 (Ubuntu) DAV/2 SVN/1.6.6 PHP/ 5.3.2-1ubuntu4.10 with Suhosin-Patch mod_wsgi/3.3 Python/2.6.5 configured -- resuming normal operations There is no error at apache log. I've tried to put: try: ...response, content... ...print "NEXT" except Exception as detail: ..print

Re: Mod_Wsgi + Apache 2.2 + Threads + httplib2

2012-02-11 Thread Phyllipe
Just to give more details that I think can be relevant: "Hi everyone, I have a django application that works pretty fine with django web- server. I have a python file that uses Http() from httplib2, it works very well! But when I create a thread and in this thread use this python file(more precisel

Re: How do I sort choices by their localized label?

2012-02-11 Thread Salvatore Iovene
On Saturday, February 11, 2012 7:32:09 PM UTC+2, ajohnston wrote: > > Have you tried setting the choices in your form, like: > > class SomeFormUsingCountryField(forms.Form): > def __init__(self, *args, **kwargs): > super(SomeFormUsingCountryField, self).__init__(*args, > **kwargs)

Re: Digest for django-users@googlegroups.com - 18 Messages in 8 Topics

2012-02-11 Thread yonatan braude
I have configured the tinymce, but I can't get the local file browsing... and leads...? thanx... -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group,

Re: How do I sort choices by their localized label?

2012-02-11 Thread ajohnston
> class CountryField(models.CharField): >     def __init__(self, *args, **kwargs): >         kwargs.setdefault('max_length', 2) >         kwargs.setdefault('choices', COUNTRIES) >         super(CountryField, self).__init__(*args, **kwargs) Btw, the reason this doesn't work is because setdefault do

Re: What Can I use?

2012-02-11 Thread Chen Xu
For those packages, I wonder where I can find a demo about how they look ? Thanks very much Best regards On Sat, Feb 11, 2012 at 8:24 AM, Kevin Harvey wrote: > I always look at djangopackages.com for questions like this: > http://djangopackages.com/grids/g/commenting/ > > -- > You received thi

Re: What Can I use?

2012-02-11 Thread Mike Dewhirst
On 11/02/2012 9:38pm, coded kid wrote: Hey guys, anyone know about a django package I can use for comment in django site? The one I see is Django-comment but it's not maintained anymore. What other one do you know about? Thanks. Is there something wrong with django.contrib.comments ??? It is b

Unit test example for web froms

2012-02-11 Thread Mario Gudelj
Hi guys, I was wandering if anyone has a good example of a unit test where they have a view which processes a web form. I'm not sure how you'd test something like that. Thanks, mario -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to