Re: databrowse and @login_required

2007-05-30 Thread Malcolm Tredinnick
On Wed, 2007-05-30 at 10:58 -0400, Jason McVetta wrote: > On 5/29/07, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > Or you could subclass DatabrowseSite -- in your own code > somewhere; no > need to even modify the source -- and override the root() > method to do

Re: Newforms / Validation / Uniqueness

2007-05-30 Thread Malcolm Tredinnick
On Wed, 2007-05-30 at 08:31 -0700, ringemup wrote: [...] > > So a "uniqueness" constraint on your model is not something that the > > form framework is really in a position to check. Instead, what should > > happen is you construct the model object and then call > > object.validate(), which

Re: Applications imports best practices ?

2007-05-30 Thread J.P. Cummins
>What is the proper way to import modules within an application ? For >example if I have a project "foo" containing an application "bar", >how should I import things in bar's modules ? Great question! This is a problem that I've thought about as well. I am very interested in what more

Re: OT: Resources for converting MySQL data to PostgreSQL for Django

2007-05-30 Thread Malcolm Tredinnick
On Wed, 2007-05-30 at 22:48 +0200, Nicola Larosa wrote: > David wrote: > > The second reply asked "Why switch?" There's no smoking gun or nasty > > occurrence, but we're switching some applications from Oracle to open- > > source databases and are trying several. Because we need to interact > >

Re: newforms: how to report multiple cross-field validation errors?

2007-05-30 Thread Malcolm Tredinnick
On Wed, 2007-05-30 at 21:49 +, [EMAIL PROTECTED] wrote: > On May 24, 12:04 am, Malcolm Tredinnick <[EMAIL PROTECTED]> > wrote: > > > Your form-level clean method should run through all of its validation, > > collecting the errors as it goes and then raise a ValidationError. Note > > that

Re: MySQL caveat

2007-05-30 Thread Malcolm Tredinnick
On Wed, 2007-05-30 at 15:47 -0700, will_o0o wrote: > > I'm installing django with mysql and was getting the cryptic > message... > > "Skipping validation because things aren't configured properly." > > It turned out there's a bug in the mysql python wrapper (MySQLdb) for > version 1.2.2. The

Re: JSON-ifying newform errors?

2007-05-30 Thread Malcolm Tredinnick
On Wed, 2007-05-30 at 23:40 +0200, Bram - Smartelectronix wrote: > Hey everyone, > > > I was thinking that I'd like to know if there is a standard way of > transforming a newforms reply to JSON (or anything else). > > I'd like to think it would be easy to have a new-form, submit it via >

Re: Applications imports best practices ?

2007-05-30 Thread James Bennett
On 5/30/07, Luper Rouch <[EMAIL PROTECTED]> wrote: > 2. import bar.module > the application is more portable, but its path has to be included in > PYTHON_PATH (at least under mod_python) I generally opt for this one, but with one caveat: I almost *never* place applications directly inside the

Applications imports best practices ?

2007-05-30 Thread Luper Rouch
Hi list, What is the proper way to import modules within an application ? For example if I have a project "foo" containing an application "bar", how should I import things in bar's modules ? 1. import foo.bar.module the source code has to be modified when using bar in another project 2.

MySQL caveat

2007-05-30 Thread will_o0o
I'm installing django with mysql and was getting the cryptic message... "Skipping validation because things aren't configured properly." It turned out there's a bug in the mysql python wrapper (MySQLdb) for version 1.2.2. The module tries to import "ImmutableSet" from sets.py. The solution is

Re: View (maybe middleware?) question

2007-05-30 Thread Robert Coup
Chris Kelly wrote: > I am in the process of writing an app that will have a "theme" based > on if a subdirectory is specified e.g.: > > http://somesite.com/app/(theme)/abunchofviews/ > > basically, if they go to /app/bluetheme/register, it'll give them a > registration page with a blue theme

Re: newforms: how to report multiple cross-field validation errors?

2007-05-30 Thread [EMAIL PROTECTED]
On May 24, 12:04 am, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > Your form-level clean method should run through all of its validation, > collecting the errors as it goes and then raise a ValidationError. Note > that ValidationError can take a list of error messages in its > constructor, so

Re: Best-practices for form with image

2007-05-30 Thread Bram - Smartelectronix
Xin Xic wrote: > Well, I want out a form for a human verification with an image and an > input field. But I don't know how is the best practice for make this. > How do you do it? Try: http://smileychris.tactful.co.nz/ramblings/recaptcha/ de res, - bram

Re: Where did you put your homepage view?

2007-05-30 Thread Panos Laganakos
direct_to_template sounds like a nice way to handle the index page serving. But how can it be fed the dynamic content of one or more apps to display? Not sure how it's supposed to be done through "template tags" as Michel mentioned. On May 24, 5:42 pm, Michel Thadeu Sabchuk <[EMAIL PROTECTED]>

Re: Concatenate fields

2007-05-30 Thread Tim Chase
> I have a question about filtering queries concatenating fields. > I just saw in documentation the possibility to concatenate (AND, OR) > sentences, but not concatenate table-fields to filter something. Is > the Django DB-API able to do something like that? > > [SQL] > WHERE lower(table1.label

JSON-ifying newform errors?

2007-05-30 Thread Bram - Smartelectronix
Hey everyone, I was thinking that I'd like to know if there is a standard way of transforming a newforms reply to JSON (or anything else). I'd like to think it would be easy to have a new-form, submit it via JSON and be able to -automatically- display the errors, as if you would just have

limit_choices_to confusion

2007-05-30 Thread Todd O'Bryan
I was trying to use limit_choices_to in what I thought was an intuitive way. class Organization(models.Model): members = ManyToManyField(User) class Committee(models.Model): org = ForeignKey(Organization) chair = ForeignKey( User, limit_choices_to={

Re: Custom templatetags error

2007-05-30 Thread sansmojo
Fixed! I tried putting the contents of my previous templatetags in another directory and it worked. Seems silly, though. Anyhow, now I have: project/templatetags/__init__.py project/templatetags/templatetags/__init__.py project/templatetags/templatetags/general_tags.py Also, in case anyone

Custom templatetags error

2007-05-30 Thread sansmojo
I'm having my first go at a generic templatetag and am having issues getting it to work. I've created a directory at project/templatetags, which contains __init__.py and general_tags.py I've added project.templatetags to my INSTALLED_APPS in settings.py general_tags.py looks like this (it's

Concatenate fields

2007-05-30 Thread Gabriel Laet
Hi, I have a question about filtering queries concatenating fields. I just saw in documentation the possibility to concatenate (AND, OR) sentences, but not concatenate table-fields to filter something. Is the Django DB-API able to do something like that? [SQL] WHERE lower(table1.label || ' ' ||

Re: OT: Resources for converting MySQL data to PostgreSQL for Django

2007-05-30 Thread Nicola Larosa
David wrote: > The second reply asked "Why switch?" There's no smoking gun or nasty > occurrence, but we're switching some applications from Oracle to open- > source databases and are trying several. Because we need to interact > both via Django applications and via direct SQL, we have been

Re: Newforms / Validation / Uniqueness

2007-05-30 Thread Alfonso Ali
My solution is to use the base class parameter of form_for_[model|instance] function, for example: class SomeTest(models.Model): name = models.CharField(maxlength=50) user = models.ForeignKey(User) class Meta: unique_together = (('user', 'name'),) class

View (maybe middleware?) question

2007-05-30 Thread Chris Kelly
I am in the process of writing an app that will have a "theme" based on if a subdirectory is specified e.g.: http://somesite.com/app/(theme)/abunchofviews/ basically, if they go to /app/bluetheme/register, it'll give them a registration page with a blue theme header and footer (it looks up a

Re: Best-practices for form with image

2007-05-30 Thread ringemup
On May 27, 8:38 am, Baurzhan Ismagulov <[EMAIL PROTECTED]> wrote: > On Tue, May 22, 2007 at 06:56:31AM -0700, [EMAIL PROTECTED] wrote: > > And there are no best practices for using something as inherently > > inaccessible and annoying as a captcha. > > So, what are the best practices to check

Re: ChangeManipulator and default value not working.

2007-05-30 Thread [EMAIL PROTECTED]
Oh..I meant to mention that this is using the default ChangeManipulator for the class. If I specify the delete_flag in the non_fields as zero, it of course works...but I'm adding this flag in a lot of places... so I'd prefer that it just stay as 0 w/out me specifiying it in the non_fields list

ChangeManipulator and default value not working.

2007-05-30 Thread [EMAIL PROTECTED]
I have a field: delete_flag = models.IntegerField(null=False, blank=True,default=0) When I save it initially, the delete_flag is set to 0, but if I edit it, and don't specify the delete_flag value, it seems to be getting set to NULL anyone have any idea why? Thanks for any information,

Re: Newforms / Validation / Uniqueness

2007-05-30 Thread Horst Gutmann
ringemup wrote: > > Do you then have to figure out which errors apply to which Form > fields, and sort them out and assign them? I haven't seen any sample > code doing anything of this sort, so I'd be very interested to see how > it works. > I was recently in the same situation and did

Re: Newforms / Validation / Uniqueness

2007-05-30 Thread ringemup
> The short answer to your problem is probably to not use form_for_model() > if you want this sort of support. Instead write your own Form sub-class > and write a clean() method for it. The form_for_model() function is just > an aid after all; it shouldn't be the only thing you ever consider >

Re: Stagnating Djangobook? Broken Atom feed?

2007-05-30 Thread Rob Hudson
I was kind of wondering the same... is the Django Book going to align with Django 1.0? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to

Re: Unicode-branch: testers wanted

2007-05-30 Thread Michael Radziej
Hi Malcolm! On Sat, May 26, Malcolm Tredinnick wrote: > On Fri, 2007-05-25 at 17:17 +0200, Michael Radziej wrote: > > First, I found that I have a problem with commit 5255 together with the test > > client. It breaks loading the modules, probably due to recursive imports. > > > > - management

Re: databrowse and @login_required

2007-05-30 Thread Jason McVetta
On 5/29/07, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > > Or you could subclass DatabrowseSite -- in your own code somewhere; no > need to even modify the source -- and override the root() method to do > an auth-check first and then call DatabrowseSite.root(). Then you > replace

Re: ManyRelatedManager object is not iterable

2007-05-30 Thread Russell Keith-Magee
On 5/30/07, Todd O'Bryan <[EMAIL PROTECTED]> wrote: > > On Tue, 2007-05-29 at 21:38 -0400, Todd O'Bryan wrote: > > Template error > > In > > template > > /home/tobryan1/workspace/dmi/src/dmi/orgs/templates/obligationList.html, > > error at line 18 > > > > > > Caught an exception while

Re: Unicode-branch: testers wanted

2007-05-30 Thread Jason Davies
On May 24, 2:06 pm, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > The unicode branch, [1], is now at a point where it is essentially > feature-complete and could do with a bit of heavy testing from the wider > community. > > So if you have some applications that work against Django's current >

Re: GeoDjango Admin interface - Invalid HEX given!

2007-05-30 Thread mikeyparker
Cheers for the heads up On 27 May, 15:52, "Jeremy Dunck" <[EMAIL PROTECTED]> wrote: > On 5/23/07, mikeyparker <[EMAIL PROTECTED]> wrote: > > > > > I'm just moving an application that we were writing over to the > > GeoDjango branch > > FYI, I'm woefully behind on merging that branch up to trunk.

Re: Returning a list of entries associated with a tag (using django-tagging)

2007-05-30 Thread Jonathan Buchanan
On May 25, 5:56 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > I'm trying to write a view to return a list of blog entries associated > with a specific tag (using the django-tagging app). You can do the following to get a BlogEntry QuerySet for the appropriate entries:

Re: Abstract field

2007-05-30 Thread Sebastjan Trepca
Great, works nicely. I would have a follow-up question though :) What about QuerySets? Could I do: p = Poll.objects.get(viewer=request.user,pk=poll_id) and get that viewer parameter passed via QuerySet to the model? Thanks, Sebastjan On 5/29/07, Malcolm Tredinnick <[EMAIL PROTECTED]>

Re: Unicode-branch: testers wanted

2007-05-30 Thread Almad
On May 30, 3:09 am, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > Everything is ready (you can see all the pieces that were ported over in > the "TODO" list on the UnicdeBranch wiki page). Syndication has > definitely been tested with non-ASCII content, so it should also work. > Any failures

Re: ManyRelatedManager object is not iterable

2007-05-30 Thread Todd O'Bryan
On Tue, 2007-05-29 at 21:38 -0400, Todd O'Bryan wrote: > Template error > In > template > /home/tobryan1/workspace/dmi/src/dmi/orgs/templates/obligationList.html, > error at line 18 > > > Caught an exception while rendering: 'ManyRelatedManager' object is not > iterable > > 18 {% for

Re: access user.id

2007-05-30 Thread Dushyant Sharma
hey thanks chrominance for real good helping stuff. i was not looking at the last line which clearly states that argument 1 must be string or read-only buffer, not long your return HttpResponse(str(uu.id))is really helpful and also thanks for get() and filter(). i'll keep that

Re: access user.id

2007-05-30 Thread chrominance
> return HttpResponse(user.id) #just to test > > it returns error > MOD_PYTHON ERROR > TypeError: argument 1 must be string or read-only buffer, not long > besides all that long error page That's because HttpResponse expects a string (or read-only buffer) and you've

Re: Newforms / Validation / Uniqueness

2007-05-30 Thread Thomas Guettler
Am Dienstag, 29. Mai 2007 21:19 schrieb ringemup: > Hello -- > > I'm using a basic form_for_model() form object for a model that has a > unique=True constraint on a field other than the primary key. > > When validating submitted data, is there a reason the form check that > that constraint hasn't

access user.id

2007-05-30 Thread [EMAIL PROTECTED]
i am having problem while accessing user.id. i am using default user object from django.contrib.auth. my code is from django.contrib.auth.models import User username = request.POST['username'] password = request.POST['password'] user = authenticate(username=username, password=password) if

Re: problems using django on lighttpd with fastcig

2007-05-30 Thread Paul Rauch
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Kelvin Nicholson schrieb: > On Tue, 2007-05-29 at 19:27 +0200, Paul Rauch wrote: >> -BEGIN PGP SIGNED MESSAGE- >> Hash: SHA1 >> >> Hello list ;) >> > > Howdy. > > I just took a quick browse through the attached pages. The first thing > that

Re: single-sign-on

2007-05-30 Thread Gábor Farkas
David Larlet wrote: > 2007/5/29, Gábor Farkas <[EMAIL PROTECTED]>: >> hi, >> >> i probably will have to implement a single-sign-on (SSO) solution for >> several django-based intranet web-applications. >> >> i looked into the mailing list archives, and found this: >> >>