Re: Very bad experience in Django...
steveneo wrote: > I try to use Django in a new project. Honestly, it is very bad > experience. It looks not boosting my development speed. Today, I > almost give up and begin to look up another Python framework Go for it :-) Chris -- Simplistix - Content Management, Zope & Python Consulting - http://www.simplistix.co.uk --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Very bad experience in Django...
steveneo wrote: > BooleanField limits only to CheckBox? But I set > widget=HiddenField It does not report error. HTML renders > correctly, but actually, you can not use like that?! Didn't you hear me: I said go find another framework, Django obviously sucks because one new user can't get his head around it ;-) Chris -- Simplistix - Content Management, Zope & Python Consulting - http://www.simplistix.co.uk --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: URL & DB question
Rob B (uk) wrote: > Solved it by doing this: > > def profile_detail(request, name): > p = get_object_or_404(Profile, name=name) > return render_to_response('profile_detail.html', {'name': p}) How about using the detail generic view: from django.views.generic.list_detail import object_detail urlpatterns = patterns('', (r'^(?P[\w\._-]+)/$', object_detail, {'queryset':Profile.objects.all()})) cheers, Chris -- Simplistix - Content Management, Batch Processing & Python Consulting - http://www.simplistix.co.uk --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: URL & DB question
Rob B wrote: > Great I didn't know about that one. I'm curious to what are the > benefits of doing it that are? Less code for you to write and maintain :-) Chris -- Simplistix - Content Management, Batch Processing & Python Consulting - http://www.simplistix.co.uk --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: help with excel exports
Bobby Roberts wrote: > I'm generating the > response in my view as such: > >response = render_to_response("spreadsheet.html", { > 'tms': tms, > }) This is an evil hack, don't be surprised if weird things happen with it. You should be using xlwt to generate your spreadsheets: http://www.python-excel.org > response['Content-Type'] = 'application/vnd.ms-excel' > response['Content-Disposition'] = 'attachment;filename=biblio- > export.xls' ...then you wouldn't be flat out lying here ;-) > This works great with one exception. It saves the file to the > person's last saved location... in my case it's the desktop, in other > cases it's /downloads etc > > Is there a way to force the SAVE option so that when they click SAVE, > the user can determine where to put the file? My testing so far > indicates this is not browser independent Ultimately, your app has no business even trying to tell a browser where to save things. Most browsers nowadays save to a location configured by the user, if they right click and do something like "Save As" they will get dialog box asking them where to save things. cheers, Chris -- Simplistix - Content Management, Batch Processing & Python Consulting - http://www.simplistix.co.uk --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: OT: Drawing lines in the browser
Thomas Guettler wrote: > Hi, > > this is offtopic: How can you draw lines in a (django) web application? > > I think you need to use flash or java to do it. I googled for it, but found > only beta > quality projects. > > Has anyone experience with this? Depends on why you want to draw lines... If it's for graphs and the like, just use matplotlib and generate the graphs on the server as .png or .pdf :-) Chris -- Simplistix - Content Management, Batch Processing & Python Consulting - http://www.simplistix.co.uk --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: String aggregator
hyuen wrote: > When I use aggregators, I do something like > > T.aggregate(Max('LastName')) > > but the problem is that for aggregators, it expects a float, not a > string. Is it possible to use strings as maximum/minimum values? Where are you importing Max from? What is the error and traceback you get when you try to do the above? Chris -- Simplistix - Content Management, Batch Processing & Python Consulting - http://www.simplistix.co.uk --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: How to invoke hasNoProfanities?
Brandon Taylor wrote: > I would like to do some obscenity filtering on posts, and I see there > is a setting: PROFANITIES_LIST > > But, how to I invoke the hasNoProfanities validator? I searched the > django source code for this, but the only thing I could find was the > setting in conf > global_settings.py > > I'd appreciate some pointers. It's in the book, which is free to read online at http://djangobook.com/ cheers, Chris -- Simplistix - Content Management, Batch Processing & Python Consulting - http://www.simplistix.co.uk --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: help on outlook integration
kam wrote: > We have to integrate of web outlook using HTTP protocol. We are > trying to connect outlook with form based authentication to connect > using HTTP protocol. We are able to connect outlook using HTTPS and > COM object but this is not work on Linux & using COM object we are > able to access only outlook’s data. We are expecting header cookie and > response data from inbox page of outlook. I don't really understand how posting the same vague requirements once every 10-15 minutes is supposed to help other than by annoying everyone on this list... Chris -- Simplistix - Content Management, Zope & Python Consulting - http://www.simplistix.co.uk --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: perfomance question
Rodrigo Aliste P. wrote: > OH! It does it alone! Another awesome thing to my awesomeness list of > django. What was your solution in the end? I'm always interested this kind of batching of results, and I'm very new to Django... Chris -- Simplistix - Content Management, Zope & Python Consulting - http://www.simplistix.co.uk --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Should this be its own app?
Kenneth Gonsalves wrote: > I personally would put everything in one app at the start. If things start to > grow and you want to reuse that part in another project, or release it to the > public (and become famous), then it makes sense to factor it out into a > separate app - maybe a separate project somewhere in your system path so that > all your projects can use it. Over engineering at the start is usually > counter > productive. Interesting, I'm pretty sure I remember Jacob saying almost the exact opposite in his Django tutorial at PyCon... Chris -- Simplistix - Content Management, Zope & Python Consulting - http://www.simplistix.co.uk --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
djangorecipe questions
Hi Jeroen, What's the best mailing list to ask questions about djangorecipe on? I'm CC'ing django-users in the meantime, let me know if there's a better list... I'm just coming to Django myself but I've been a heavy buildout user for a year or so now... I'm curious as to why djangorecipe does its own thing with respect to downloading Django rather than relying on it as an egg? The reason I ask is that I often have other sections, mainly that just use zc.recipe.egg, to do certain bits of a project. For Django, I guess they'll need to use the Django egg, which, of course, will have to be separately downloaded :-S I guess another way of solving this would be console_scripts entry points. If these are specified in setup.py's of eggs specified in either the projectegg or eggs options, will they be created by djangorecipe? Also, is it common practice to have two djangorecipe sections, once for development and one for production, or is it more common to have a buildout.cfg and dev.cfg, with dev.cfg extending buildout.cfg? Finally, it's a shame that the projects generated by the project option are not eggs :-S Is there any reason for this? cheers, Chris -- Simplistix - Content Management, Batch Processing & Python Consulting - http://www.simplistix.co.uk --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: djangorecipe questions
Jeroen Vloothuis wrote: > Afaik there is no proper list. I don't follow dango-users but I'm fine > with also discussing it there. Yeah, this list is pretty busy! I'll try and keep an eye out for djangorecipe related posts and forward them your way ;-) > I'm curious as to why djangorecipe does its own thing with respect > to downloading Django rather than relying on it as an egg? > > When I started with the recipe Django 1.0 was not released (svn trunk > was the way to go). Another reason was that the Django community was not > that egg happy. Well, I'm certainly not setuptools-happy, but Django appears to be wrapped up as a standard distribution on PyPI (sorry, should have said distro, not egg), so it would make sense to use that... For me, djangorecipe should be some kind of subclass of zc.recipe.egg that just does the extra stuff for Django and creates a (package based) project if one isn't there... > I guess another way of solving this would be console_scripts entry > points. If these are specified in setup.py's of eggs specified in > either the projectegg or eggs options, will they be created by > djangorecipe? > > I'm not sure if that will work with the current code. Since it seems > like a nice feature I would welcome a patch. OK, I'll have a play. > Another solution that has been suggested in the past was to run setup.py > from the download like zc.recipe.egg does. This would make buildout know > about the version that djangorecipe fetched (either from svn or tgz). Yes, this is what I suggested above :-) > Also, is it common practice to have two djangorecipe sections, once > for development and one for production, or is it more common to have > a buildout.cfg and dev.cfg, with dev.cfg extending buildout.cfg? > > The way I use it is with a base.cfg (common stuff for both production > and development), a buildout.cfg which extends base.cfg for development > and then a production.cfg which extends base.cfg (which enables > production settings etc.). Ah, okay, what things do you set in production.cfg and buildout.cfg? (sorry if this is obvious stuff, I'm new to Django) > Finally, it's a shame that the projects generated by the project > option are not eggs :-S Is there any reason for this? > > This would be that I wanted to keep close to the way Django did projects > at that time. I see no reason at this time tho for not having a setup.py > file in the generated project (patches are appreciated :-) I'll see what I can do, but don't hold your breath ;-) (I'm currently following http://jacobian.org/writing/django-apps-with-buildout/ and on a bit of a tight deadline, so don't know when I'll be able to get to this) cheers, Chris -- Simplistix - Content Management, Batch Processing & Python Consulting - http://www.simplistix.co.uk --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: djangorecipe questions
James Bennett wrote: > On Thu, Sep 17, 2009 at 5:23 AM, Chris Withers wrote: >> Well, I'm certainly not setuptools-happy, but Django appears to be >> wrapped up as a standard distribution on PyPI (sorry, should have said >> distro, not egg), so it would make sense to use that... > > Putting on my release-manager hat for a moment, I'll note that we > currently *only* provide a source package and not an egg, and that's > likely to remain the case for the foreseeable future, because Django > is flat-out not zip-safe and probably never will be. zip-safe != egg. Using zipped eggs is something I hate and tell buildout not to do. That said, if in doubt, buildout/setuptools/etc always unzip eggs anyway. I feel I should point out that buildout/setuptools/etc work fine with source distributions, provided they play the game properly (ie: "python setup.py install" does) and don't do anything too outlandish. Having had a read of Django's setup.py, I can't see anything that would cause problems... > As such, I'd > strongly recommend against ever trying to install Django as an egg. ...even as an egg ;-) > Django *applications* also are not normally safe to install as eggs. I think you have an overly paranoid view of eggs. It's just a packaging mechanism. I'd be pretty surprised to find at application that couldn't be packaged as an egg. What makes you feel this wouldn't work or be safe to do? > Some parts of Django can handle the bizarre alternate reality > setuptools creates (e.g., there's a template loader which knows how to > look for templates inside eggs), but other parts can't (custom > management commands will completely break, for example). All of your problems seem to center on zipped eggs. These are evil things anyway, and can be avoided by simply putting zip_safe=False as a parameter to setuptools (whether it actually comes from setuptools, or if it comes from the maintained fork, distribute). Buildout event has a config options to say "I don't care whether the egg thinks it's zip safe or not, unzip it!" ;-) The real benefits come in being able to specify what versions of what other packages your package depends on, whether any of them use setuptools or distutils to create their packages, and being able to manage those dependencies with tools like buildout, so you get simple, easy and sane ways to reproduce whole project or even machine setups... I find the need to only do: python bootstrap.py && ./bin/buildout ..to get a completely set up and rigidly controlled environment pretty powerful. cheers, Chris -- Simplistix - Content Management, Batch Processing & Python Consulting - http://www.simplistix.co.uk --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
where to put tests?
Hi All, Will the Django testrunner really only find tests in a file called test.py? It strikes me that if a reasonable-sized app is fully tested, that tests.py is going to be unpleasantly long. How come the testrunner doesn't look for a package called tests like most of the other python testing frameworks? cheers, Chris -- Simplistix - Content Management, Batch Processing & Python Consulting - http://www.simplistix.co.uk --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: where to put tests?
Javier Guerra wrote: > reasonable-sized apps aren't too big; reasonably-factored projects > have lots of apps > > but, yeah, you're right that using a 'test' directory with an empty > __ini__.py and the tests files inside that should work... Nope, only finds them if you have a suite() function in the __init__ of your tests that returns all yours tests, which is a little bit limiting compared to other python test runners... Chris -- Simplistix - Content Management, Batch Processing & Python Consulting - http://www.simplistix.co.uk --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: djangorecipe questions
James Bennett wrote: > On Thu, Sep 17, 2009 at 6:01 AM, Chris Withers wrote: >> All of your problems seem to center on zipped eggs. These are evil >> things anyway, and can be avoided by simply putting zip_safe=False as a >> parameter to setuptools (whether it actually comes from setuptools, or >> if it comes from the maintained fork, distribute). Buildout event has a >> config options to say "I don't care whether the egg thinks it's zip safe >> or not, unzip it!" ;-) > > They are indeed evil, and what's more evil is the fact that opting out > of setuptools' overzealous zip behavior... requires you to switch to > using setuptools and buy into its way of doing things. I don't follow this, but then maybe that's 'cos I use buildout and never setuptools directly. Still, I know that this has been solved by flipping the default for zip_safe to False in distribute. "What's distribute?" I hear you ask. Well, enough people got fed up with Phil Eby's stubborn refusal to either do any maintenance of setuptools, or let anyone else do any, and so they forked it. Primarily led by Tarek Ziadé, it provides a setuptools package but in a distribution named "distribute" (yes, the name sucks, yes I complained about this, yes I was shouted down). I'm not 100% on the "future" of distribute, but the 0.6 release branch promises to be 100% backwards compatible with setuptools, and seems to achieve this pretty well. Tarek is responsive to bug reports and is also doing a lot of work surrounding packaging in the python core... > perhaps it is paranoia, but it's *justified* paranoia: I don't trust > setuptools as far as I can throw it, and I can't understand why anyone > else does. Well, virtualenv and buildout both use setuptools, and a *lot* of packages use it, so it's not all bad, promise ;-) It's currently, and will be for the forseable future, the *only* way to specify what packages your package depends on. Specifying dependencies is a good thing. Packaging things as python packages is a good thing. Using good tools to package project setups (buildout or virtualenv, whichever fits your brain) are good things. I hope you won't argue with any of those three ;-) > When I need that I use pip with requirements files, and I'm already > doing everything in virtualenv :) I don't know anything about pip and precious little about virtualenv, but this strikes me as having to worry about making sure you haven't forgotten some dependency of one of your project's dependencies. What if your project has different dependencies depending on what python version and/or platform it's deployed on? cheers, Chris -- Simplistix - Content Management, Batch Processing & Python Consulting - http://www.simplistix.co.uk --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
composite primary keys?
Hi All, Is it really the case that the Django ORM doesn't support composite primary keys? I'm looking to do the equivalent of the following sqlalchemy model: Base = declarative_base(...) class Month(Base): __tablename__ = 'months' username = Column( String,ForeignKey('users.name'),primary_key=True ) monthname = Column(String,primary_key=True,index=True) signins = Column(Integer,index=True) signouts = Column(Integer,index=True) total_pages = Column(Integer,index=True) last_viewed = Column(DateTime,index=True) cheers, Chris -- Simplistix - Content Management, Batch Processing & Python Consulting - http://www.simplistix.co.uk --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
specifying test-only dependencies with djangorecipe
Hi Jeroen, I use two libraries a lot of the time when I'm testing: http://pypi.python.org/pypi/testfixtures http://pypi.python.org/pypi/mock However, I only use these in testing and don't really want them deployed for bin/django, only for bin/test. How would I go about doing this? cheers, Chris -- Simplistix - Content Management, Batch Processing & Python Consulting - http://www.simplistix.co.uk --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
serialization formats?
Hi All, Where can I find docs on the actual serialisation formats used by Django's serialisation support? http://docs.djangoproject.com/en/dev/topics/serialization/#id1 ...lists them, but doesn't actually describe them :-S cheers, Chris -- Simplistix - Content Management, Batch Processing & Python Consulting - http://www.simplistix.co.uk --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
equivalent of getattr in a django template
Hi All, I have this view function: def index(request,model,pk=None): return list_detail.object_list( request, queryset=model.objects.all(), paginate_by=10, template_name='index.html', extra_context=dict( column_titles = [f.name for f in model._meta.fields], ) ) Where index.html is: {% for title in column_titles %} {{title}} {% endfor %} {% for object in object_list %} {% for name in column_titles %} {{*what goes here*}} {% endfor %} {% endfor %} What do I put in the marked spot to be the equivalent of getattr(object,name)? cheers, Chris -- Simplistix - Content Management, Batch Processing & Python Consulting - http://www.simplistix.co.uk --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: equivalent of getattr in a django template
Maksymus007 wrote: > {{object.name}} ? no, that is the equivalent of: getattr(object,'name') I want: getattr(object,name) Subtle, but rather important, difference... Chris -- Simplistix - Content Management, Batch Processing & Python Consulting - http://www.simplistix.co.uk --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: equivalent of getattr in a django template
Daniel Roseman wrote: > It's an intentional limitation of the template language that you can't > do that. You'll need to write a custom tag or filter - luckily it can > be done very trivially as a filter: > > @register.filter > def get_attr(obj, val) > return getattr(obj, val) > > Now in the template: > > {{ object|getattr:name }} I agree that it doesn't belong in the template language, but it's surprising that there's no standard filter to do this... Is there an open issue for this or should I raise one? Chris -- Simplistix - Content Management, Batch Processing & Python Consulting - http://www.simplistix.co.uk --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
re-using field definitions
Hi All, I tried this: from django.db import models signins = models.IntegerField( default=0, db_index=True, verbose_name='Total Signins' ) class User(models.Model): name = models.CharField( max_length=50, primary_key=True, verbose_name='Username' ) signins = signins class Month(models.Model): user = models.ForeignKey(User) monthname = models.CharField( max_length=14, db_index=True, verbose_name='Month' ) signins = signins ...but the effect was to randomise the order of the fields in the admin interface :-( How should I re-use field definitions so I'm not violating DRY but also such that field ordering stays consistent? cheers, Chris -- Simplistix - Content Management, Batch Processing & Python Consulting - http://www.simplistix.co.uk --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
is this a sane way to show total number of objects in pagination?
Hi All, I have the following in a view: objects = model.objects.all() paginator = Paginator(objects,10) return render_to_response( 'index.html',dict( objects = paginator.page(page), total_objects = len(objects), ) ) Is that the best way to get the total number of objects returned or is there a way I can do that which means the database does as little work as possible? cheers, Chris -- Simplistix - Content Management, Batch Processing & Python Consulting - http://www.simplistix.co.uk --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: is this a sane way to show total number of objects in pagination?
Chris Withers wrote: > objects = model.objects.all() > paginator = Paginator(objects,10) > return render_to_response( > 'index.html',dict( > objects = paginator.page(page), > total_objects = len(objects), > ) > ) I'm guessing the correct answer is not to pass total_objects at all but just to use {{objects.paginator.count}} in my template? cheers, Chris -- Simplistix - Content Management, Batch Processing & Python Consulting - http://www.simplistix.co.uk --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: is this a sane way to show total number of objects in pagination?
Brian McKeever wrote: > .count is definitely the way to go. Although, I would probably pass it > to your template instead of determining it there. What difference does it make? Chris -- Simplistix - Content Management, Batch Processing & Python Consulting - http://www.simplistix.co.uk --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: re-using field definitions
Ethan Jucovy wrote: > What happens if you wrap the definition in a function? > {{{ > def signins(): return models.IntegerField(...) > > class User(models.Model): > name = models.IntegerField(...) > signins = signins() > }}} Yeah, this is sort of what I ended up with: from django.db import models from functools import partial signins = partial(models.IntegerField, default=0, db_index=True, verbose_name='Total Signins' ) class User(models.Model): name = models.CharField( max_length=50, primary_key=True, verbose_name='Username' ) signins = signins() class Month(models.Model): user = models.ForeignKey(User) monthname = models.CharField( max_length=14, db_index=True, verbose_name='Month' ) signins = signins() Partials rock :-) (I could also set all the common bits in the partial and only have the bits that are different in the field definition - DRY to the max :-P) Chris -- Simplistix - Content Management, Batch Processing & Python Consulting - http://www.simplistix.co.uk --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: is this a sane way to show total number of objects in pagination?
Jani Tiainen wrote: > Chris Withers kirjoitti: >> Brian McKeever wrote: >>> .count is definitely the way to go. Although, I would probably pass it >>> to your template instead of determining it there. >> What difference does it make? > > len(qs) evaluates queryset - thus pulling in _every_ object from DB to > Python - which you might not want specially if queryset is large. > > .count() executes count query on DB side returing only single scalar > value to Python. > > Figure out which one is faster... Er, I was asking what the difference was between calling .count in the view and in the template. I can't think why it would make a difference, but Brian suggested it did... Chris -- Simplistix - Content Management, Batch Processing & Python Consulting - http://www.simplistix.co.uk --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Is Django thread safe?
Pythoni wrote: > Is Django thread safe?If so, from which version? > Thanks for reply The answer is most likely "no, but it doesn't matter". Why are you asking? Chris -- Simplistix - Content Management, Batch Processing & Python Consulting - http://www.simplistix.co.uk --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: developing and deploying django with zc.buildout
andreas schmid wrote: > then i wanted to try my apps which i have on my subversion repository > and i added a [site-packages] section to the buildout.cfg using Why not turn your apps into python packages and serve them from a private egg server? > to the [django] section. now i have my project in my buildout directory > under parts/site-packages/myapp > > if i add the app to the projects INSTALLED_APPS and run ./bin/django > syncdb it doesnt create my apps tables but it gives no error. if i run > ./bin/django shell i can import my apps module... so... where is the error? > > can anyone help me to understand why this doesnt work? what am i missing? I'd suggest inserting print statements or some such in your app code's __init__.py to see if it's being imported. Also have a look through the contents of the bin/django script to see if your code is really ending up on the python path. cheers, Chris -- Simplistix - Content Management, Batch Processing & Python Consulting - http://www.simplistix.co.uk --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Is Django thread safe?
Torsten Bronger wrote: >> Why are you asking? > > Can it be safely used with Apache's Worker MPM? I guess that would depend on a lot of things, not least of all whether you use mod_python or mod_wsgi to deploy. Certainly if it's the latter, you're likely to get better help on the mod_wsgi list: http://googlegroups.com/group/modwsgi Chris -- Simplistix - Content Management, Batch Processing & Python Consulting - http://www.simplistix.co.uk --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
bulk import limits?
Hi All, I need to import data from a legacy app (non-relational database). I was planning to do an xml dump from the old app (which is now done and working) but turns out that the app has rather more data in it than I realised ;-) I need to import about 40 million rows into one table. I take it I'll need to chunk the data up into reasonable-sized xml files. My questions is: what limits the size of the xml file that can be imported with djangoadmin's loaddata command? What would people recommend as a maximum size of xml file to use with this command? cheers, Chris -- Simplistix - Content Management, Batch Processing & Python Consulting - http://www.simplistix.co.uk --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
efficiently deleting content based on how old it is
Hi All, I have a set of models structured roughly as follows: class Month(models.Model): monthname = models.CharField( max_length=14, db_index=True, verbose_name='Month' ) ... class Service(models.Model): month = models.ForeignKey(Month) service = models.CharField( max_length=255, db_index=True, ) ... class Page(models.Model): service = models.ForeignKey(Service) ... I only want to keep 6 months worth of data. How can I efficiently delete a month and all it's associated services and those services associated pages? (in this app, there could be about 3 million pages that are associated with each month though a bunch of service objects) cheers, Chris -- Simplistix - Content Management, Batch Processing & Python Consulting - http://www.simplistix.co.uk --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: iphone to website
grant neale wrote: > Does anyone have a hint on where I should start, re: making the > website ready to receive this information? Doesn't the iPhone have a web browser? Chris -- Simplistix - Content Management, Batch Processing & Python Consulting - http://www.simplistix.co.uk --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: efficiently deleting content based on how old it is
Tim Chase wrote: > I wouldn't try to do it from within the web app itself -- > I'd schedule some wee-hours cron job to do the deletion. I plan to, don't worry ;-) But, I would like to do it from within the Django environment to make it immune to changes of database... > 6mo boundary. Your Month is defined as a string, and I > don't see any actual date information in it. Yeah, an unfortunate artifact of the legacy system I'm replacing. Months are of the form "September 2009", "August 2009", etc. How would you represent those in a Django ORM sensible way? > In all, I'd just skip Django completely and do something > like create a quick shell-script to execute the raw SQL and > schedule it to run monthly You guessed right about the database, but that's a luxury I don't have. The database used may change, so I'd like to do this through the Django ORM. Does the Django ORM have a sql abstraction layer like sqlalchemy where I can do the kind of thing you're proposing, or do I need to work with models? cheers, Chris -- Simplistix - Content Management, Batch Processing & Python Consulting - http://www.simplistix.co.uk --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
problems subclassing models
Hi All, I have a set of models that all have the same implementation for a method, so I thought I'd create a base class for these: class UrlModel(models.Model): def get_absolute_url(self): return reverse(index,kwargs=dict(fk=self.pk)) ...and then have the relevant models subclass that. However, as soon as I did this, I started getting bizarre SQL errors, things like: ProgrammingError at /some/path relation "myapp_urlmodel" does not exist LINE 1: ...somefield1"."somefield2" FROM "myapp_modelname" INNER JOIN "myapp_urlm... Why is this? Chris -- Simplistix - Content Management, Batch Processing & Python Consulting - http://www.simplistix.co.uk --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Templating wart
Hi All, I have a piece of template that looks like this: > >{% for cell in row %} > >{% if forloop.first and row.url %}{% endif %} >{{cell}} >{% if forloop.first and row.url %}{% endif %} > >{% endfor %} > How can I structure this such that I don't have to repeat the condition? DRY and all that... 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 django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: efficiently deleting content based on how old it is
Streamweaver wrote: > You could set this up as a custom manage.py command and run a cron on > that. Gives the advantage of both initiating from outside the app and > using Django's DB abstraction layer. That's prettymuch what I was planning to do :-) > Then just iterate over the month names more than 6 back from the > current position and delete the records. I'm keen to use "real dates" as Tim suggested. Perhaps just using the 1st day in each month as the "month"? 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 django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: problems subclassing models
Daniel Roseman wrote: > If your base model doesn't contain any fields, you should probably > mark it as abstract. > http://docs.djangoproject.com/en/dev/topics/db/models/#id6 Thanks, knew there'd be some magic I needed to invoke ;-) 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 django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Templating wart
british.assassin wrote: > You could do this: > > > {% for cell in row %} > > {% if forloop.first and row.url %}{{cell}} > {% else %} > {{cell}} > {% endif %} Then you're violating DRY on {{cell}}, which of course may be a lot mroe complicated than {{cell}}... cheers, Chris -- Simplistix - Content Management, Batch Processing & Python Consulting - http://www.simplistix.co.uk --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
required fields during object instantiation
Hi All, Assuming this model: class Month(models.Model): month = models.DateField( db_index=True, verbose_name='Month' ) def __unicode__(self): return unicode(self.month.strftime('%B %Y')) Now, I could have sworn this used to throw an error if I did: m = Month() ...because I haven't supplied a required field. But it no longer seems to do so until .save() is called. Am I imagining things? This behaviour is suboptimal, here's an example why using the above model: >>> Month() Traceback (most recent call last): File "models.py", line 65, in __unicode__ return unicode(self.month.strftime('%B %Y')) AttributeError: 'NoneType' object has no attribute 'strftime' :-( Chris -- Simplistix - Content Management, Batch Processing & Python Consulting - http://www.simplistix.co.uk --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: newbie , need some help
danin wrote: > I am just learning django from last 2 weeks. while learning i get > confused in validation. Can anyone plese provide me reference to some > material so that i can read and underatand it from ther. http://lmgtfy.com/?q=django+validation How about getting and reading the Django book while you're at it? ;-) Chris -- Simplistix - Content Management, Batch Processing & Python Consulting - http://www.simplistix.co.uk --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Current Django tests fail?
Tim Chase wrote: > Is there something obvious I missed? Hi Tim, I do wonder if you might get more help with these problems on the Django developers list? cheers, Chris -- Simplistix - Content Management, Batch Processing & Python Consulting - http://www.simplistix.co.uk --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
does this get or create code ship with django?
Hi All, I have a function that looks like: def get_or_create(model,**kw): try: obj = model.objects.get(**kw) except model.DoesNotExist: obj = model(**kw) return model Does something like this ship with django? If not, should it? cheers, Chris -- Simplistix - Content Management, Batch Processing & Python Consulting - http://www.simplistix.co.uk --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
hosting from /some/url in apache
Hi All, I need to host my django project from /some/folder in my apache instance. I have the following: WSGIScriptAlias /some/folder /path/to/django.wsgi Does this now mean I have to prefix all my entries in urls.py with /some/folder? I hope not, but give that going to: http://myserver/some/folder ...gives me a 404 unless I do, I'm not hopeful. What am I doing wrong? Chris -- Simplistix - Content Management, Batch Processing & Python Consulting - http://www.simplistix.co.uk --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: hosting from /some/url in apache
Jani Tiainen wrote: >> What am I doing wrong? > > "nothing". Well, it turned out I was editing a backup copy of the apache config file :-( My bad. Once I started editing the right file, things worked as expected ;-) > And if you're using authentication in your app you must provided full > absolutely URL to login page, I've done it settings.py: > > LOGIN_URL='//login/' Surely this should respect SCRIPT_NAME just the same as everything else? Chris -- Simplistix - Content Management, Batch Processing & Python Consulting - http://www.simplistix.co.uk --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: efficiently deleting content based on how old it is
buttman wrote: > you could also do it this way: > > http://pythonblog300246943.blogspot.com/2009/09/cron-jobs-with-django-made-easy.html url whacking like that is pretty evil... Chris -- Simplistix - Content Management, Batch Processing & Python Consulting - http://www.simplistix.co.uk --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: efficiently deleting content based on how old it is
Shawn Milochik wrote: > I know this doesn't answer the hard part of your question, but here's > a simple way I delete old stuff from a database via an external script > that's run by cron: > > Item.objects.filter(date_updated__lte = datetime.now() - timedelta > (days = 30)).delete() Yep, that's prettymuch what I ended up writing. Wow, Django's ORM expressions are ugly compared to SQLAlchemy ;-) > old. As for your complicated references, assuming you don't have > cascading deletes happening automatically, you may have to do an > objects.filter(), Well, cascading deletes do happen automatically with Django, so no problem there... cheers, Chris -- Simplistix - Content Management, Batch Processing & Python Consulting - http://www.simplistix.co.uk --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: efficiently deleting content based on how old it is
Peter Bengtsson wrote: >> Yep, that's prettymuch what I ended up writing. Wow, Django's ORM >> expressions are ugly compared to SQLAlchemy ;-) >> > Then just > import sqlalchemy Yes, because that obviously provides a drop-in replacement for all users of Django's ORM ;-) > If the db is a legacy database and things are stored as varchars then > I don't see any point in changing the database so you can use proper > datetimes. > And if it's indexed searching for something like 'April 2009' is going > to be uber fast. The legacy database was ZODB, which was the problem. The data took up about 14GB on disk in ZODB. About 1GB in Postgres Chris -- Simplistix - Content Management, Batch Processing & Python Consulting - http://www.simplistix.co.uk --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Remote developer opportunity
Kenneth Gonsalves wrote: > On Monday 02 Nov 2009 1:17:01 pm Kashif Azeem wrote: >> I am interested. If you can write a little bit about yourself, type of >> work, how to apply? > > please take this offlist It was probably a mistake. Google groups is pretty annoying in the way it sets the Reply-To header to the list address... Chris -- Simplistix - Content Management, Batch Processing & Python Consulting - http://www.simplistix.co.uk --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
why deliver .csv when you want to be delivering .xls?
James Bennett wrote: > On Tue, Nov 3, 2009 at 1:17 AM, Low Kian Seong wrote: >> There is a query page where the start_date and end_date is being sent. >> Then the do_defender_advanced will process it and generate an Excel >> using the template. > > One other thing is that the Django template system isn't really > optimized for presenting huge data sets like this; since you seem to > want an Excel spreadsheet, consider using Python's 'csv' module to > generate the data as a CSV file (which Excel can open as a > spreadsheet). ...or you could just use xlwt and deliver the real deal ;-) http://www.python-excel.org/ That said, I'd be surprised if the templating is the problem here, it'll be the interaction with the database that's taking the time... Chris -- Simplistix - Content Management, Batch Processing & Python Consulting - http://www.simplistix.co.uk --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
where can I find good unit test examples?
Hi All, Where can I find good examples of django unit tests? I currently just want to test my models and some helper functions, but they will do a .save() on a bunch of model instances. Any help gratefully recieved! 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-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
more complex queries
Hi All, I have a Transaction model with a DecimalField called "amount" and a CharField called "action". How do I sum all the transactions, multipling the amount by -1 when the action is REFUND? cheers, Chris -- Simplistix - Content Management, Batch Processing & Python Consulting - http://www.simplistix.co.uk -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: more complex queries
John M wrote: Sounds like two queries to me, sum all the refunds and then subtract them from all the non-refund amounts. does that work for ya? Not really, that requires two queries. I know this can be done in one query in SQL, just wondering how to express that in Django ORM speak... Chris -- Simplistix - Content Management, Batch Processing & Python Consulting - http://www.simplistix.co.uk -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
filtering by related object causes query to grind to a halt
Hi All, I have the following models: class Event(models.Model): name = models.CharField(max_length=100) price = models.DecimalField(max_digits=4,decimal_places=2) class Ticket(models.Model): number = models.IntegerField(db_index=True) event = models.ForeignKey(Event) class TicketStatus(models.Model): ticket = models.ForeignKey(Ticket) transaction = models.ForeignKey(Transaction,related_name='actions') timestamp = models.DateTimeField() owner = models.ForeignKey(User) status = models.CharField(max_length=max_len(STATUSES),choices=STATUSES) active = models.BooleanField() I'm trying to build a drop-down filtered list of tickets, showing their current status. The dropdowns allow filtering by owner and by event. Here's my code: @login_required def tickets(request): events = Event.objects.all() event = Event.objects.get(id=request.GET.get('event',events[0].id)) if request.user.is_staff: user_id = request.GET.get('user',request.user.id) users = User.objects.all() else: user_id = request.user.id users = [user] queryset = TicketStatus.objects.filter(active=True) if user_id: queryset = queryset.filter(owner=User.objects.get(id=user_id)) queryset = queryset.filter(ticket__event=event) return list_detail.object_list( request, queryset = queryset.order_by('ticket__number').select_related('Ticket'), template_name = 'tickets_list.html', paginate_by = 50, extra_context = dict( events = events, current_event_id = event.id, users = users, current_user_id = user_id ) ) As soon as I added the: queryset = queryset.filter(ticket__event=event) ...line, evaluating the queryset grinds to a halt. Why is that? How can I make it fast? cheers, Chris -- Simplistix - Content Management, Batch Processing & Python Consulting - http://www.simplistix.co.uk -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: filtering by related object causes query to grind to a halt
Okay, so I noticed that it's the following code, and it's only when I filter on user *end* event: Chris Withers wrote: queryset = TicketStatus.objects.filter(active=True) if user_id: queryset = queryset.filter(owner=User.objects.get(id=user_id)) queryset = queryset.filter(ticket__event=event) return list_detail.object_list( request, queryset = queryset.order_by('ticket__number').select_related('Ticket'), template_name = 'tickets_list.html', paginate_by = 50, extra_context = dict( events = events, current_event_id = event.id, users = users, current_user_id = user_id ) ) Here I added: from django.db import connection for query in connection.queries: print query['sql'] print query['time'] print And it shows the culprit: SELECT COUNT(*) FROM "tracker_ticketstatus" INNER JOIN "tracker_ticket" ON ("tracker_ticketstatus"."ticket_id" = "tracker_ticket"."id") WHERE ("tracker_ticketstatus"."active" = True AND "tracker_ticketstatus"."owner_id" = 1 AND "tracker_ticket"."event_id" = 3 ) 38.143 Why is this select being executed? Well, how can I find out what code is causing it? Also, why is it so slow? cheers, Chris -- Simplistix - Content Management, Batch Processing & Python Consulting - http://www.simplistix.co.uk -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: slow filtering by related and local fields, only on sqlite, not on postgres?
Chris Withers wrote: queryset = TicketStatus.objects.filter(active=True) if user_id: queryset = queryset.filter(owner=User.objects.get(id=user_id)) queryset = queryset.filter(ticket__event=event) return list_detail.object_list( request, queryset = queryset.order_by('ticket__number').select_related('Ticket'), template_name = 'tickets_list.html', paginate_by = 50, extra_context = dict( events = events, current_event_id = event.id, users = users, current_user_id = user_id ) ) And it shows the culprit: SELECT COUNT(*) FROM "tracker_ticketstatus" INNER JOIN "tracker_ticket" ON ("tracker_ticketstatus"."ticket_id" = "tracker_ticket"."id") WHERE ("tracker_ticketstatus"."active" = True AND "tracker_ticketstatus"."owner_id" = 1 AND "tracker_ticket"."event_id" = 3 ) 38.143 However, when I have exactly the same models on a postgres backend, everything is fine. So, it's just slow on a sqlite backend, which is a shame as that's how I normally develop! Any ideas? Chris -- Simplistix - Content Management, Batch Processing & Python Consulting - http://www.simplistix.co.uk -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
moving from Postgres to MySQL
Hi All, I have an existing Django app with lots of data in it. For reasons beyond my control, this app needs to move from Postgres to MySQL. What's the best way of going doing this? cheers, Chris -- Simplistix - Content Management, Batch Processing & Python Consulting - http://www.simplistix.co.uk -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
HTTP load testing tools?
Hey all, I hope this is still on topic, but what tool sets do people around here use for doing load testing of Django projects? cheers, Chris -- Simplistix - Content Management, Batch Processing & Python Consulting - http://www.simplistix.co.uk -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: HTTP load testing tools?
On 13/10/2010 09:17, Chris Withers wrote: I hope this is still on topic, but what tool sets do people around here use for doing load testing of Django projects? Thanks for the answers... ...now to ask the question in a different way again ;-) Anyone recommend any load testing services, consultancies, etc? This sounds like the kind of thing that could/should be done in the cloud... Chris -- Simplistix - Content Management, Batch Processing & Python Consulting - http://www.simplistix.co.uk -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: moving from Postgres to MySQL
On 11/10/2010 14:03, Shawn Milochik wrote: One way would be to use the dumpdata command to export everything, change your settings to point to the new database, then loaddata to restore. Okay, so I'm using buildout and djangorecipe for my deployment. On the postgres-backed server, I did: bin/django dumpdata > logs.json This took about 20 minutes and gave me a 132Mb file. On the mysql-backed server, I did: bin/django syncdb (and said no to creating a new user) bin/django loaddata logs.json This blew up fairly quickly with: Installing json fixture 'logs' from absolute path. Problem installing fixture 'logs.json': Traceback (most recent call last): File "django/django/core/management/commands/loaddata.py", line 150, in handle for obj in objects: File "django/django/core/serializers/json.py", line 41, in Deserializer for obj in PythonDeserializer(simplejson.load(stream)): File "django/django/core/serializers/python.py", line 101, in Deserializer data[field.name] = field.to_python(field_value) File "django/django/db/models/fields/__init__.py", line 565, in to_python _('Enter a valid date/time in -MM-DD HH:MM[:ss[.uu]] format.')) ValidationError: Enter a valid date/time in -MM-DD HH:MM[:ss[.uu]] format. ...which is a little odd, given that the file was created by 'dumpdata'. Any ideas? I'm on Django 1.1... Chris -- Simplistix - Content Management, Batch Processing & Python Consulting - http://www.simplistix.co.uk -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: moving from Postgres to MySQL
On 21/10/2010 14:06, Jeff Green wrote: When I was using loaddata I found out that if I did not have a True or False value for any boolean fields, I would have an issue loading the data. Once, I set the value for any records to True or False I was successfully able to use loaddata. Hope that helps What does this have to do with datetimes? How would I do this on a 200Mb text file? Anyone know how to get loaddata to be a bit more explicit about where the failure was? cheers, Chris -- Simplistix - Content Management, Batch Processing & Python Consulting - http://www.simplistix.co.uk -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: moving from Postgres to MySQL
On 21/10/2010 14:48, David De La Harpe Golden wrote: On 21/10/10 13:31, Chris Withers wrote: ...which is a little odd, given that the file was created by 'dumpdata'. Any ideas? Do you see any genuine wierdness in the format of any stringified datetimes in the dumped json? Yes I know you've got 132 megs, but I don't mean check totally manually, just do something like (untested): ...bt, why would dumpdata dump out something invalid? I'm on Django 1.1... Perhaps you could try a different approach: using django 1.2's multiple database connections to do a live-live transfer, What does one of these look like? Is this going to involve me writing loads of for-loop-ish code or is there some sane tool? Chris -- Simplistix - Content Management, Batch Processing & Python Consulting - http://www.simplistix.co.uk -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: moving from Postgres to MySQL
On 21/10/2010 15:40, ringemup wrote: MySQL has a tool (mysqldump) that will output the contents of an entire database to a SQL file that can then be loaded directly into another database. Does Postgres not have anything analogous? Sure, pg_dumpall. Now, what're the chances of the SQL that spits out being parsed correctly by MySQL without complaint? ;-) Chris -- Simplistix - Content Management, Batch Processing & Python Consulting - http://www.simplistix.co.uk -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
{% url admin:index %} generating wrong urls
Hi All, My django site is served up with the following in Apache's config: WSGIScriptAlias /studio /django/studio/bin/django.wsgi My urls.py looks like: urlpatterns += patterns( 'django.contrib', (r'^admin/', include(admin.site.urls)), (r'^accounts/login/$', 'auth.views.login'), (r'^accounts/logout/$', 'auth.views.logout'), ) ...and yet: [admin] ...generates a link to /admin rather than /studio/admin. Bizarrely, the urls within the admin interface itself are fine. I'm using: Python 2.5.2-3 Django 1.1.1 mod_wsgi 2.5-1~lenny1 apache2 2.2.9-10+lenny6 Can anyone tell me what I'm doing wrong? cheers, Chris -- Simplistix - Content Management, Batch Processing & Python Consulting - http://www.simplistix.co.uk -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: {% url admin:index %} generating wrong urls
Karen Tracey wrote: > Can anyone tell me what I'm doing wrong? > > > No idea. I can't recreate by copy & pasting you urlpatterns. Tried on > Django 1.1.1 and current trunk. I've got mod_wsgi 2.3 instead of 2.5 > but I doubt that makes a difference for this -- everything else the same > level as yours. Can you recreate with a bare-bones setup? Short of firing up a blank VM, I'm not sure how much more bare bones I can get :-S Not sure if it helps but: - I'm running the whole project out of a buildout using djangorecipe 0.20 (although I did trace through the django.wsgi file and all the work is still done by django.core.handlers.wsgi.WSGIHandler - A workaround which solves the problem for me is to precede the WSGIScriptAlias in the apache config with: RewriteRule ^/studio$ /studio/ [R] cheers, Chris PS: I never got my original message mailed back to me from the list, was I stuck in the google groups moderation queue? -- Simplistix - Content Management, Batch Processing & Python Consulting - http://www.simplistix.co.uk -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: {% url admin:index %} generating wrong urls
Graham Dumpleton wrote: > > As I told you when you tried to use private email to get me to help on > this, Apologies for that, I was actually trying to use Google's web UI to reply to that thread in context. Their UI obvious sucks more than I realised as it just sent a private mail to you :-( >> - I'm running the whole project out of a buildout using djangorecipe >> 0.20 (although I did trace through the django.wsgi file and all the work >> is still done by django.core.handlers.wsgi.WSGIHandler > > Yes, but what exactly does the WSGI script file contain in regard to > the 'application' object. For Django it normally would be: > > import django.core.handlers.wsgi > application = django.core.handlers.wsgi.WSGIHandler() Yup, djangorecipe's script sets application to an instance of django.core.handlers.wsgi.WSGIHandler(), not a subclass and with no apparent buggering around with the environment. > If that buildout recipe is doing anything else fancy in it and is > modifying the WSGI environment, especially the values of SCRIPT_NAME > and PATH_INFO, then it could be stuffing it all up. Nope, can't see any evidence of this... > What you should do is disable that rewrite rule and then enable Apache > rewrite rule logging to see what other rewrites are occurring in case > there is something else which is playing with the URL which shouldn't > be. Once the controversial rewrite rule is disabled and I have rewrite logging enabled, I get straight pass through when I visit any of: /studio /studio/ /studio/subdir > The best first step though on working this out though is that test > program you were pointed to in the documentation. Use it instead of > Django and then post examples of the WSGI environment for requests: > > /studio > /studio/ > /studio/subdir > > Ensuring you don't have that rewrite rule in place. Okay, so I put the debugging app you linked to in test.py and now have: WSGIScriptAlias /studio /django/studio/bin/django.wsgi WSGIScriptAlias /test /django/test.py I also added a {{request}} to the base.html of the django app. Here's the output of the request's SCRIPT_NAME for various urls: /studio - u'' /studio/ - u'/studio' /test - '/test' /test/- '/test/' > Also post all mod_wsgi relevant bits of your Apache configuration so > can see what else you have in there. If you had for example other > configuration, especially WSGIScriptAliasMatch or ScriptAliasMatch > directives that also match, then they could be getting applied and > causing issues if the way you used those directives is wrong, as they > can have side affects of modifying SCRIPT_NAME and PATH_INFO and the > relationships between them. Other than the above two WSGIScriptAlias directives, there are no mod_wsgi directives or ScriptAlias*'s... How can I step through execution from the django.wsgi file and see where I get to? I'm guessing putting an "import pdb; pdb.set_trace()" in the django.wsgi file won't do what I want? cheers, Chris -- Simplistix - Content Management, Batch Processing & Python Consulting - http://www.simplistix.co.uk -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: {% url admin:index %} generating wrong urls
Graham Dumpleton wrote: > >> How can I step through execution from the django.wsgi file and see where >> I get to? I'm guessing putting an "import pdb; pdb.set_trace()" in the >> django.wsgi file won't do what I want? > > Sort of, but you have to run Apache in single process mode. See > further down in same document on debugging. > > > http://code.google.com/p/modwsgi/wiki/DebuggingTechniques#Python_Interactive_Debugger If anyone can tell me how to do "httpd -X" on a debian or ubuntu host I'd be very grateful... Chris -- Simplistix - Content Management, Batch Processing & Python Consulting - http://www.simplistix.co.uk -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
running "httpd -X" on debian/ubuntu
Chris Withers wrote: > Graham Dumpleton wrote: >>> How can I step through execution from the django.wsgi file and see where >>> I get to? I'm guessing putting an "import pdb; pdb.set_trace()" in the >>> django.wsgi file won't do what I want? >> Sort of, but you have to run Apache in single process mode. See >> further down in same document on debugging. >> >> >> http://code.google.com/p/modwsgi/wiki/DebuggingTechniques#Python_Interactive_Debugger > > If anyone can tell me how to do "httpd -X" on a debian or ubuntu host > I'd be very grateful... In case anyone else needs it: apache2ctl -X *sigh* -> why must the debian guys bugger up everything in their distros?! Chris -- Simplistix - Content Management, Batch Processing & Python Consulting - http://www.simplistix.co.uk -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: {% url admin:index %} generating wrong urls
Karen Tracey wrote: > On Sat, Dec 26, 2009 at 5:32 PM, Chris Withers <mailto:ch...@simplistix.co.uk>> wrote: > > > If anyone can tell me how to do "httpd -X" on a debian or ubuntu host > I'd be very grateful... > > > /usr/sbin/apache2 -X For me that gave: # /usr/sbin/apache2 -X apache2: bad user name ${APACHE_RUN_USER} However, as I said in my other thread, what did work for me was: apache2ctl -X cheers, Chris -- Simplistix - Content Management, Batch Processing & Python Consulting - http://www.simplistix.co.uk -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: {% url admin:index %} generating wrong urls
Graham Dumpleton wrote: > >> I also added a {{request}} to the base.html of the django >> app. Here's the output of the request's SCRIPT_NAME for various urls: >> >> /studio - u'' >> /studio/ - u'/studio' >> /test - '/test' >> /test/- '/test/' > > Hmmm, that would suggest that it is Django that is changing it for > some reason. I believe it's a bug in Django: http://code.djangoproject.com/browser/django/tags/releases/1.1.1/django/core/handlers/base.py#L204 Sadly, still there on the branch and trunk: http://code.djangoproject.com/browser/django/branches/releases/1.1.X/django/core/handlers/base.py#L215 http://code.djangoproject.com/browser/django/trunk/django/core/handlers/base.py#L215 The problem is when PATH_INFO is empty, as it is in the top case. Python has no notion of positive or negative zero (;-)) so we end up returning script_url[:0]... Now, I'm really curious that Karen says this works for her. Karen, can you have a look at what's different about your apache setup, as I can't see how this would ever correctly work for the "root url without the slash" case. I have to admit, I can't see why the script name would ever need to be trimmed like that. Graham, perhaps you might be able to shed some light with your greater wsgi experience? Chris -- Simplistix - Content Management, Batch Processing & Python Consulting - http://www.simplistix.co.uk -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: {% url admin:index %} generating wrong urls
Karen Tracey wrote: > In my case, environ.get('SCRIPT_URL', u'') and > environ.get('REDIRECT_URL', u'') both return empty. I wonder what SCRIPT_URL is and why it's empty for you but not for me? I wonder if SCRIPT_URL having a value is something that came along with a later version of mod_wsgi? Could you trying using the debian-packaged mod_wsgi (whih is version 2.5.x) and see if that changes the behaviour you observe? > Since rewrites were mentioned earlier perhaps it's significant that this > Apache setup doesn't have mod_rewrite enabled. I don't think so, I've checked with the rewrite engine's logging and all the urls in question are being passed straight through. Chris -- Simplistix - Content Management, Batch Processing & Python Consulting - http://www.simplistix.co.uk -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Is it ok to use double quotes instead of single quotes in Field.choices?
Continuation wrote: > Now if I change the single quotes to double quotes, it seems to work: > (1, "I'm looking for..."), Double quotes are absolutely fine and a lot nicer to look at than 'I\'m hard to read'. cheers, Chris -- Simplistix - Content Management, Batch Processing & Python Consulting - http://www.simplistix.co.uk -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: local variable 'delta' referenced before assignment
neridaj wrote: > I don't see why this error is happening, the var is assigned. > > def moderate_comment(sender, **kwargs): > instance = kwargs['instance'] > if not instance.id: > content = instance.content_object > if isinstance(content, Tweet): > delta = datetime.datetime.now() - content.pub_time > else: > delta = datetime.datetime.now() - content.pub_date > if delta.days > 30: #failure > > > local variable 'delta' referenced before assignment Please post a full traceback. Chris -- Simplistix - Content Management, Batch Processing & Python Consulting - http://www.simplistix.co.uk -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: {% url admin:index %} generating wrong urls
Karen Tracey wrote: > There is at least one bug open on empty PATH_INFO handling: > > http://code.djangoproject.com/ticket/9435 > > though it doesn't sound like it's focused on exactly the same issue, No, I had as thorough a look as I could and could find no issue which directly covered this issue so submitted a new one: http://code.djangoproject.com/ticket/12464 Sadly, Trac ate the indentation :-( cheers, Chris -- Simplistix - Content Management, Batch Processing & Python Consulting - http://www.simplistix.co.uk -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: local variable 'delta' referenced before assignment
neridaj wrote: > File "/Users/jasonnerida/django-apps/blog/models.py" in > moderate_comment > 142. if delta.days > 30: Okay, now the line numbered code for the whole of the moderate_comment function... Also, check you're not mixing tabs and spaces in that models.py file... Chris -- Simplistix - Content Management, Batch Processing & Python Consulting - http://www.simplistix.co.uk -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: {% url admin:index %} generating wrong urls
davathar wrote: Unfortunately adding the rewrite rule mentioned as a work around hasn't worked for me. Please post the relevant section of your Apache config (including your wsgi *and* rewrite lines), there's no reason the rewrite rule workaround shouldn't work for you... Chris -- Simplistix - Content Management, Batch Processing & Python Consulting - http://www.simplistix.co.uk -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Send and Receive SMS from a django app
Alessandro Ronchi wrote: I cannot use an SMS gateway for my app (I must use a SIM and an hardware modem). Why? This is not a sane requirement for a web app... Chris -- Simplistix - Content Management, Batch Processing & Python Consulting - http://www.simplistix.co.uk -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Send and Receive SMS from a django app
Alessandro Ronchi wrote: Because of the number of the SMS I must write. I need a web app that makes intense use of SMS without any external dependences (like Unicef app). If you want to send a *lot* of sms'es then you definitely want to be using a gatway sending service rather than trying to rack up a load of cell phones and writing to them... Chris -- Simplistix - Content Management, Batch Processing & Python Consulting - http://www.simplistix.co.uk -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.