Re: [Tutor] Encoding question

2009-09-09 Thread Kent Johnson
On Wed, Sep 9, 2009 at 5:06 AM, Oleg Oltar wrote: > Hi! > > One of my tests returned following text () > > The test: > from django.test.client import Client >  c = Client() > resp = c.get("/") > resp.content > > In [25]: resp.content > Out[25]: '\r\n\r\n\r\n Strict//EN" > "http://www.w3.org/TR/xh

Re: Using Django with appengine - Port of the django tutorial for appengine

2008-04-10 Thread Kent Johnson
shabda wrote: > I have tried to write a Django tutorial for Appengine. > A live install of this can be seen at http://blogango.appspot.com I get a 403 Forbidden when I try to vote... Kent --~--~-~--~~~---~--~~ You received this message because you are subscribe

Re: Anybody successfully deployed Django to appengine? Having some problems

2008-04-08 Thread Kent Johnson
shabda wrote: > I am trying to follow http://code.google.com/appengine/articles/django.html > > Which has a line > # Log errors. > django.dispatch.dispatcher.connect( >log_exception, django.core.signals.got_request_exception) > > but log_exception is not defined/imported, so it gives a NameE

Re: Is it necessary to impliment tearDown to clean up database when using django.test.TestCase?

2008-03-09 Thread Kent Johnson
meppum wrote: > I've been doing something like the following: > > MODELS = [SomeObjectType, AnotherObjectType] > > class testFoo(TestCase): > > def tearDown(self): > for model in MODELS: > model.objecs.all().delete() > > Is this how tests should be created, or is all this done

Re: Recovering from Postgres errors

2008-03-05 Thread Kent Johnson
A simpler question - is there any reason *not* to include this code in my model's save() method? try: Model.save(self) except DatabaseError: transaction.rollback_unless_managed() raise The benefits: - automatic recovery from failed unmanaged transactions - very handy when working

Recovering from Postgres errors

2008-03-04 Thread Kent Johnson
When accessing a Postgres database from Django ORM without any explicit transaction management, any database query begins an implicit transaction which ends with the next save(). If the save fails due to a database error (e.g. integrity violation, timeout...) it raises an exception. At this po

Re: Negation in queries

2007-12-13 Thread Kent Johnson
Jan Rademaker wrote: > There is an undocumented class called QNot which resides in > django.db.models.query. That is just what I was looking for. Thanks! Kent --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Djan

Re: Negation in queries

2007-12-13 Thread Kent Johnson
Doug B wrote: > I think you want filter's evil twin exclude: I know about exclude() but I don't see how to use it here. I want s1==1 OR s2!=1, so for example records (s1=1, s2=1) and (s1=2, s2=2) would be accepted. filter(s1=1).exclude(s2=1) is s1==1 AND s2!=1; it will not retrieve either of

Negation in queries

2007-12-13 Thread Kent Johnson
Is there a way to express != in a database query? Suppose I have a field 'status' that can take the values 1, 2 or 3. If I want to select status!=2 I can use exclude(status=2). But for more complicated conditions this is harder to do. What if I have two status fields, s1, s2 and I want to sele

How to add to DjangoResources?

2007-12-06 Thread Kent Johnson
I am trying to add an app to http://code.djangoproject.com/wiki/DjangoResources but when I submit I get 500 Internal Server Error (Submission rejected as potential spam) How can I get this to work? I am trying to add this to the "Django application components" section: * [http://blogcosm.com

ANN: Blogmaker blogging application

2007-12-06 Thread Kent Johnson
PreFab Software has released Blogmaker (tm), a full-featured, production-quality blogging application for Django. It supports trackbacks, ping and comments with moderation and honeypot spam prevention. Blogmaker is free, open-source software licensed under a BSD license. Blogmaker powers the

Re: Combating submission form Spam

2007-12-06 Thread Kent Johnson
Ned Batchelder wrote: > I have been hoping, but not managing, to find the time to create a > Django implementation of my anti-spam technique: Stopping Spambots with > hashes and honeypots (http://nedbatchelder.com/text/stopbots.html). It > works very effectively without any extra work on the

Re: Painful deployment | shared hosting | Need your advice

2007-10-21 Thread Kent Johnson
Kenneth Gonsalves wrote: > > On 20-Oct-07, at 3:07 PM, Justin Lilly wrote: > >> I believe the answer will be no. The main reason being #3 as I >> think most other obstacles can be overcome. I would suggest >> webfaction as an alternative (from word of mouth, not personal >> experience). >

Re: Newbie Question - How do I get my burger and fries from BK and not Mickey D's?

2007-06-24 Thread Kent Johnson
Wiley wrote: > Dirk, > > Thanks for your comment! I simplified my use case for the sake of > clarity, but in my actual application it does make sense to have > Dishes and Restaurants to be many-to-many. Does anyone have any > insight as to my original question? Can the choices of dish be > nar

Re: Graphs and django

2007-06-21 Thread Kent Johnson
Martin Winkler wrote: > If you want do do really nice graphs, you might take a look at some > screenshots of matplotlib: > http://matplotlib.sourceforge.net/screenshots.html > > The module is quite large, but has really many functions: from simple > pie charts (3D too) up to finance charts which

Re: Django DbMigration 0.03 released

2007-06-10 Thread Kent Johnson
Mike H wrote: > Hi all, > > We've just released an update to the django dbmigration project. This > release cleans up the code a little and improves the parsing of SQL > migrations. > > Homepage and downloads at: > http://www.aswmc.com/dbmigration/ The download link is not working (404). Ken

Re: Model Method Regular Expressions

2007-06-09 Thread Kent Johnson
hass wrote: > I'm trying to set up a model with a field that swallows a healthy > dollop of html, such as a youtube embed code. > > But then, I want to use regular expressions to strip that code into > pieces that I can access independently. My first thought is that some > regular expression kun

Re: Search tables related by a foreign key in admin

2007-05-16 Thread Kent Johnson
RajeshD wrote: > >> search_fields = ['question', 'choice_choice'] >> >> Where choice_choice is supposed to be pointing to the choice field in >> the choice model, but something is not working with that. I am sure >> that I am missing something very easy and I was wondering if someone >> could po

Re: First impression of django

2007-05-12 Thread Kent Johnson
James Bennett wrote: > On 5/11/07, Nic James Ferrier <[EMAIL PROTECTED]> wrote: >> Something needs to be done though... or ongoing maintenance of Django >> apps is going to be really hard. > > I haven't found it terribly hard with a little coding discipline; the > way we've handled it is to write

Re: Hacking admin changes

2007-04-04 Thread Kent Johnson
Kent Johnson wrote: > Enrico wrote: >> Can't you just override the 'save' method of your model? > > Maybe I can. I think I once had a reason not to do that but I can't > remember it :-) Yes, this is fine, thanks for nu

Re: Hacking admin changes

2007-04-04 Thread Kent Johnson
Aidas Bendoraitis wrote: > I would have written a request_middleware instead of what you did. I > think, it would be cleaner. The middleware would have to inspect each request to find the ones it actually cares about. It seemed cleaner to me to use the url dispatch to do this for me. Thanks, K

Re: Hacking admin changes

2007-04-04 Thread Kent Johnson
Enrico wrote: > Can't you just override the 'save' method of your model? Maybe I can. I think I once had a reason not to do that but I can't remember it :-) Thanks, Kent --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Gr

Hacking admin changes

2007-04-04 Thread Kent Johnson
In my application I want to intercept changes made through the admin interface so I can make additional changes based on the changes made by the user. In other words, if the request has a new value for attribute 'foo', I want to compute a new value for attribute 'bar' and add that to the request.