GenericRelation setting and behaviour due to .clear() from __set__ in ReverseGenericRelatedObjectsDescriptor

2008-08-20 Thread Matt Hoskins
This is probably not a bug and just a consequence of what I'm trying to do (and probably not doing it in a very good way), so this is not me saying "something needs to be fixed or changed", just observing. I have a model class of "Document" which has a file field on it and is set up to have a Gen

Subselect in query set .extra(tables=...)

2009-08-19 Thread Matt Hoskins
A couple of times I've wanted to be able to pass in a sub query as a table in query_set.extra to be able join in some extra information but have been thwarted as the query code always insists on quoting what you pass in as tables to .extra (i.e. it assumes it's always table names). Back in 2005 w

Re: Help request: postgresql_psycopg2 connection problem under wsgi (but under runserver and dbshell its fine!)

2009-04-20 Thread Matt Hoskins
My guess is that your connection string specifies connecting as user "acacian", specifies no password and that you've been logged in as a user with the same name to run runserver. The default configuration of postgresql allows users to connect as a postgresql user of the same name as them without

Re: pg_get_serial_sequence("unknown", "unknown") - revision 13336

2010-06-09 Thread Matt Hoskins
The calls to pg_get_serial_sequence were added in to fix #8901 and I noted on that issue that the call wasn't available on PostgreSQL prior to 8, that Django made no claims about which PostgreSQL version it requires as a minimum, but that version 7 was rather old these days with version 8 having be

Re: pg_get_serial_sequence("unknown", "unknown") - revision 13336

2010-06-09 Thread Matt Hoskins
... Replying to my own post on this bit... of course the older Django 1.1.x can still be used with the older PostgreSQL 7 without hitting this issue regardless as I'm assuming the patch for #8901 isn't being applied back to the 1.1 series :). Perhaps worth being explicit in the Django documentation

Re: pg_get_serial_sequence("unknown", "unknown") - revision 13336

2010-06-09 Thread Matt Hoskins
Hi Federico, >From the discussion on django-developers it looks like the patch will be reverted soon so you may find in due course things will start working again with SVN for the 1.2 branch (however with Django 1.3 support for 7 will likely be dropped). It doesn't sound like you particularly need

Re: problem with encoding "utf-8", postgresql 8.3

2010-06-10 Thread Matt Hoskins
I can't help shed much light on the problem, but it's worth saying that 0xefbfbd is the sequence for the UTF-8 BOM (Byte Order Mark), see http://en.wikipedia.org/wiki/Byte_order_mark#UTF-8 and is shown as a zero-width invisible character. It could be that however you're getting the "ó" onto the UR

Re: HttpRequest.DELETE implemented?

2010-06-14 Thread Matt Hoskins
>From glancing at the code for the modpython and wsgi core handlers I think django always puts the URL arguments into "request.GET" regardless of method (i.e. it's not restricted to just GET and POST requests, since query strings on URLs can exist for any method) where as "request.POST" will only b

Re: UnicodeDecodeError (ordinal not in range) when deleting an inline item - 1.2.1

2010-06-15 Thread Matt Hoskins
>   File "/usr/lib/python2.3/site-packages/sorl/thumbnail/utils.py", > line 36, in all_thumbnails >     if os.path.isfile(os.path.join(path, file)): > >   File "/usr/local/lib/python2.6/posixpath.py", line 68, in join >     path +=  b > > UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in

Re: how to use render_to_response, ajax and javascript variables

2010-06-16 Thread Matt Hoskins
Perhaps instead of using render_to_response to generate the response, render the template output to a string and then stuff that in the data structure that you serialise to json along with the other data? Regards, Matt On Jun 16, 1:17 pm, Alex wrote: > > But the problem I have - and I may be th

Re: mod_wsgi sometimes gives error on first reload but not thereafter

2010-06-16 Thread Matt Hoskins
On Jun 16, 3:07 pm, Chris Seberino wrote: > On Jun 15, 6:42 pm, Graham Dumpleton > wrote: > > > This occurs when Apache is first reading HTTP headers for request and > > long before it hands it off to any Django application or even > > mod_wsgi. > > Is there anything I can do about this?  I ass

Re: how to use render_to_response, ajax and javascript variables

2010-06-17 Thread Matt Hoskins
Django has an escapejs filter so if you're using a template to generate json you'd be safer doing, e.g.: "first_name":"{{ one_member.first_name|escapejs }}" That way if someone sticks something untoward (like a double quote) in your first_name or last_name fields it won't break things :). For th

Re: how to use render_to_response, ajax and javascript variables

2010-06-17 Thread Matt Hoskins
I was just copying Ian's choice of mimetype - see Ian's comment above "I choose text/plain deliberately but you might choose text/json (or something else)."... Although it's worth pointing out that "text/json" shouldn't be used, since "application/json" is, as you rightly point, the mimetype for js

Re: how to use render_to_response, ajax and javascript variables

2010-06-17 Thread Matt Hoskins
On Jun 17, 10:31 am, Ian McDowall wrote: > > In some cases, I don't use templates to build a JSON response.  It can > be straightforward to write it as a string inline.  I don't personally > yet use the built in Python JSON module as I don't want to limit the > Python versions that I can deploy

Re: Selling Django

2010-06-17 Thread Matt Hoskins
> plug and play.  A manager/developer making the decisions on a platform > for their next project should be able to download django and just plug > in the functionality he/she needs.  Dependencies will exist but that's > normal. > If all that would happen django would be an easy choice for anyone

Re: Selling Django

2010-06-17 Thread Matt Hoskins
Richard, That is where most people who are looking for something *in that space* look first - i.e. they have a set of requirements where those platforms are a good fit for what they're trying to do, but it isn't the only space. Those people aren't the people who pay my wages at present because, as

Re: Selling Django

2010-06-18 Thread Matt Hoskins
Yo-Yo Ma, You must be reading a different thread to me... Or rather I don't see it in quite as negative terms as you do and I'm a bit baffled as to how you've interpreted it quite so strongly! Richard's OP was indeed not saying that we should go out and advertise that it's a great CMS but he did

Re: Selling Django

2010-06-18 Thread Matt Hoskins
Richard, Glad I managed to get across where I'm coming from - I was struggling a bit with coming up with how to express it :). Great to hear you're going to contact Tom and Venkatraman about helping. I hope you didn't take anything I said as wanting to pour cold water on where you're coming from -

Re: how to eliminate duplicates

2010-06-18 Thread Matt Hoskins
I'm assuming there's no fields on the duplicate player instances that need merging - from your mention of "shift all records of the duplicate" I'm reading that as "shift all records that relate to the player" - otherwise it will need human intervention. Having stated that assumption, while it's pos

Re: UnicodeDecodeError (ordinal not in range) when deleting an inline item - 1.2.1

2010-06-21 Thread Matt Hoskins
Federico, When trying out what Karen suggests then in the unlikely event that Red Hat doesn't load the environment variables from /etc/apache2/ envvars, one way to find it without consulting documents is to look at the apache start-up script (e.g. /usr/sbin/apache2ctl) so find that on your server

Forms and non-editable fields

2008-01-07 Thread Matt Hoskins
I'm fairly new to django and am just starting to play with it as a framework for web-based applications. The kinds of applications I develop typically have some fields for entities that are non-editable, with some of these being non-editable only some of the time (depending on things like entity s

Re: Forms and non-editable fields

2008-01-10 Thread Matt Hoskins
> Interestingly, I wanted to write very similar request, but you passed > ahead of me. :) I'm writing form/questionnaire site for our summer > school and I want to be able render filled forms as text, easy readable > and easy printable. So, my needs are pretty close to yours. It struck me as not

Getting at order_by column values easily in queryset-refactor?

2008-03-03 Thread Matt Hoskins
In my application I have a component for displaying paged sorted tables of objects. Sometimes it's relevant for a column to show information from a related object. In some cases it's relevant for the column to show information from related objects where the related objects are related via a many t

Re: Getting at order_by column values easily in queryset-refactor?

2008-03-03 Thread Matt Hoskins
> Having read this again in light of your complaint in #6701, I should > point out that it's not going to work like this if you're always > filtering on Contract. Not really a complaint in #6701 - you didn't say at first that you were going to remove support for m2m order_by, so I was concerned t

Re: Getting at order_by column values easily in queryset-refactor?

2008-03-03 Thread Matt Hoskins
> It's more than a preference and it's very important to realise that. It > is not possible for it to work unless you pick a behaviour arbitrarily. > Suppose you have the following objects: I don't think I've ever said anything about preferences (apologies if I had). It is, IMHO, a design choice

Quick question about qs-rf and queries using distinct and order_by on foreign key fields

2008-04-22 Thread Matt Hoskins
I see that in the latest svn checkout of qs-rf if you have a query set which has had distinct() called and then order_by() on a foreign key field you don't get the ordering on that foreign key field - the resulting generated sql query has the joins for the foreign table ready to be used for the or

Re: Quick question about qs-rf and queries using distinct and order_by on foreign key fields

2008-04-23 Thread Matt Hoskins
> There's nothing in the queryset-refactor branch that's really "work in > progress" any longer (at least not committed to the tree). So please > open a ticket with a short example so that this doesn't get forgotten. Thanks Malcolm - I've opened a ticket for it now (number #7070). Regards, Matt

Re: Queryset-refactor branch has been merged into trunk

2008-04-28 Thread Matt Hoskins
On Apr 27, 4:04 am, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > I merged queryset-refactor into trunk just now. This was changeset > r7477. Thanks for all your hard work Malcolm on queryset-refactor, it's much appreciated! Regards, Matt --~--~-~--~~~---~--~

Re: urls.py and adding an OR to the regexp

2008-05-28 Thread Matt Hoskins
On May 28, 8:53 am, Thierry <[EMAIL PROTECTED]> wrote: > Hello django users, > > I'm new to django, and I was looking to implement a very simple url > scheme that I used for a PHP site. > It's simply an OR done into the matching. Taking the simpliest, I > would like to implement this regexp: > ^

Re: urls.py and adding an OR to the regexp

2008-05-28 Thread Matt Hoskins
On May 28, 2:06 pm, [EMAIL PROTECTED] wrote: > Couldn't you also use something along the lines of > ^price[s]/ > > Though I may have the syntax wrong. Just to correct your syntax the regular expression for making the last letter in that example optional would be: ^prices?/ Matt --~--~