Re: dynamic method calling

2008-11-22 Thread Steve McConville
> On Sat, Nov 22, 2008 at 2:38 AM, Chris <[EMAIL PROTECTED]> wrote: >> Hello everyone, >> I have a quick python question. Is they a better way of calling a >> method dynamically then what I have below? Is there a more elegant >> approach? Thanks in advance. >> try: self.__class__.__dict__[met

Re: A Very Puzzling MySQL Issue Performance...

2009-02-06 Thread Steve McConville
> I think the effect you are seeing is more of MySQL thing than a Django > thing, so that is where I'd be looking for a better idea of what the server > is doing to speed up subsequent queries like this (in fact I think I recall > reading about it at some point in reading up on MySQL, though I don

Setting a default value for a select widget in a modelformset

2010-09-02 Thread Steve McConville
We have a modelformset created like this: DocumentFormSet = modelformset_factory(Document, extra=0, fields=('name', 'category') with a models.py like this: class Category(models.Model): name = CharField(max_length=100) # other stuff class Document(models.Model): name = CharField(max

Re: Django performance on Amazon EC2

2010-01-12 Thread Steve McConville
> EC2 m1.small instance, talking to another m1.small instance hosting MySQL db > > DB performance doesn't seem to be the issue - I don't see the DB server > under any load at all. What sort of network latencies are you seeing? Are they hosted in US-East-1? http://alan.blog-city.com/has_amazon_ec2

Re: Django performance on Amazon EC2

2010-01-12 Thread Steve McConville
> Yes, hosted in US-East-1, but I was running benchmark tests from another EC2 > instance in the same region, so reasonably sure it's not latency. I meant latencies internal to EC2; eg. what is your ping time between the frontend and the DB box? The article I linked to reports that this has been o

Re: Why does django use mysqldb over mysql-connector?

2012-05-03 Thread Steve McConville
> Has this happened by default or by design?  Is mysqldb really that much > faster, or featureful, or just because it's more common? >From http://forge.mysql.com/projects/project.php?id=302 "Development Status: Early (Pre-Alpha)" -- steve -- You received this message because you are subscribe

Re: Graphs for my Django Application

2012-06-08 Thread Steve McConville
> Can anyone give me idea how to provide graphs in Django. Assuming you mean "graph" in the "graph theory" sense, then NetworkX (http://networkx.lanl.gov/) is a mature graph library for python. -- steve -- You received this message because you are subscribed to the Google Groups "Django users

Re: I am in trouble

2012-09-26 Thread Steve McConville
Instead of > test.py: > > " > from mod_python import apache >def index(reg): > retutn "test successful!" > " > Try: " from mod_python import apache def index(reg): return "test successful!" " Note that there is no space preceding the 'def'. Indentation is meaningful in p

Re: Can you drop a Python script into a Django page?

2011-11-12 Thread Steve McConville
> Is it possible to drop a Python script (around 50 lines) into one of your > django pages? Would this be embedding into the template code? You could wrap it in a custom template tag: https://docs.djangoproject.com/en/1.3/howto/custom-template-tags/ -- steve -- You received this message becau

Re: .filter() and .exclude() don't add up

2013-07-26 Thread Steve McConville
Firstly (and I don't think this is the cause of the problem) you're calling datetime.now() four times, which will give you four different datetimes (ie. the queries will not be completely identical). Secondly SQL uses a 3-valued logic (with null) so if any of the fields you're filtering on are null

Re: .filter() and .exclude() don't add up

2013-07-26 Thread Steve McConville
> So, if one of the fields can be Null, then *neither*: > > queryset.filter(field=value) > > queryset.exclude(field=value) > > will match a record where it's Null? As I understand it, this is correct - it's certainly the way SQL was designed. > In that case, is there a better - more relia

Re: .filter() and .exclude() don't add up

2013-07-27 Thread Steve McConville
Perhaps I'm not sure exactly what you mean by "more general", but I was recommending something like red_things = queryset.filter(Q(color="red")) non_red_things = queryset.filter(~Q(color="red") | Q(color__isnull=True) This will produce SQL like SELECT * FROM queryset WHERE color IS 'red'; SELECT

Re: Django and PIL problem?

2011-01-10 Thread Steve McConville
Unlike some of the other methods in PIL "thumbnail" modifies the file in place and returns None. This will probably do what you expect: import Image ARTICLE_LARGE_SIZE = 230,300 tmp_file = Image.open(form.cleaned_data['image']) tmp_file.thumbnail(ARTICLE_SMALL_SIZE) tmp_file.save(location + '/smal

Re: write equation in django

2014-08-12 Thread Steve McConville
There are a number of ways to do this, but the most popular I think is MathJax. There is a django app for assisting with it's integration here: https://github.com/kaleidos/django-mathjax On 12 August 2014 07:51, sandy wrote: > Hi, > I want to include a mathematical equation in django project. C

Re: Django + microservices: What's correct approach?

2015-08-25 Thread Steve McConville
Hi Crohn. You're asking a lot of related but very general questions here. I know you are looking for someone who has "had the same problem" but we don't know what your problem is. The whole point of any architecture is that it's supposed to be a solution to your problems, not a problem in itself :