Weird inconsistencies for same queryset in different Django instances

2010-05-11 Thread Malcolm Box
Hi, I've run into a weird bug that has me scratching my head - I'm seeing inconsistent results from a queryset between various apache processes and the django shell. I.e. sometimes a GET gives me the right response (as it hits a "correct" Apache instance) and other times it gives a wrong response

Re: Weird inconsistencies for same queryset in different Django instances

2010-05-11 Thread Malcolm Box
On Tue, May 11, 2010 at 8:27 PM, Daniel Roseman wrote: > On May 11, 7:08 pm, Malcolm Box wrote: > > Hi, > > > > I've run into a weird bug that has me scratching my head - I'm seeing > > inconsistent results from a queryset between various apache pro

Django performance on Amazon EC2

2010-01-12 Thread Malcolm Box
Hi, I'm using Django on Amazon EC2 and seeing what I think are very low throughputs ( < 15requests/s) for relatively simple pages. Before I start digging into the root causes of this, I wondered if anyone else was running Django on AWS and what sort of performance figures you were seeing. More d

Re: Django performance on Amazon EC2

2010-01-12 Thread Malcolm Box
On Tue, Jan 12, 2010 at 2:46 PM, Steve McConville < mcconville.st...@gmail.com> wrote: > > EC2 m1.small instance, talking to another m1.small instance hosting MySQL > db > > > > DB performance doesn't seem to be the issue - I don't see the DB server > > under any load at all. > > What sort of netw

Re: Django performance on Amazon EC2

2010-01-12 Thread Malcolm Box
On Tue, Jan 12, 2010 at 2:54 PM, Victor Loureiro Lima < victorloureirol...@gmail.com> wrote: > Hello, > > we currently have a website running on django EC2, and its running great, > really great. We managed to handle 300 requests/s on our stress tests on a > heavy page... but, we only managed to

Re: Django performance on Amazon EC2

2010-01-12 Thread Malcolm Box
On Tue, Jan 12, 2010 at 5:28 PM, Steve McConville < mcconville.st...@gmail.com> wrote: > > Yes, hosted in US-East-1, but I was running benchmark tests from another > EC2 > > instance in the same region, so reasonably sure it's not latency. > > I meant latencies internal to EC2; eg. what is your pi

PUT with the test client

2010-01-13 Thread Malcolm Box
Hi, I'm writing some tests using the Django test client for a REST API. This API uses the PUT method and I'm running into problems with the test client, as it appears to wish to URL encode the data into the query string. Code is: r = self.client.put('/json/api/endpoint', json.dumps(params), con

Re: PUT with the test client

2010-01-13 Thread Malcolm Box
On Wed, Jan 13, 2010 at 3:05 PM, Karen Tracey wrote: > On Wed, Jan 13, 2010 at 9:55 AM, Malcolm Box wrote: > >> I'm writing some tests using the Django test client for a REST API. This >> API uses the PUT method and I'm running into problems with the test client, >

Should Django handle uploaded files in PUT as well as POST?

2010-01-15 Thread Malcolm Box
Hi, I'm working on a REST-full API that allows an uploaded file to be PUT to a URL. I also need to support the X-Http-Method-Override header to turn a POST request into a PUT for clients (Flash, mobile etc) that can't do PUT. At the moment I've got the API working with POST requests, and am now

Re: OS X 10.6 Snow Leopard Setup Tutorial

2010-01-15 Thread Malcolm Box
On Fri, Jan 15, 2010 at 6:37 PM, Jonathan Eatherly < jonathan.eathe...@gmail.com> wrote: >One of these days I would like to make a DMG that sets up > everything for the user. If anyone would be interested in a DMG single > setup executable please let me know and maybe I will make it a weekend

Re: Can't connect to MySQL server

2010-01-15 Thread Malcolm Box
Hi, On Thu, Jan 14, 2010 at 10:36 AM, Hans.Rauch wrote: > Hi, > > we have two separate django- and mysql-servers. Most of the time we > got no problems. From time to time we get an email with the following > error-message: OperationalError: (2003, "Can't connect to MySQL server > on '..' (4)").

Re: Enter a valid value while saving fullname during registration

2010-01-17 Thread Malcolm Box
On Sat, Jan 16, 2010 at 7:56 PM, Praveen wrote: You seem to have forgotten to ask a question, provide an answer or start a thread of conversation. Malcolm -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to d

Re: Serving static files from subdomain.

2010-01-17 Thread Malcolm Box
On Sat, Jan 16, 2010 at 3:20 PM, nameless wrote: > I have a site developed with django at www.example.com > > I want that django insert/serve static files ( images, css, js, ect ) > in/from media.example.com. > > Are these files that Django is managing (e.g. via an upload), or just part of the ou

Re: Should Django handle uploaded files in PUT as well as POST?

2010-01-17 Thread Malcolm Box
On Sat, Jan 16, 2010 at 4:58 AM, Russell Keith-Magee wrote: > On Sat, Jan 16, 2010 at 6:32 AM, Malcolm Box > wrote: > > > It seems to me that Django should process POST and PUT requests the same > - > > i.e. the request.FILES attribute should be initialised for e

Re: Serving static files from subdomain.

2010-01-17 Thread Malcolm Box
On Mon, Jan 18, 2010 at 12:41 AM, nameless wrote: > Thank you for tips. > Now I want that when an user upload an image ( through forms ), then > it will be saved in media.example.com. > This is the point that I don't understand :-\ > > Does the computer running Django have access to a directory w

Re: Should Django handle uploaded files in PUT as well as POST?

2010-01-18 Thread Malcolm Box
On Mon, Jan 18, 2010 at 2:04 AM, Russell Keith-Magee wrote: > On Mon, Jan 18, 2010 at 8:14 AM, Malcolm Box > wrote: > > On Sat, Jan 16, 2010 at 4:58 AM, Russell Keith-Magee> Which raises the > question of what the correct behaviour should be, so the > > bug can report

Re: Should Django handle uploaded files in PUT as well as POST?

2010-01-18 Thread Malcolm Box
On Mon, Jan 18, 2010 at 9:23 AM, Masklinn wrote: > On 18 Jan 2010, at 03:04 , Russell Keith-Magee wrote: > > > > On Mon, Jan 18, 2010 at 8:14 AM, Malcolm Box > wrote: > >> On Sat, Jan 16, 2010 at 4:58 AM, Russell Keith-Magee > >> Which raises the question of

Django and caching when data is updated

2010-01-20 Thread Malcolm Box
Hi, On the quest for performance I'm now having a look at Django's caching framework. I've got a simple question that I can't find the answer to: if the data that a view depends on changes, does Django do anything smart to invalidate the cache for that view, or is it left to the programmer? If

Re: Django and caching when data is updated

2010-01-21 Thread Malcolm Box
Hi, On Thu, Jan 21, 2010 at 7:35 AM, Russell Keith-Magee wrote: > On Thu, Jan 21, 2010 at 7:47 AM, Malcolm Box > wrote: > > > > I've got a simple question that I can't find the answer to: if the data > > that a view depends on changes, does Django do anyt

Re: Templating problem: equal symbol "=" escaped to "=3D"

2010-01-21 Thread Malcolm Box
Are you sure it's django templates that are doing the escaping? =3D is the mime escaping for = - could it be something else in your email processing chain that's escaping the sign? Malcolm On 1/21/10, Enrico Sartorello wrote: > Hi, > i'm using Django template system to render some text files (not

Re: Need your expertise

2010-01-22 Thread Malcolm Box
On Fri, Jan 22, 2010 at 9:03 AM, Jigs wrote: > We are currently deciding if Django Framework will suit our needs. > > Templates and Python is a must requirement for the project. Reporting > and Monitoring modules will be created in the future. Please advise if > we are going in the right direc

Re: Should a decorator be used here or should I do something else.

2010-01-22 Thread Malcolm Box
If it's different instances of the model that should have age-restrictions applied then I would be tempted to push this down to the model layer by creating a new Manager called e.g. age_filtered and then use that in view: q = Data.age_filtered(age).filter(id=23) You could even make the default ma

Re: Templating problem: equal symbol "=" escaped to "=3D"

2010-01-22 Thread Malcolm Box
t; You're right, it's the mime escaping! >> >> In order to send emails I simply use: >> >> render_to_string(file) >> send_mail() >> >> How can I send plain text messages with '=' symbols without getting it >> escaped? >> >>

Re: get all foreign keys that point to

2010-01-22 Thread Malcolm Box
The list of all drivers in a team is (assuming self is a team instance) drivers = self.driver_set().all() Hope that helps. Malcolm On Thu, Jan 21, 2010 at 2:49 AM, Ether Joe wrote: > Hello there, quick (hopefully) question for you - how do I get a list > of records in a foreign table that p

Converting Django testclient code to run as black-box tests

2010-01-23 Thread Malcolm Box
Hi, I've got an existing unit test suite using the django.test.TestCase class that exercises the HTTP interface of the site, but running under Django's test harness. I'd like to turn this into a black-box test suite, using real HTTP to talk to the server remotely. Obviously some tests e.g. the a

Re: Converting Django testclient code to run as black-box tests

2010-01-24 Thread Malcolm Box
Hi, On Sat, Jan 23, 2010 at 11:55 AM, Russell Keith-Magee < freakboy3...@gmail.com> wrote: > On Sat, Jan 23, 2010 at 6:40 PM, Malcolm Box > wrote: > > Hi, > > > > I've got an existing unit test suite using the django.test.TestCase class > > that exer

Re: extend queryset field lookups for time

2010-01-26 Thread Malcolm Box
On Tue, Jan 26, 2010 at 9:14 AM, Henrik Genssen wrote: > how would I extend the field lookup to get somethnng like this: > > SELECT ... WHERE EXTRACT('hour' FROM pub_date) > 20 > what is for MYSQL: > SELECT ... WHERE HOUR(pub_date) > 20 > to get all entries where the timepart of pub_date is grate

Re: Problem with RSS, maybe error in programming.

2010-01-26 Thread Malcolm Box
On Mon, Jan 25, 2010 at 11:18 PM, Felipe Catojo wrote: > Hello Guys, > > I have tried to configure RSS in my blog application and when I try to > access the objects (blog entries) that would be returned by the RSS > app, the RSS app return a strange message that I don't understand: > > http://www.

Re: Cookie Tip

2010-01-26 Thread Malcolm Box
Hi, On Mon, Jan 25, 2010 at 8:00 PM, cootetom wrote: > The tip here is to add the following to your settings.py file > > SESSION_COOKIE_PATH = '/;HttpOnly' > > Useful information - however be warned this isn't a panacea. See http://www.owasp.org/index.php/HTTPOnly#Browsers_Supporting_HTTPOnly fo

Re: login failure

2010-01-26 Thread Malcolm Box
On Mon, Jan 25, 2010 at 6:16 AM, harryos wrote: > On Jan 24, 10:45 pm, Daniel Roseman wrote: > > You put them in your project's settings.py (which, through some magic, > > is imported via django.conf). You should not be editing any of the > > code inside Django itself, unless you know what you'r

Re: View doesn't return HttpResponse object

2010-01-27 Thread Malcolm Box
That code looks fine to me. I'd suggest sticking an "import pdb;pdb.set_trace()" as the first line of the view, then stepping through the code (run the server with manage.py runserver). That should quickly highlight any areas where the code flow isn't as you expect. Cheers, Malcolm On Wed, Jan

Re: View doesn't return HttpResponse object

2010-01-27 Thread Malcolm Box
On Wed, Jan 27, 2010 at 2:54 PM, Karen Tracey wrote: > On Wed, Jan 27, 2010 at 9:45 AM, Malcolm Box wrote: > >> That code looks fine to me. I'd suggest sticking an "import >> pdb;pdb.set_trace()" as the first line of the view, then stepping through >>

Re: Number of total items in the database

2010-01-27 Thread Malcolm Box
On Wed, Jan 27, 2010 at 6:10 PM, Zeynel wrote: > Hello, > > How do I query the the total number of items in the database to put in > a template? > > I want to add to this page http://swimswith.com/search/ that "There > are currently [X] lawyers in the database." > > Have a look at the count() met

Re: Reasons why syncdb ignores an application?

2010-01-27 Thread Malcolm Box
On Wed, Jan 27, 2010 at 6:54 PM, phoebebright wrote: > I cannot find the reason why syncdb will not create tables from a > models.py. > > It is quite happy to create the auth tables and ones from an external > app that is included in INSTALLED_APPS but it won't build the tables > from my 'web' fol

Making a model field have a default value

2010-01-27 Thread Malcolm Box
Hi, A question that's probably obvious but I can't quite see the best way to do it. I've got a model, call it Template, with some fields colour1, colour2 etc. What I want is that if there's a no value for the colourN field then a default value is returned when the field is read. Aha I hear you s

Re: REST & Django

2010-01-29 Thread Malcolm Box
On Fri, Jan 29, 2010 at 4:03 PM, pyleaf wrote: > how REST looks like in django? > does Django support REST defautly? > > Django can be used to develop a REST API, it implements all the HTTP methods needed and Django views can easily generate JSON, XML or whatever you require. There's not much bu

Problem with Last-modified header and Apache/mod_python

2010-02-02 Thread Malcolm Box
Hi, I'm seeing a strange problem with Last-modified headers on my Apache/mod_python install. The problem being that they don't get sent. Running my django app locally, and using 'curl -v' to see the headers, I see correctly generated 'Last-modified' headers. When I deploy the same code to a ser

Speeding the code-test-debug cycle

2010-02-02 Thread Malcolm Box
Hi, As my django application has grown I'm noticing I'm spending longer and longer waiting for ./manage.py test to start up - ie create all the tables etc. Not helped of course by working on a laptop with a slow disk, as I suspect many of us do these days. This is slowing down my test-debug cycl

Re: Speeding the code-test-debug cycle

2010-02-05 Thread Malcolm Box
Hi, Thanks for the suggestions. 2010/2/2 Phlip > Malcolm Box wrote: > > > Has anyone got any ideas on how to speed this up - for instance, is there > a > > way to say "use an existing test database"? > > Per my other advice to use fab and a fabfile with a

Re: Problem with Last-modified header and Apache/mod_python

2010-02-05 Thread Malcolm Box
Last-Modified header based on the value from the database. Equally it doesn't produce any error either. The fix is simple - run some SQL to set all the last_modified fields to a recent date. Voila, the header appears. Hope this proves useful to someone in the future. Cheers, Malcolm 2010/2

Re: update with where clause constraints?

2010-02-06 Thread Malcolm Box
2010/2/5 Jared Smith > My use case is that I'll have multiple users trying to update a set of > objects and I want to make sure that any user committing a change has > knowledge of the existing state. I was going to model that with a version > number so an update would look like: > Maybe I'm mi

Re: simple, input from user and database earch result

2010-02-17 Thread Malcolm Box
On Wed, Feb 17, 2010 at 3:12 PM, gintare wrote: > > One more simple question: > > Is it possible that area which is used for data submission also can be > updated from python script. > It's not clear what you mean by this. The python (Django) script isn't running in the webbrowser, so it can't

Re: Django with Jquery

2010-02-28 Thread Malcolm Box
On Sun, Feb 28, 2010 at 5:39 PM, Alexis Selves wrote: > Hello, > I am totally helpless. I am trying to use JQuery in my django > templates, but I always get in firebug this: $ not defined. > Check with Firebug if the jquery script has been successfully loaded (using either the CSS or Net tabs)

Re: How can I apply ordering through a M2M join model?

2010-02-28 Thread Malcolm Box
I don't know if you can do it directly using the ordering metadata - easiest way to find out is to try it and see. If not, I'd suggest a customer manager on the Gallery that returns the photos in order so that the line: Gallery.photos.all() refers to your customer manager that "does the right th

Re: ImageField admin preview not working

2010-02-28 Thread Malcolm Box
Read your settings.py file carefully: - you've said that the MEDIA_URL is / - but that Django is only configured to serve static content from /static So when the photo is uploaded, it's stored in /photos/x.jpg, which you've told Django is accessible via the URL /photos. But this gives http://exa

Re: fixtures getting created with terminal message prefixed

2010-02-28 Thread Malcolm Box
I'll take a guess: one of your apps, middleware or possibly even a management command is generating this text. Grep for it in your source code, and remove/disable. Malcolm On Sat, Feb 27, 2010 at 4:34 AM, Russell Keith-Magee wrote: > On Sat, Feb 27, 2010 at 4:07 AM, Joel Stransky > wrote: >

Re: Django REST and FILEFIELD field

2010-03-01 Thread Malcolm Box
I've got this working in the past, but only by writing custom create() methods on the Collection and Entry classes. In the custom create() method you can process the POST/PUT data directly into the FileField just like you would for a normal form Malcolm On Thu, Feb 25, 2010 at 7:03 PM, manu.poll

Re: Forcing HTTPS in admin

2010-03-01 Thread Malcolm Box
You could, but doing it on the front-end webserver makes more sense. Malcolm On Mon, Mar 1, 2010 at 3:02 PM, ozgurv wrote: > You can write a middleware that redirects users who visit admin > related pages (starts with /admin maybe) to HTTPS. > > On Mon, Mar 1, 2010 at 2:08 AM, Janusz Harkot >

Re: Specific models without a database table

2011-08-20 Thread Malcolm Box
On 20 August 2011 02:33, Kristofer Pettijohn wrote: > Hello, > > Is it possible to create specific models without a database table? > > Yes, it's possible. You want the "managed" attribute on the model - see https://docs.djangoproject.com/en/1.3/ref/models/options/#managed This will prevent Djang

Re: how to invalidate per-view cache?

2011-08-20 Thread Malcolm Box
ecords are changed. There is no info > about how to do that:/ You'll need to use the low-level cache API to invalidate the individual cache entries. Hook up a post_save handler to your model, figure out the key(s) for the views affected and use cache.delete() to remove the entry

Re: Django Test Corrupted Test Data

2011-08-20 Thread Malcolm Box
isit this group athttp:// > groups.google.com/group/django-users?hl=en. > > -- > 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 unsubscrib

Re: Best approach to handling different types of Users

2011-08-20 Thread Malcolm Box
On 19 August 2011 03:37, Andre Terra wrote: > Until you install some third party app that accesses > User.objects.all() and then suddenly nothing works as it's supposed > to. > > I hear this a lot that "things will break" if you subclass User. However, I haven't seen anyone share a concrete examp

Re: Help installing django-sentry

2011-08-22 Thread Malcolm Box
Post your urls.py file - it looks like you have a pattern that is over aggressively matching /sentry as a poll. Malcolm Sent from my iPhone, please excuse any typos On 21 Aug 2011, at 21:18, tharshan muthulingam wrote: > Hi, > I have been having alot of trouble trying to install and run dja

Re: Problem updating data

2011-08-24 Thread Malcolm Box
. > 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. > > -- Malcolm Box ma

Re: Pagination of more than one field

2011-09-07 Thread Malcolm Box
On 7 September 2011 08:25, OC wrote: > also attaching relevant parts of view.py: > > > movpagin = Paginator(movies, 12) > >page = int(request.GET.get('page','1')) >try: >moviesp = movpagin.page(page) >except PageNotAnInteger: ># If page is not an integer, deliver firs

Re: django and thrift

2011-09-07 Thread Malcolm Box
On 7 September 2011 07:18, leon wrote: > Hi, > > I have one question. Is it possible to use Django to write thrift > (http://thrift.apache.org/) formated web service? If it is possible, > is there any sample? > > Possible, maybe. But almost certainly the wrong thing to do. Thrift is a binary pr

Re: Pagination of more than one field

2011-09-07 Thread Malcolm Box
On 7 September 2011 14:57, OC wrote: > Thank you very much for your reply, > I changed it but I guess Im doing something wrong cause it still > doesnt work: > It tries to go to the right page now, but provides nothing although I > know there's more than one page: > > in views.py > movies_page= in

Re: In unitTest, GET Formset returns 302 instead of 200

2011-09-07 Thread Malcolm Box
On 7 September 2011 11:52, MATHIEU wrote: > For the GET method, I have tried the following code: > >def test_patron_phone_get_form(self): >self.client.login(usernamer='alex...@e.com', > password='alex') >response = self.client.get(rever

Re: django and thrift

2011-09-08 Thread Malcolm Box
On 8 September 2011 03:27, Li Lirong wrote: > Hi, > Thank you for your comments. I am new to both django and thrift. I > am hosting my service with a shared web hosting server. That's why I > want to use django to expose a thrift API. Basically, what I want is > to have a web service that can

Re: Is it possible to run from Django script?

2011-09-21 Thread Malcolm Box
On 20 September 2011 21:36, Stone wrote: > Dear users, > > I have simple question which regards with running script from view.py. > > Is it possible to do that over subprocess command? > > Yes, you can run a script from within your view. Whether you *should* or not depends largely on how long th

Re: CAS and Django cache

2011-10-27 Thread Malcolm Box
Yes, get followed by set can lead to data loss. What you want is cache.add(). This sets the value if and only if there is no existing value. Its atomic on backends that support it - notably memcached. Sent from my iPhone, please excuse any typos On 27 Oct 2011, at 07:26, Dan Julius wrote:

Re: Django tutorial hasn't received an update for 1.3

2011-10-31 Thread Malcolm Box
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-u

Re: Login problems under heavy load

2011-10-31 Thread Malcolm Box
On 24 October 2011 12:01, Tom Evans wrote: > On Fri, Oct 21, 2011 at 6:15 PM, Alpesh Gajbe > wrote: > > > > File "/usr/local/lib/python2.6/dist-packages/django/http/__init__.py", > > line 296, in read > > return self._stream.read(*args, **kwargs) > > > > IOError: request data read error > > >

Re: Caching at model class level

2011-11-04 Thread Malcolm Box
On 4 November 2011 07:02, Thomas Guettler wrote: > Am 03.11.2011 18:42, schrieb Tom Evans: > > On Thu, Nov 3, 2011 at 2:22 PM, Thomas Guettler wrote: > >> Hi, > >> > >> I try to reduce the number of db-queries in my app. > >> > >> There is a model which changes almost never. It is like a "type o

Re: memcached - Errors and Solution - please provide comments!

2011-11-10 Thread Malcolm Box
On 10 November 2011 08:54, ionic drive wrote: > Hello django friends, > > Problems: > > 1) MemcachedKeyCharacterError: Control characters not allowed > 2) MemcachedKeyLengthError: Key length is > 250 > > The obvious solution is not to generate keys with these properties. >def _smar

ANN: Two-level caching for Django

2011-05-04 Thread Malcolm Box
Hi, We recently hit a bottleneck accessing a memcached server from Django on a big site. To solve it, I created two-level cache with a local cache on each Django box, and a global cache on the memcached machines. Under the sort of loads we were seeing, this dramatically reduced the load on the me

Re: Problem in Configuring the database

2011-05-08 Thread Malcolm Box
On 7 May 2011 16:44, rahul raj wrote: > After this i wanted to install database.. as mentioned in documentation, i > did install mysql using YaST in OpenSUSE.. when i typed "mysql" in terminal > it showed an error -- " Can't connect to local > MySQL server through socket '/var/run/mysql/mysql.so

Re: UTF-8 and files automatically created

2011-05-15 Thread Malcolm Box
Utf-8 and line endings are orthogonal issues. The problem is not that the files are not in utf-8, but that windows and Linux don't agree on what character means line-end. You will run into problems shipping unmodified windows line endings to a Linux box. Luckily the answer is git. This can be

Re: Memcached backend - caching data with infinite timeout

2011-05-17 Thread Malcolm Box
That looks like a bug in Django. I suggest you file a ticket. The fix would be to compare timeout to None Sent from my iPhone, please excuse any typos On 17 May 2011, at 10:54, Paweł Roman wrote: > Python-memcached docstring for set() says this: > > """ > @param time: Tells memcached the ti

Re: Memcached backend - caching data with infinite timeout

2011-05-17 Thread Malcolm Box
On 17 May 2011 11:15, Tom Evans wrote: > On Tue, May 17, 2011 at 11:03 AM, Malcolm Box > wrote: > > That looks like a bug in Django. I suggest you file a ticket. > > > > The fix would be to compare timeout to None > > > > A ticket has already been sub

Re: How do you organize your deployment enviroment

2011-05-23 Thread Malcolm Box
I'd heartily recommend chef - chef.opscode.com. Large library of scripts for almost any package or tool you're likely to want, scales out to lots of nodes but can be run in a simple solo mode for small deployments. Only downside is it's ruby but mostly you use the configuration language so not

Re: Userprofile, signal and admin inline edit.

2011-05-26 Thread Malcolm Box
On 26 May 2011 10:23, Jani Tiainen wrote: > If I extend auth.User with custom profile and add automatic profile > creation signal it works as expected. > > But if I try to add admin inline editor for profile when saving I get > exception about integration violation. > > It happens because admin t

Re: Admin broken with large data table

2011-05-26 Thread Malcolm Box
On Mar 29, 4:31 pm, Malcolm Box wrote: > On Mar 29, 2:48 pm, Jacob Kaplan-Moss wrote: > > > On Tue, Mar 29, 2011 at 5:56 AM, Malcolm Box wrote: > > > On one of my models, the admin choice_list page is taking minutes to > > > load, which makes it somewhat broken.

Re: Caught RuntimeError while rendering: invalid label:

2011-05-26 Thread Malcolm Box
On 26 May 2011 20:50, Bobby Roberts wrote: > anyone have any idea what invalid label means? > > Where are you getting this error? What did you do to trigger it? If you can give us more information, it's more likely that someone will be able to help you. Malcolm -- You received this message be

Re: caching ajax json (post)

2011-05-27 Thread Malcolm Box
your views. Malcolm -- Malcolm Box malcolm@gmail.com -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr

Re: primary key auto increment with PostgreSQL and non Django standard column name

2011-05-28 Thread Malcolm Box
You need to tell django what the db column name for your pollkey field is. Look at the dbname field option in the docs. Sent from my iPhone, please excuse any typos On 28 May 2011, at 05:13, Naoko Reeves wrote: > I see if column is set to AutoField then Django won't send INSERT poll_key > as

Re: choice_set.all()

2011-05-29 Thread Malcolm Box
> For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > -- Malcolm Box malcolm@gmail.com -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send e

Re: signals pre_save vs model's save()

2011-05-29 Thread Malcolm Box
On 28 May 2011 11:05, Mateusz Harasymczuk wrote: > I am thinking about splitting my model's save() method over few signals. > > For example, stripping spaces and making string capitalized. > > Why would you want to do that? > I have even more sophisticated problems such as making an object fiel

Re: How to create user on mobile app for Django site?

2011-06-02 Thread Malcolm Box
On 31 May 2011, at 12:35, Ivo Brodien wrote: > What is the correct way to do the following: > > 1) Mobile App from which a user can create a user/profile on the Django site > 2) Allow authenticated users to create on the site and query personalized > data from the site > > This is what I guess

Re: Disable debug logging for django.db.backends?

2011-06-02 Thread Malcolm Box
Alternatively, configure your logging handlers to send the db logging somewhere else (ie another file), and not to pass it on. So in settings.py have: LOGGING = { 'version': 1, 'disable_existing_loggers': False, 'handlers': { 'file_logging': { 'level' : 'DEBUG',

Re: Odp: Re: signals pre_save vs model's save()

2011-06-02 Thread Malcolm Box
On 29 May 2011, at 15:53, Mateusz Harasymczuk wrote: > W dniu niedziela, 29 maja 2011, 15:36:13 UTC+2 użytkownik Malcolm Box napisał: > On 28 May 2011 11:05, Mateusz Harasymczuk wrote: > I am thinking about splitting my model's save() method over few signals. > > For examp

Re: repr(request.session)

2011-06-07 Thread Malcolm Box
n 7 June 2011 10:46, Henrik Genssen wrote: > I try to add the content of my session to the error-mails. > I have written a middleware, overwriting the standard error mail. > But for: > repr(request.session) > I only get: > > > What am I doing wrong? > > That is the how a session object displays.

Re: Users not logging out

2011-06-07 Thread Malcolm Box
On 7 June 2011 15:14, Derek wrote: > On Jun 7, 3:39 pm, jayhalleaux wrote: > > i take that back. > > > > If I log in and then I close the tab, I can go back and still use the > > url to go to a login required page. > > close_tab != CLOSE_BROWSER > > (An interesting discussion on this type of pro

Re: django transactions.

2011-06-07 Thread Malcolm Box
n 7 June 2011 15:16, Marc Aymerich wrote: > Hi, > I've activated the > 'django.middleware.transaction.TransactionMiddleware' and I've > decorated one method with @transaction.commit_on_success > With this I expect that if the method raise an exception, django rolls > back any database operation e

Re: Re: Odp: Re: signals pre_save vs model's save()

2011-06-07 Thread Malcolm Box
On 2 June 2011 23:37, Mateusz Harasymczuk wrote: > That was a very good and convincing post :} > I am testing a solution with .clean(), which IMHO is a better place to > clean data before save() > > Glad to have been of help. clean() is ideal for cleaning up stuff from forms, so could be a great

Re: 2 projects based on the same codebase

2011-06-09 Thread Malcolm Box
On 9 June 2011 08:06, Benedict Verheyen wrote: > > I developed a calltracking for our team and now, another team is interested > to have their own calltracking. > The best way to seem to deal with a project that is the same from the > start, is to makea new virtualenv > and "git clone" the codeba

Re: django transactions.

2011-06-09 Thread Malcolm Box
On 8 June 2011 11:07, Marc Aymerich wrote: > On Tue, Jun 7, 2011 at 11:53 PM, Malcolm Box > wrote: > > n 7 June 2011 15:16, Marc Aymerich wrote:You're > right :) I'm using Mysql with myisam, I'm going to switch to > InnoDB engine and try again. > > I

Re: Updating static files: Still in browser cache

2011-06-09 Thread Malcolm Box
On 9 June 2011 08:09, Thomas Guettler wrote: > My static files (JS/CSS) are cached in the browser. But if there is a bug > in a file, an update won't help people which have already cached the old > file. > > You would need a new URL for every change in the JS/CSS files. > > Version all static ass

Re: Updating static files: Still in browser cache

2011-06-09 Thread Malcolm Box
Sent from my iPhone, please excuse any typos On 9 Jun 2011, at 14:21, DrBloodmoney wrote: > On Thu, Jun 9, 2011 at 9:16 AM, Malcolm Box wrote: >> On 9 June 2011 08:09, Thomas Guettler wrote: >>> >>> My static files (JS/CSS) are cached in the browser. But if there

Re: Boolean field, unexpected behavior

2011-06-09 Thread Malcolm Box
On 9 June 2011 21:16, elliot wrote: > However, I'm still not clear why i can save without specifying values > for the CharField or BooleanField. I didn't say null="true", and I > didn't provide default values. > > Because both have sensible default values ("" for CharField, False for BooleanFiel

Re: Authentication in API (REST)

2011-06-09 Thread Malcolm Box
On 9 June 2011 17:51, Neznez wrote: > Hi all, I'm newbie in Django, and I started to build my own API. I > know that there is Piston or Django REST framework, but I want to > learn API from scratch. What I want to know is, how to make my HTTP > Response (View) is perform authentication before can

Re: Authentication in API (REST)

2011-06-10 Thread Malcolm Box
On 10 June 2011 01:26, Yohanes Adhi Nugraha wrote: > > Not that one, if we use django.contrib.auth and @login_required, it's > only redirects you to login page. > What I saw from another site is, browser will popup an alert with > username and password to be filled. > > View source is your frie

Re: Updating static files: Still in browser cache

2011-06-10 Thread Malcolm Box
On 10 June 2011 14:54, Thomas Guettler wrote: > On 09.06.2011 19:18, Malcolm Box wrote: > > On 9 Jun 2011, at 14:21, DrBloodmoney wrote: > > > >> On Thu, Jun 9, 2011 at 9:16 AM, Malcolm Box > wrote: > >>> On 9 June 2011 08:09, Thomas Guettler wrote:

Re: Authentication in API (REST)

2011-06-14 Thread Malcolm Box
I think oauth solves this problem well. What do you see wrong with it? Malcolm Sent from my iPhone, please excuse any typos On 14 Jun 2011, at 16:35, Stuart MacKay wrote: > Neznez, > > The authentication problem is one that has never really been solved to any > general level of satisfaction

Re: Why does OpenLayers not load in django with this template ?

2011-06-19 Thread Malcolm Box
On 17 Jun 2011, at 23:07, Satyajit Sarangi wrote: > > This is my template . > > > Where should I store the OpenLayers-2.10 folder for this template to > work ? Almost certainly there is no such place. Assuming your web page is at http://example.com/a/path/to/page, you've told it to look fo

Re: Strange value_from_object() return value (2L returned instead of unicode string)

2011-06-21 Thread Malcolm Box
On 21 Jun 2011, at 01:53, Jeff Blaine wrote: > >>> from hostdb.models import Device, Interface > >>> hostname = 'beijing.mitre.org' > >>> dev = Interface.objects.get(fqdn=hostname).device > >>> dev.status > > >>> f = dev._meta.get_field('status') > >>> f.value_from_object(dev) > u'Online' > >>> #

Re: Strange value_from_object() return value (2L returned instead of unicode string)

2011-06-21 Thread Malcolm Box
On 21 June 2011 15:47, Jeff Blaine wrote: > Okay, here's the problem. > > >>> f = dev._meta.get_field('distro') > >>> f.value_from_object(dev) > 2L > > >>> f.attname > 'distro_id' > >>> > > As others guessed, value_from_object() is returning the pk ID in this > case. > > Model "Distro" is the onl

Re: csrf protection and testing with tsung

2011-06-21 Thread Malcolm Box
On 21 June 2011 16:48, Ivan Uemlianin wrote: > With tsung you record a site visit (called a session) --- log in, view > various pages, do a few things, log out --- and tsung will then hit > the site with lots of randomised versions of this session. > > Many of the views are csrf protected, and th

Re: csrf protection and testing with tsung

2011-06-22 Thread Malcolm Box
On 22 June 2011 09:52, Ivan Uemlianin wrote: > > Thanks very much for your help!  You were exactly right.  The > following config works (simplified for exposition). Glad that helped, and thank you for coming back with the working settings for anyone else who runs into the same problem. Malcolm

Re: Possible interest in a webcast/presentation about Django site with 40mil+ rows of data??

2011-06-22 Thread Malcolm Box
On 22 June 2011 14:15, Cal Leeming [Simplicity Media Ltd] < cal.leem...@simplicitymedialtd.co.uk> wrote: > Hi all, > > Therefore, I'd like to see if there would be any interest in webcast in > which I would explain how we handle such large amounts of data, the trial > and error processes we went t

  1   2   >