Re: get for errors as string and not as HTML

2008-04-29 Thread Mike Chambers

Thanks.

This was the only way I could get the string:

{% for s in form.user_name.errors %}{{s}}{% endfor %}

I tried some of the list template filters (such as slice, but didnt 
havent any luck with them).

Are there instances where more than one validation error would be 
returned for a specific field?

Thanks again for the help...

mike chambers


Ronny Haryanto wrote:
> On Wed, Apr 30, 2008 at 12:03 PM, Mike Chambers <[EMAIL PROTECTED]> wrote:
>>  
>> Name
>> {{ form.user_name }} {{ form.user_name.errors }}
>>  
> 
>>  Is there any way to just get the raw error string?
> 
> You should be able to treat form.user_name.errors as a python list
> (e.g. iterate with for, join, etc).
> 
> Ronny

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Queryset-refactor branch has been merged into trunk

2008-04-29 Thread pemdas

The above post is in reference to Craig Ogg's post on using the
Mercurytide FullText searching.
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: get for errors as string and not as HTML

2008-04-29 Thread Ronny Haryanto

On Wed, Apr 30, 2008 at 12:03 PM, Mike Chambers <[EMAIL PROTECTED]> wrote:
>  
> Name
> {{ form.user_name }} {{ form.user_name.errors }}
>  

>  Is there any way to just get the raw error string?

You should be able to treat form.user_name.errors as a python list
(e.g. iterate with for, join, etc).

Ronny

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Queryset-refactor branch has been merged into trunk

2008-04-29 Thread pemdas

Thanks for the post! It would have taken me hours to figure out where
to start looking when this error first came up. I made the change to
my SearchQuerySet subclass instead and it works also. I didn't make
the change to SearchManager. My code looks like this if interested.

class SearchQuerySet(models.query.QuerySet):
def __init__(self, model=None, fields=None, *args, **kwargs):
super(SearchQuerySet, self).__init__(model,  *args, **kwargs)
self._search_fields = fields

Also, I was reading the docs on the queryset-refactor branch (http://
code.djangoproject.com/wiki/
QuerysetRefactorBranch#Backwardsincompatiblechanges) and there is a
note at the bottom that says the params argument for extra() will now
only work for the where clause. Since Mercurytide's solution uses
params for both select and where I would expect this to also be a
problem. Surprisingly it still works.

It also works with the new solution which looks like this
select_params=[query],params=[query]

instead of
params=[query,query]

-Matt
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



get for errors as string and not as HTML

2008-04-29 Thread Mike Chambers

I have a form that I am custom rendering in a view like so:

--
 
Name
{{ form.user_name }}
 
--

I am working on implementing input error feedback, so I did this:

--
 
Name
{{ form.user_name }} {{ form.user_name.errors }}
 
--

However, as specified in the docs, this returns an HTML formatted error 
string (wrapped in UL tags):

--
http://www.djangoproject.com/documentation/0.96/newforms/#how-errors-are-displayed

HOW ERRORS ARE DISPLAYED
If you render a bound Form object, the act of rendering will 
automatically run the form’s validation if it hasn’t already happened, 
and the HTML output will include the validation errors as a  near 
the field. The particular positioning of the error messages depends on 
the output method you’re using:
--

Is there any way to just get the raw error string? I realize I can put 
styles on the UL to do what I want, but that seems like a bit of a hack.

thanks for any input...

mike

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Django, Komodo and Mac OS X

2008-04-29 Thread Scott SA

On 4/29/08, ydjango ([EMAIL PROTECTED]) wrote:

>My path is
>
>/Users/xyz/django-trunks/django/bin
>
>and I have links created as mentioned in django installation guide.
>
>what path did you add, till django-trunks or till django?
>
>when I do . I see all the attributes and methods of
>the model class but do not see "objects" ( I want
>.objects. code completion)

I had not tested Open Komodo/Komodo Edit for many months so decided to give the 
latest version a try. From a fresh install, the auto-complete features worked 
(though I did restart the application once before I had a chance to test it).

As I've been using 'ports'  to install OSS packages (I'm 
running 10.4.11 on a G5), the path I setup for django is:
/opt/local/lib/django_trunk/

... I have a bunch of other projects downloaded there too.

Of course, you can set it up pretty much anywhere from your home directory to 
/usr/local/lib/ and more, but it would be best to standardize. You can get to 
the hidden directories, btw, via the Finder using the cmd-shift-G option from 
the 'Go' menu.

I was using Eclipse for a while. Some very nice features but a **huge** memory 
footprint. I recently tested the latest BBedit and Text Mate (oh and about 20 
mins with Smultron) and each have their merits. So far, I have to say that 
Komodo Edit has improved _dramatically_ since my last encounter. Th syntax 
highlighting is not as good as TM, that's about the only negative I've found so 
far (5 hours is not long enough).

Anyway, just wanted to point out the path options and my success with a fresh 
install.

Scott


>On Apr 29, 2:51 pm, Rui Pacheco <[EMAIL PROTECTED]> wrote:
>> This is what I had to do:
>> Added the path to my Django uncompressed directory to Preferences ->
>> Languages -> Python -> Additional Python Import Directories
>>
>> On Apr 29, 10:48 pm, Rui Pacheco <[EMAIL PROTECTED]> wrote:
>>
>> > It's now working. Very strange, I had a very hard time importing
>> > django.db.models but all of a sudden it works.
>>
>> > On Apr 29, 10:44 pm, Szaijan <[EMAIL PROTECTED]> wrote:
>>
>> > > Hi Rui,
>>
>> > > I'm using Komodo Edit 4 on Mac OSX 10.5 and code completion works for
>> > > me in .py files out of the box (just tested it for
>> > > django.utils.simplejson.)  I did nothing to the setup to get this to
>> > > work.  Is it possible your django installation isn't on the python
>> > > path for the user you're logged in as when editing files?
>>
>

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



a question about model inheritance after qs-rf

2008-04-29 Thread medhat

Hi,

QS-rf in general and model inheritance in particular are really cool.
I have been waiting for them for a long time, thanks :-)

I am trying now to use them. And one question I have is the following:
for multi-table inheritance, (using the example from the
documentation,) let's say that we have a Place object, is there a way
to convert that object into a Restaurant object?

The case I am trying to do is have an "augmented" ContentType [ACT]
object that will inherit from ContentType but add some other stuff,
like icon, etc... but at the time when I try to create my ACT, the
ContentType object is already created by syncdb. So, is there a way to
create an ACT and tell it to use a specific ContentType object as its
parent? Or should this be done differently?

--
Thanks,
Medhat

P.S. Before model inheritance I did this using a OneToOneField, but I
am trying to take advantage of model inheritance now.
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Django, Komodo and Mac OS X

2008-04-29 Thread ydjango

My path is

/Users/xyz/django-trunks/django/bin

and I have links created as mentioned in django installation guide.

what path did you add, till django-trunks or till django?

when I do . I see all the attributes and methods of
the model class but do not see "objects" ( I want
.objects. code completion)

Ashish

On Apr 29, 2:51 pm, Rui Pacheco <[EMAIL PROTECTED]> wrote:
> This is what I had to do:
> Added the path to my Django uncompressed directory to Preferences ->
> Languages -> Python -> Additional Python Import Directories
>
> On Apr 29, 10:48 pm, Rui Pacheco <[EMAIL PROTECTED]> wrote:
>
> > It's now working. Very strange, I had a very hard time importing
> > django.db.models but all of a sudden it works.
>
> > On Apr 29, 10:44 pm, Szaijan <[EMAIL PROTECTED]> wrote:
>
> > > Hi Rui,
>
> > > I'm using Komodo Edit 4 on Mac OSX 10.5 and code completion works for
> > > me in .py files out of the box (just tested it for
> > > django.utils.simplejson.)  I did nothing to the setup to get this to
> > > work.  Is it possible your django installation isn't on the python
> > > path for the user you're logged in as when editing files?
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Passing file contents to output w/o reading it to memory

2008-04-29 Thread Graham Dumpleton

On Apr 30, 11:44 am, vv2 <[EMAIL PROTECTED]> wrote:
> Hi there,
>
> I just noticed latest changeset in django-trunk (http://
> code.djangoproject.com/changeset/7510) and I started wondering if it
> is possible to pass file contents to output without actually storing
> it in memory.
>
> So, the question is:
> Is there anything like PHP's fpassthru() function (http://uk3.php.net/
> fpassthru) possible in Django? There is a lot of framework layers to
> get through, so I suppose it's not really possible?

The Python WSGI specification supports an optional extension
wsgi.file_wrapper. See:

  
http://www.python.org/dev/peps/pep-0333/#optional-platform-specific-file-handling

A WSGI adapter for a server may implement this if it wishes, although
not many do.

One which does is mod_wsgi for Apache.

The result is that the web application can pass an open file object
and in case where it is a wrapper for a C level FILE object, mod_wsgi
is able to use the associated file descriptor and get lower levels of
Apache to effectively send anything accessible through the file
descriptor. Apache will use memory mapping or sendfile() calls where
it can to send the contents of the file, thereby avoiding having to
actually copy the contents into memory.

Although Django can be hosted on WSGI, I am not sure if it makes use
of this if it is available. I know it is mentioned in django/core/
servers/basehttp.py, and that there are are means of specifying
platform specific ways of sending files, but does it actually get used
if it is available. That is a question I'd like to know as well
because if Django uses wsgi.file_wrapper automatically already, I
could advertise it as another benefit of mod_wsgi. :-)

Graham
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Passing file contents to output w/o reading it to memory

2008-04-29 Thread vv2

Hi there,

I just noticed latest changeset in django-trunk (http://
code.djangoproject.com/changeset/7510) and I started wondering if it
is possible to pass file contents to output without actually storing
it in memory.

So, the question is:
Is there anything like PHP's fpassthru() function (http://uk3.php.net/
fpassthru) possible in Django? There is a lot of framework layers to
get through, so I suppose it's not really possible?

Thanks for your help
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Insane Frustration with IE and Image uploading

2008-04-29 Thread Roboto

This is probably all just a result of lack of experience, poor
programming practices and knowledge, but I thought I'd share this
little bit of information.

My code to validate picture data posted below.
My quick commentary on it is that it works 100% for fire fox, safari.
But images won't validate with IE.  I thought this might have to do
with the accept-chartype.  But I was dead wrong.
On the split of image and sub --- IE calls jpegs, pjpeg!!!
PJPEG?!!!

So I added that as one of my allowable file types and it works now,
the validation doesn't ping off.  Are there other image file types
that are named awkwardly like this?


def clean_photo(self):
if self.clean_data.get('photo'):
photo_data = self.clean_data['photo']
if 'error' in photo_data:
raise forms.ValidationError(_('Upload a valid 
image.  The file you
uploaded was either not an image or a corrupted image'))

content_type = photo_data.get('content-type')
if content_type:
main,sub = content_type.split('/')
if not (main == 'image' and sub in 
['jpeg','gif','png','jpg']):
raise 
forms.ValidationError(_('JPEG,GIF,PNG only.'))

size = len(photo_data['content'])
if size > settings.MAX_PHOTO_UPLOAD_SIZE * 1024:
raise forms.ValidationError(_('Image too big'))

width, height = photo_data['dimensions']
if width > settings.MAX_PHOTO_WIDTH:
raise forms.ValidationError(_('Max width is %s' 
%
settings.MAX_PHOTO_WIDTH))
if height > settings.MAX_PHOTO_HEIGHT:
raise forms.ValidationError(_('Max height is 
%s' %
settings.MAX_PHOTO_HEIGHT))
return self.clean_data['photo']



--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: cut-and-paste traceback error actually the error from the time before --

2008-04-29 Thread Joe Murphy

Yeah -- I am using firefox. Thanks for the lead on that.

On Apr 29, 2:05 pm, Mike H <[EMAIL PROTECTED]> wrote:
> Are you using firefox? I think this is a "helpful" feature of firefox
> where if you fill out a form and refresh the page, it remembers the
> form content so you don't have to fill it in again.
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Hardy Upgrade And PythonPath

2008-04-29 Thread Graham Dumpleton

On Apr 30, 3:26 am, Rajesh Dhawan <[EMAIL PROTECTED]> wrote:
> Hi,
>
>
>
> > I could use some help getting my Django website back up after an
> > upgrade to Hardy Heron.  Instead of using svn to get Django, I used
> > synaptic this time.  Now my site doesn't work and I'm a bit confused
> > on path names.
>
> > I believe Hardy installed Django to /var/lib/python-support/python2.5/
> > django
> > My website is at /home/published/www/django/catalog
>
> > My httpd used to look like:
>
> > 
> > ServerName  www.example.com
> > DocumentRoot/home/published/www/django/
> > SetHandler  python-program
> > PythonHandler   django.core.handlers.modpython
> > PythonDebug On
> > PythonPath  "['/home/published/www/django', '/home/
> > published/www/django/catalog'] + sys.path"
> > SetEnv  DJANGO_SETTINGS_MODULE catalog.settings
> > 
>
> > At this point I can't remember where I brought Django down with SVN.
> > I thought it was /home/publisehd/www/django
>
> > Any advice on setting up mod_python using the default Hardy install
> > path?
>
> First drop into a python shell and try:
>
> import django
>
> Does that work without any errors? If so, Hardy has already installed
> Django in your Python path and you can remove the part "'/home/
> published/www/django'," from your Apache conf's PythonPath directive.

Sorry, I suspect that what you are telling him is wrong and you
misunderstand what he is telling you about his setup. I don't believe
he is saying that that is where Django is installed, but where his
Django site is being held. It is known that when using mod_python that
you must  list the parent directory of where the site is placed.
Depending on how you set up stuff in urls.py and other places, you
must also list the site directory itself.

Thus that they have the two paths in PythonPath is quite valid. See
the mod_python documentation on Django site for details.

What would help here is if the OP actually said what was meant by
'site doesn't work'. Is there Python exceptions in Apache error logs?
What error does the browser show?

Graham

> If that doesn't work, Django is not in your Python path. You can do
> the following:
>
> cd /home/published/www
> mv django django_svn_based
> ln -sf /var/lib/python-support/python2.5/django django
>
> Basically, this links to your Hardy Django install from your existing
> setup.
>
> Then restart Apache.
>
> However, I would recommend using Django straight from SVN. It's
> unlikely that Ubuntu's packaged version is the same as what you used
> to have in your /home/published/www/django/. With the SVN version, you
> control which revision of Django you want to work with.
>
> -Rajesh D
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Suggestions on UI (client side web) framework to complement Django

2008-04-29 Thread Andre Meyer
On Tue, Apr 29, 2008 at 9:00 PM, Szaijan <[EMAIL PROTECTED]> wrote:

>
> In searching for a JS toolkit for my first JS app, I found YUI and
> Dojo to be of equal power and utility, but YUI is MUCH better
> documented.


bad documentation for Dojo is a myth - nowadays. Dojo 1.1 is well documented
and has a couple of great features that other frameworks lack; just look at
dojox.gfx or dojox.cometd, for example, as well as http://dojocampus.org/ -
dojo rocks.

my 2c
andré

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: authenticated sessions that don't depend on http, cookies, etc.

2008-04-29 Thread Doug B

> I'd like to use something like the Django sessions middleware,
> but I don't want to involve cookies or HTTP request headers
> at all.  Does anyone have a good way to do this?

Why not?  You've got to use some kind of transport to get the XML
there anyway, and django is built with HTTP in mind.  I've been doing
json-rpc over http using django (and cookie based sessions) and it has
been working well.  I don't know if it would help, but my approach
with json-rpc was to:

Create the methods to expose, and 'register' them in a similar way to
how template tags are registered.  Registering pretty much just
associated a string name with the actual function and some meta data
for permission checks in a singleton.

Create a single view per app that receives the rpc request (post
data), determines the exposed method name and extracts the arguments
and then passes that to a dispatcher function along with the current
user.

The dispatcher function checks the exposed function registry for that
method name and the meta for authentication/permission requirements
and if met calls the function requested and returns the result which
is return in a JSONRPCResponse object (subclassed HttpResponse) that
handles packaging/serializing to json-rpc form, or if there were
errors the dispatcher catches them and converts python exceptions to
json-rpc form that reponse instead.

The core logic for the app is in the registered functions which return
python types so they can be used in normal views too.

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Login Redirect Ignored

2008-04-29 Thread Szaijan

Dead on Karen, thanks.  I am transferring the site from my OS X box to
a hosting site and was reviewing the wrong template.  All is well now.
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Session/Varibale and HttpResponseRedirect help please

2008-04-29 Thread Brandon Taylor

Hi Doug,

Yes, I'm absolutely certain it's not a browser caching issue. I was
concerned that there was something syntactically wrong with my session
get/set code that would cause the value not to be stored.

Thoughts?
Thanks,
Brandon

On Apr 29, 10:21 am, Doug Van Horn <[EMAIL PROTECTED]> wrote:
> You may want to make sure your browser cache isn't showing you an old
> page.  Hit F5 a few times, and also make sure your browser settings
> have the cache at 0MB, so it doesn't cache anything.
>
> After that I'd start by adding some print statements after you add the
> variable to the session and right before you push the variable into
> the template, to see if it's making it through the redirect.
>
> If it is, then the issue is with your template, if it's not then the
> issue is with the session.
>
> Doug Van Hornhttp://maydigital.com/
>
> On Apr 29, 12:04 am, Brandon Taylor <[EMAIL PROTECTED]> wrote:
>
> > Hello everyone,
>
> > I'm doing a redirect after a form to a "thank you" page, which I would
> > like to personalize with some of the data from the form. I've tried
> > setting a session as such:
>
> > ### views.py code
>
> > if form.is_valid():
> >     first_name = form.cleaned_data['first_name']
> >     request.session['first_name'] = first_name
>
> >     return HttpResponseRedirect('training/thanks/')
>
> > But, when I try to output the value in the "thanks" template, as such:
>
> > def thanks(request):
> >     first_name = request.session.get('first_name')
> >     return render_to_response('thanks.html', 'first_name' :
> > first_name)
>
> > I get nothing. I've checked to make sure that the sessions middleware,
> > and the sessions app are included in my settings.py file. What am I
> > doing wrong? Help appreciated!
>
> > Brandon
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Login Redirect Ignored

2008-04-29 Thread Karen Tracey
On Tue, Apr 29, 2008 at 4:25 PM, Szaijan <[EMAIL PROTECTED]> wrote:

>
> I'm using the latest django-registration (svn).  When I use the login
> URL directly, so 'next' is not set, the result of a successful login
> drops the user to my document root directory.  I've checked in shall
> and LOGIN_REDIRECT_URL is set correctly and being imported correctly,
> but it is not being used for some reason.  Everything else is working
> properly.
>
> Any suggestions on debugging this would be greatly appreciated.
>

I'd step through this code:

http://code.djangoproject.com/browser/django/trunk/django/contrib/auth/views.py#L12

in a debugger to see how redirect_to is getting its value.  From just
looking at what it does, though I'd guess that your login template includes
a 'next' parameter among what it sends with the login information, since
that looks to be the only way your setting's LOGIN_REDIRECT_URL would be
ignored.  What does your login template look like?

Karen

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Django, Komodo and Mac OS X

2008-04-29 Thread Rui Pacheco

This is what I had to do:
Added the path to my Django uncompressed directory to Preferences ->
Languages -> Python -> Additional Python Import Directories

On Apr 29, 10:48 pm, Rui Pacheco <[EMAIL PROTECTED]> wrote:
> It's now working. Very strange, I had a very hard time importing
> django.db.models but all of a sudden it works.
>
> On Apr 29, 10:44 pm, Szaijan <[EMAIL PROTECTED]> wrote:
>
> > Hi Rui,
>
> > I'm using Komodo Edit 4 on Mac OSX 10.5 and code completion works for
> > me in .py files out of the box (just tested it for
> > django.utils.simplejson.)  I did nothing to the setup to get this to
> > work.  Is it possible your django installation isn't on the python
> > path for the user you're logged in as when editing files?
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Django, Komodo and Mac OS X

2008-04-29 Thread Rui Pacheco

It's now working. Very strange, I had a very hard time importing
django.db.models but all of a sudden it works.


On Apr 29, 10:44 pm, Szaijan <[EMAIL PROTECTED]> wrote:
> Hi Rui,
>
> I'm using Komodo Edit 4 on Mac OSX 10.5 and code completion works for
> me in .py files out of the box (just tested it for
> django.utils.simplejson.)  I did nothing to the setup to get this to
> work.  Is it possible your django installation isn't on the python
> path for the user you're logged in as when editing files?
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Django, Komodo and Mac OS X

2008-04-29 Thread Szaijan

Hi Rui,

I'm using Komodo Edit 4 on Mac OSX 10.5 and code completion works for
me in .py files out of the box (just tested it for
django.utils.simplejson.)  I did nothing to the setup to get this to
work.  Is it possible your django installation isn't on the python
path for the user you're logged in as when editing files?
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Django, Komodo and Mac OS X

2008-04-29 Thread Rui Pacheco

Hi all

I've looked for a solution for this but I couldn't find any.

I've installed Django on a MacBook Pro and settled on Komodo as my IDE
because Eclipse on the Mac is just too slow.

The problem is, I can't get code completion to work because Komodo
doesn't find the Django packages. I followed all the rules on the
Django website so I'm wondering what else am I missing?

Any help would be greatly appreciated.
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Admin site - apply business logic

2008-04-29 Thread [EMAIL PROTECTED]

thanks for shedding some light, I'll be sure to keep my eye on the
newforms-admin branch.
Maybe I'll get my hands dirty in the todo list that's stopping the
merger as it looks very promising to me.

-al

On Apr 29, 9:55 pm, "Justin Lilly" <[EMAIL PROTECTED]> wrote:
> I think you'd be interested in the newforms admin branch of 
> django.http://code.djangoproject.com/wiki/NewformsAdminBranch
>
> which is what is suggested for extending the admin panel (with your business
> logic, for instance). Note that this isn't part of trunk yet. Many people
> have chosen to wait until it is merged.
>
>  -justin
>
> On Tue, Apr 29, 2008 at 3:34 PM, [EMAIL PROTECTED] <[EMAIL PROTECTED]>
> wrote:
>
>
>
> > Would it be possible to make Admin site business logic aware when
> > dealing (CRUD) with model objects?
>
> > For example, I have an "InventoryItem" model accessible via Admin
> > site. I wish to make "InventoryItem" model objects no-editable, read-
> > only, if they fall outside of a given date range as per my business
> > logic.
>
> > Regards,
> > -Alen
>
> --
> Justin Lilly
> Web Developer/Designerhttp://justinlilly.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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: need to use both django 0.96 and django trunk for work

2008-04-29 Thread Simon Willison

On Apr 29, 10:03 pm, berthor <[EMAIL PROTECTED]> wrote:
> I was told by my boss that I would be using both django 0.96 and
> django trunk on 2 separate projects.  Now I'm not sure how to go about
> doing this, as I have been working with only django 0.96 before.  I've
> downloaded the trunk version on my desktop, and have tar file of 0.96
> also on my desktop.
>
> My boss told me to install them both, and have a different python path
> set up depending on which project I am working on.

Your boss is right: that should work just fine. Install each version
of Django in a different location, then set the Python path
differently for each project. In development one way of doing this is
with an environment variable before you call manage.py:

$ PYTHONPATH=/home/django/django-0.96/ python manage.py runserver

Then in production you can set the Python path using a mod_python
directive.

Alternatively, you could hack your manage.py script to modify the
Python path at the top of the script file:

import sys
sys.path.insert(0, '/home/django/django-0.96/')

Finally, you could look in to using virtualenv to set up different
Python environments (with different stuff installed on the python
path) on the same machine: http://pypi.python.org/pypi/virtualenv

Cheers,

Simon
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



need to use both django 0.96 and django trunk for work

2008-04-29 Thread berthor

I was told by my boss that I would be using both django 0.96 and
django trunk on 2 separate projects.  Now I'm not sure how to go about
doing this, as I have been working with only django 0.96 before.  I've
downloaded the trunk version on my desktop, and have tar file of 0.96
also on my desktop.

My boss told me to install them both, and have a different python path
set up depending on which project I am working on.

My worry is that when I install django trunk, it will overwrite and
potentially harm my 0.96 version.

I've read around the web a bit and haven't come across anywhere
explaining hwo to keep both versions up and running.  and I'm sure
it's as simple as a few lines of code in a terminal shell, but I'm not
that familiar with this OS.  Probably a line or two in a settings file
i'm sure.

running Ubuntu 7.10, I have 0.96 up and running currently.  and I have
the source code of django trunk handy.

Thanks in advance
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Best way to extend an existing django app

2008-04-29 Thread Scott SA

Hi,

I'm looking for clues as to the best way I can add methods and attributes to an 
existing django app. I need to add quite a bit of functionality to a portion of 
the existing app, while other portions are good (very good, actually).

Two initial, but undesirable, options I see are to fork or branch the app or 
cherry-pick into a new app. The of several problems I see examples include the 
inability to take advantage of new features as the app evolves and it is harder 
to potentially contribute back some ides and code (or at least prototypes). The 
dubious advantage is complete control.

Is there a reasonable/accptable ot better yet "recommended" way to add 
functionality, etc. to an app without resorting to the above points? If so, 
what stones should I turn (via google serches, etc.) to figure this out.

TIA

Scott

PS. I don't believe joining the project would be in either parties best 
interests

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: cut-and-paste traceback error actually the error from the time before --

2008-04-29 Thread Colin Bean

In this situation it might be helpful to use tamper data (or something
similar) to examine the all of the requests / responses and see
exactly what your server is sending and when  Could at least
determine if this is broswer behavior or if Django is really sending
the incorrect trace.

Colin

On Tue, Apr 29, 2008 at 1:05 PM, Mike H <[EMAIL PROTECTED]> wrote:
>
>  Are you using firefox? I think this is a "helpful" feature of firefox
>  where if you fill out a form and refresh the page, it remembers the
>  form content so you don't have to fill it in again. So if you get an
>  error page, fix the problem, refresh and get a different error,
>  firefox messes up the textarea. Extremely unhelpful. I'm pretty
>  certain django is outputting the correct data. A random name and id
>  for the textarea would probably fix this, but it's really a firefox
>  problem from what I've seen.
>
>
>
>  On 29 Apr 2008, at 19:49, Joe Murphy wrote:
>
>  >
>  > I thought this was "maybe it's just me" problems -- but it happens on
>  > every install of Django, in every environment I've dealt with Django
>  > (which is now up to six).
>  >
>  > When I get a Django error page, the error that's listed in the cut-
>  > and-
>  > paste traceback is actually the error that existed  the time before.
>  >
>  > That means I get a page kind of like this:
>  > http://dpaste.com/47439/
>  >
>  > Anybody else experience this?
>  >
>
>  >
>

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Which kind of model inheritance is most suited?

2008-04-29 Thread francesco

Hi,

I'd like to implement two kind of users in my system: a buyer and a
seller.
Both kind of users should, of course, inherit from a user model.
As I'd like to use the authentication framework from django.contrib,
should I have the "user" as table in the database or can I get by with
an abstract inheritance where no table is created for the user?

Thanks
Francesco
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: How to use dojo toolkit in django?

2008-04-29 Thread [EMAIL PROTECTED]

I've also been looking at Dojo lately. Of the javascript frameworks
I've looked over, it appears to have the best combination of
abstraction and features (feel free to offer alternatives). I've tried
to get the dojox.Grid thing working but have so far failed to do so.
Serializing a queryset into JSON doesn't appear to yield a data model
structure that works with the Dojo data stores. So either I'm missing
something or I'm not describing the structure correctly when I set up
the system in javascript.

Has anyone gotten the grid working? If so, would you mind sharing an
example of the javascript model structure and/or the view that
serializes JSON? I'd like to get this thing moving if possible, as its
lazy scrolling seems like it would beat the pants off old-fashioned
pagination.

Thanks,
John

On Apr 14, 5:24 am, bobhaugen <[EMAIL PROTECTED]> wrote:
> On Mon, 14 Apr 2008 00:13:35 -0700 (PDT)
>
> Duke <[EMAIL PROTECTED]> wrote:
> > Where to store thedojotoolkit in the project
>
> You can avoid all of the static files issues withdojoby serving it
> from AOL, like so:
>  src="http://o.aolcdn.com/dojo/1.1.0/dojo/dojo.xd.js";>
>
> I'm doing it that way, both in development and production. So far, no
> hiccups, it's faster than havingDjangoserve it, and does not burden
> my host.
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Login Redirect Ignored

2008-04-29 Thread Szaijan

I'm using the latest django-registration (svn).  When I use the login
URL directly, so 'next' is not set, the result of a successful login
drops the user to my document root directory.  I've checked in shall
and LOGIN_REDIRECT_URL is set correctly and being imported correctly,
but it is not being used for some reason.  Everything else is working
properly.

Any suggestions on debugging this would be greatly appreciated.

settings.py excerpt.:

LOGIN_URL = '/visionary/accounts/login/'
LOGOUT_URL = '/visionary/accounts/logout/'
LOGIN_REDIRECT_URL = '/visionary/game/'

urls.py excerpt (NOTE: admin and auth URLs are included from unedited
files.):

from django.conf.urls.defaults import *
from registration.views import activate, register

urlpatterns = patterns('',
# Example:
# (r'^visionary/', include('visionary.foo.urls')),

# Visionary Site Home:
(r'visionary/$', 'visionary.views.home_view'),

# User Registration:
url(r'^visionary/accounts/register/$', register, {'success_url': '/
visionary/accounts/register/complete'}, name='registration_register'),
(r'^visionary/accounts/', include('registration.urls')),

# Uncomment this for admin:
(r'^visionary/admin/', include('django.contrib.admin.urls')),


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Authentication-backend problem

2008-04-29 Thread Hanne Moa

I have a type of user that is logged in to the site in a way
externally (SAML2-module for apache) to django (newest newforms-admin
branch). This external login-process leaves a token in the
environment-variables: while the token is in the envvars, the user is
logged in. (I hope to write a SAML2 module in pure python later this
year...) I have written an auth-backend to pick up and process this
token, that part works fine. The problem lies, however, in triggering
the authentication from the django side (and build a django-native
User-object if necesary.) I cannot test the auth-backend with
runserver since the token is built dynamically each time by apache, so
I'm using mod_wsgi (mod_python was just too frustrating!).

Now, my test-view calls authenticate() and then login() but I always
wind up with a 500 error. Even with loglevel set to debug, the
error-message/traceback in the apache error.log isn't very helpful.
Reproduced below, with the SSL-noise and most of the apache-noise
removed (the stuff after "referer:" cut to make the lines shorter,
line 2 is uncut):

[info] Subsequent (No.2) HTTPS request received for child 9 (server
anonymized.com:443)
[info] mod_wsgi (pid=21355, process='',
application='anonymized.com|'): Loading WSGI script
'/home/python/django.wsgi'., referer:
https://idp.samlexample.com/amserver/SSORedirect/metaAlias/idp?ReqID=_D1B2D3FF6936D432B62D916AB48DDB33
[error]  mod_wsgi (pid=21355): Exception occurred processing WSGI
script '/home/python/django.wsgi'., referer:
[error]  Traceback (most recent call last):, referer:
[error]File
"/usr/lib/python2.5/site-packages/django/core/handlers/wsgi.py", line
209, in __call__, referer:
[error]  response = middleware_method(request, response), referer:
[error]File
"/usr/lib/python2.5/site-packages/django/contrib/sessions/middleware.py",
line 37, in process_response, referer:
[error]  request.session.save(), referer:
[error]File
"/usr/lib/python2.5/site-packages/django/contrib/sessions/backends/db.py",
line 42, in save, referer:
[error]  session_key = self.session_key,, referer:
[error]File
"/usr/lib/python2.5/site-packages/django/contrib/sessions/backends/base.py",
line 109, in _get_session_key, referer:
[error]  self._session_key = self._get_new_session_key(), referer:
[error]File
"/usr/lib/python2.5/site-packages/django/contrib/sessions/backends/base.py",
line 101, in _get_new_session_key, referer:
[error]  if not self.exists(session_key):, referer:
[error]File
"/usr/lib/python2.5/site-packages/django/contrib/sessions/backends/db.py",
line 35, in exists, referer:
[error]  Session.objects.get(session_key=session_key), referer:
[error]File
"/usr/lib/python2.5/site-packages/django/db/models/manager.py", line
69, in get, referer:
[error]  return self.get_query_set().get(*args, **kwargs), referer:
[error]File
"/usr/lib/python2.5/site-packages/django/db/models/query.py", line
261, in get, referer:
[error]  obj_list = list(clone), referer:
[error]File
"/usr/lib/python2.5/site-packages/django/db/models/query.py", line
114, in __iter__, referer:
[error]  return iter(self._get_data()), referer:
[error]File
"/usr/lib/python2.5/site-packages/django/db/models/query.py", line
486, in _get_data, referer:
[error]  self._result_cache = list(self.iterator()), referer:
[error]File
"/usr/lib/python2.5/site-packages/django/db/models/query.py", line
189, in iterator, referer:
[error]  cursor.execute("SELECT " + (self._distinct and "DISTINCT
" or "") + ",".join(select) + sql, params), referer:
[error]File
"/usr/lib/python2.5/site-packages/django/db/backends/util.py", line
18, in execute, referer:
[error]  return self.cursor.execute(sql, params), referer:
[error]  ProgrammingError: current transaction is aborted, commands
ignored until end of transaction block, referer:
[error]  , referer:
[info]  Connection closed to child 9 with standard shutdown (server
anonymized.com:443)

(Yep. the second to last line was just a comma + referer).

Anyone seen this before? Where do I even start to look?

I'll also be needing to read an auth-token from a cookie later on,
again never going via a django-controlled login-page.


HM

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: cut-and-paste traceback error actually the error from the time before --

2008-04-29 Thread Mike H

Are you using firefox? I think this is a "helpful" feature of firefox  
where if you fill out a form and refresh the page, it remembers the  
form content so you don't have to fill it in again. So if you get an  
error page, fix the problem, refresh and get a different error,  
firefox messes up the textarea. Extremely unhelpful. I'm pretty  
certain django is outputting the correct data. A random name and id  
for the textarea would probably fix this, but it's really a firefox  
problem from what I've seen.

On 29 Apr 2008, at 19:49, Joe Murphy wrote:

>
> I thought this was "maybe it's just me" problems -- but it happens on
> every install of Django, in every environment I've dealt with Django
> (which is now up to six).
>
> When I get a Django error page, the error that's listed in the cut- 
> and-
> paste traceback is actually the error that existed  the time before.
>
> That means I get a page kind of like this:
> http://dpaste.com/47439/
>
> Anybody else experience this?
> 

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: authenicate

2008-04-29 Thread J. Cliff Dyer

On Mon, 2008-04-28 at 13:01 -0700, Chris wrote:
> Anyone see what I am doing wrong here?
> 

Yes.  You're not asking good questions.  You neither tell us what
happens when you run your code, nor what you expect to have happen.  

Please revise and repost.

> http://dpaste.com/47296/
> 
> Thanks in advance.

No problem.


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Admin site - apply business logic

2008-04-29 Thread Justin Lilly
I think you'd be interested in the newforms admin branch of django.
http://code.djangoproject.com/wiki/NewformsAdminBranch

which is what is suggested for extending the admin panel (with your business
logic, for instance). Note that this isn't part of trunk yet. Many people
have chosen to wait until it is merged.

 -justin

On Tue, Apr 29, 2008 at 3:34 PM, [EMAIL PROTECTED] <[EMAIL PROTECTED]>
wrote:

>
> Would it be possible to make Admin site business logic aware when
> dealing (CRUD) with model objects?
>
> For example, I have an "InventoryItem" model accessible via Admin
> site. I wish to make "InventoryItem" model objects no-editable, read-
> only, if they fall outside of a given date range as per my business
> logic.
>
> Regards,
> -Alen
>
> >
>


-- 
Justin Lilly
Web Developer/Designer
http://justinlilly.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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Great article about web2py

2008-04-29 Thread mdipierro

OK, will add the references you mention. Some questions/comments:

Why isn't the custom Q object for left joins part of Django? or is it?

The fact that Django uses a template language that is not written in
python and that you can cache it, does not mean Django qualifies as a
full YES under my definition of bytecode compilation. Anyway I will
change the entry to a YES and add something like "except for
templates". web2py can cache too (ram, disk, memcache, combinations
thereof) and there is a separate page about that.

> > Let me say once again: I like Django and I took inspiration from it.
> Welcome to the club :)

Actually, I am not that new to Django. I have taught two courses using
Django and 3 years ago I have developed a CMS used by 43 Missions at
the UN using Django: www2.un.int. It is just that I have not been
using it in the last 2 years and I have been forgetting. Too many
things to remember in Django.

Thanks for the explanations.

Massimo

On Apr 29, 12:19 pm, Joseph <[EMAIL PROTECTED]> wrote:
> With respect to using py2exe to compile Django app, refer these 
> two:http://www.jjude.com/index.php/archives/70, ideas which I borrowed
> heavily fromhttp://www.silverstripesoftware.com/blog/archives/51
>
> Ofcourse I didnt compile the templates.
>
> Joseph
>
> On Apr 29, 9:14 pm, mdipierro <[EMAIL PROTECTED]> wrote:
>
> > About Left Outer Joins:
>
> > Would the use of a custom Q object in Django to perform a LEFT OUTER
> > JOIN require programming in raw SQL or can it be done programming with
> > the ORM API only? In the first case it does not count as explained in
> > the document. In the second case I will be happy to amend the slides.
>
> > About ByteCode compilation:
>
> > Although I agree with your observation below you are comparing apples
> > with oranges. It is true that you can bytecode compile any python
> > application but what about templates for example? With one click,
> > web2py collapses the template hierarchy for each page into a single py
> > file, then bytecode compiles all models, controllers and templates and
> > zips everything into a single plug-in package. The main purposes of
> > this are ease of deplyment and speed since there is no more template
> > parsing at runtime.
>
> > The web2py binary distribution is compiled with py2exe (for widnows)
> > and py2app (for Mac). That is what cx_freeze can be compared with.
>
> > Anyway, if you post an example of a Django bytecode compiled
> > application and documentation on how to create and deploy it, I will
> > amend my document to reflect that. If a feature is not tested and not
> > documented it does not count.
>
> > Let me say once again: I like Django and I took inspiration from it.
> > Great work guys!
>
> > Massimo
>
> > On Apr 29, 10:47 am, ydjango <[EMAIL PROTECTED]> wrote:
>
> > > Article states...
> > > "Web2py and J2ee are the only frameworks that allow byte code compile
> > > applications and distribute them in closed source"
>
> > > I read somewhere that "cx_Freeze" can be used to do the same for any
> > > python app including those based on Django . I have not used
> > > cx_freeze, but intend to do so soon as my code is closed source/
> > > commercial.
>
> > > What am I missing here?
>
> > > any better alternatives to cx_freeze?
>
> > > Ashish
>
> > > On Apr 28, 10:19 am, Milan Andric <[EMAIL PROTECTED]> wrote:
>
> > > > This is not Django specific but it is framework relevant.  I thought
> > > > this was a great writeup of features for any framework.  At least I am
> > > > one person who likes the features of this web2py framework.
>
> > > >http://mdp.cti.depaul.edu/examples/static/web2py_vs_others.pdf
>
> > > > Web2py makes development happen faster because people can get up and
> > > > running quickly.  I have only played with it enough to be amazed.  It
> > > > allows the less technical disciplines like designers, journalists and
> > > > web producers to start building or collaborating with web based
> > > > database driven apps.
>
> > > > The difficulty for my organization (News21) is the biggest technical
> > > > problem which is integrating different technologies like flash and
> > > > javascript.  It is difficult to do when each discipline has their own
> > > > tools and technologies that don't integrate well. I think this is one
> > > > step closer to making these different disciplines work better.
>
> > > > --
> > > > Milan
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Admin site - apply business logic

2008-04-29 Thread [EMAIL PROTECTED]

Would it be possible to make Admin site business logic aware when
dealing (CRUD) with model objects?

For example, I have an "InventoryItem" model accessible via Admin
site. I wish to make "InventoryItem" model objects no-editable, read-
only, if they fall outside of a given date range as per my business
logic.

Regards,
-Alen

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Dynamically filter records in Admin pages

2008-04-29 Thread vincentd

Hello all,

I'm using django-0.96 and I'm looking for a simple methods to limit
dynamically the records we can see/modify via the admin pages.

I have several tables where I store the author of record (the User).
When the user has been logged-in, I would use the Admin pages to let
him view/modify his own records.

Is there a simple way to use the admin pages with a dynamical
filter ?

Thanks



--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



authenticated sessions that don't depend on http, cookies, etc.

2008-04-29 Thread Andrew D. Ball

Afternoon.

I'm working on a Django application that uses XML-RPC to
expose all of its logic.  I require that for every method
expect the user creation/registration method the requestor
be authenticated.

I'd like to use something like the Django sessions middleware,
but I don't want to involve cookies or HTTP request headers
at all.  Does anyone have a good way to do this?

Peace,
Andrew

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Rendering specific widgets of a MultiWidget

2008-04-29 Thread Martin Diers

I'm not sure why DurationField should be added to the core. It's  
really easy to subclass MultipleValueField and MultiWidget.

In any case, from looking at DurationField, it seems that the defaults  
for days, seconds, and microseconds are sane enough that you would  
probably be safe to subclass DurationField, and override format_output  
like so:

def format_output(self, rendered_widgets):
return u'%s : %s' % tuple(rendered_widgets[1:2])

Then in your form, you would have to override the default widget for  
your DurationField to use your new widget class.


On Apr 29, 2008, at 7:24 AM, Bram Duvigneau wrote:

>
> Hello,
>
> I'm using the DurationField from
> http://gulopine.gamemusic.org/2007/nov/03/storing-passages-of-time/
>
> This is working fine, but the included widget shows text fields for
> days, hours, minutes, seconds and microseconds. I would like to have
> hours:minutes. The best solution seems to be that I just render two
> fields of the widget, I could copy the widget and modify this in code,
> but that doesn't seem nice to me. So, here's my question: how could I
> render specific widgets of a MultiWidget in my template?
>
> Bram
>
> >


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Suggestions on UI (client side web) framework to complement Django

2008-04-29 Thread Szaijan

In searching for a JS toolkit for my first JS app, I found YUI and
Dojo to be of equal power and utility, but YUI is MUCH better
documented.  If you like writing the widgets but need a cross-
functional framework to put underneath them, try http://mochikit.com/.

Very functional and well documented.  It makes a nice, Ajax enabled
base for your widgets.  In the end, I wrote all of my JS from scratch
and I'm only now in a position to understand and appreciate the
robustness and cross-functionality built into MochiKit and YUI.
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



cut-and-paste traceback error actually the error from the time before --

2008-04-29 Thread Joe Murphy

I thought this was "maybe it's just me" problems -- but it happens on
every install of Django, in every environment I've dealt with Django
(which is now up to six).

When I get a Django error page, the error that's listed in the cut-and-
paste traceback is actually the error that existed  the time before.

That means I get a page kind of like this:
http://dpaste.com/47439/

Anybody else experience this?
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



SITE_ID Set Incorrectly and Ignored by get_current()

2008-04-29 Thread Szaijan

I'm not quite sure what I'm doing wrong here.  Using the Sites
framework, I have a site defined in my database with ID = 2.  In the
manage.py shell, I can get the correct site by setting SITE_ID to '2'
or 2, and calling Site.objects.get(id=SITE_ID), but
Site.objects.get_current() always returns the default site with ID=1.

In my visionary.settings.py, I have the line:

SITE_ID = 2

I've also tried SITE_ID = '2'.

Either way current_site returns the site for SITE_ID = 1.  Back in the
shell, if I import visionary.settings.py, all my other settings
variables work fine, but SITE_ID always comes back as 1.  I assume I'm
somehow setting it incorrectly.  Any ideas as to what I'm doing wrong?

An excerpt from my settings.py:

SITE_ID = 2
# SITE_URL = '67.207.147.185/visionary/'
LOGIN_URL = '/visionary/accounts/login/'
LOGOUT_URL = '/visionary/accounts/logout/'
LOGIN_REDIRECT_URL = '/visionary/game/'

An excerpt from my shell:

>>> from django.contrib.sites.models import Site
>>> import visionary.settings as s
>>> s

>>> s.SITE_ID
1
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: I think psyco breaks Django trunk (post qs-rf merge)

2008-04-29 Thread TP

We've had periodic problems using Pyscho and have resorted to just
enabling it for the few key functions that really need it. In our case
there are a couple functions that do significant number crunching and
so it makes sense to Psycho them but not the rest of the site.

On Apr 29, 12:35 pm, Ken <[EMAIL PROTECTED]> wrote:
> I just updated my production site to latest trunk, and got hard 500
> errors (not even going through the exception handler). Problem caused
> by bad interaction of new Query objects and psyco. Disable psyco.
>
> The exception was:
>
>  File "/csc/django/db/models/sql/query.py", line 185, in clone
>     obj.__dict__.update(kwargs)
> TypeError: descriptor '__dict__' for 'Empty' objects doesn't apply to
> 'Query' object
>
> The problem appears to be due to the magic that function does of
> changing the runtime class of an object.
>
> I was using a Psyco middleware (from the wiki, using psyco.full()).
>
> Just thought I'd give people a heads-up. Is psyco+Django dead?
>
> -Ken
>
> PS - The reason this didn't go through the error handling for me is
> that I have a module-level model object retrieved from the database at
> import time. Bad idea for a number of reasons, so it's gone in my
> devel branch.
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



check if template block has been defined?

2008-04-29 Thread Mike Chambers

Is there any way to check if a template block has been defined?

Something like:

{%if title%} : {% endif %}{% block title %}{% endblock %}

Looking at:

http://www.djangoproject.com/documentation/templates/#template-inheritance

it doesn't look like there is. Can anyone suggest a workaround?

Basically, if a sub template specifies the title, then I was to prepend"

SITENAME :

otherwise, I just want:

SITENAME

mike

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Unicode slug?

2008-04-29 Thread chatchai

Hi,

I'm try to get meaning full url but it seem like I will give up and
use translate or random ascii instead.

I try to quote slug and got key error because urllib doesn't take care
about unicode. So I add
self.slug = quote(self.slug.encode('utf-8')) and it work with some
case, not all.

I have url like this,

r'^post/(?P\d{4})/(?P[a-z]{3})/(?P\w{1,2})/(?
P[\-\d\w]+)/$'

It work well (with slug.encode) but not all case. I mean, some
characters produce error.

What is the best way to deal with this thing? Or just use something
instead (translate slug to ascii, numeric?)

Regards

Chatchai
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: change path to django project.

2008-04-29 Thread igor.potapenko

yes. problem've solved.

in settings replace nola.polls to nola2.polls and anyting work fine.

big tnx!!!

On 29 апр, 20:55, "Karen Tracey" <[EMAIL PROTECTED]> wrote:
> On Tue, Apr 29, 2008 at 12:39 PM, igor.potapenko <[EMAIL PROTECTED]>
> wrote:
>
>
>
> >   Hello!
>
> > I installed new project in path1 (... django/nola). After that I make
> > copy of this project to path2.
> > Why it work with path1 and don't work with path2 ?
>
> > I thought, that there is some options (path_var or smth) in
> > setting.py, but I found no variables.
> > Where is information about path's store?
>
> Check the INSTALLED_APPS values in your settings.py.  It probably contains
> an app that references the old pathname.
>
> Karen
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Hardy Upgrade And PythonPath

2008-04-29 Thread Rajesh Dhawan

Hi,

> I could use some help getting my Django website back up after an
> upgrade to Hardy Heron.  Instead of using svn to get Django, I used
> synaptic this time.  Now my site doesn't work and I'm a bit confused
> on path names.
>
> I believe Hardy installed Django to /var/lib/python-support/python2.5/
> django
> My website is at /home/published/www/django/catalog
>
> My httpd used to look like:
>
> 
> ServerName  www.example.com
> DocumentRoot/home/published/www/django/
> SetHandler  python-program
> PythonHandler   django.core.handlers.modpython
> PythonDebug On
> PythonPath  "['/home/published/www/django', '/home/
> published/www/django/catalog'] + sys.path"
> SetEnv  DJANGO_SETTINGS_MODULE catalog.settings
> 
>
> At this point I can't remember where I brought Django down with SVN.
> I thought it was /home/publisehd/www/django
>
> Any advice on setting up mod_python using the default Hardy install
> path?

First drop into a python shell and try:

import django

Does that work without any errors? If so, Hardy has already installed
Django in your Python path and you can remove the part "'/home/
published/www/django'," from your Apache conf's PythonPath directive.

If that doesn't work, Django is not in your Python path. You can do
the following:

cd /home/published/www
mv django django_svn_based
ln -sf /var/lib/python-support/python2.5/django django

Basically, this links to your Hardy Django install from your existing
setup.

Then restart Apache.

However, I would recommend using Django straight from SVN. It's
unlikely that Ubuntu's packaged version is the same as what you used
to have in your /home/published/www/django/. With the SVN version, you
control which revision of Django you want to work with.

-Rajesh D
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Hardy Upgrade And PythonPath

2008-04-29 Thread dayvo

I could use some help getting my Django website back up after an
upgrade to Hardy Heron.  Instead of using svn to get Django, I used
synaptic this time.  Now my site doesn't work and I'm a bit confused
on path names.

I believe Hardy installed Django to /var/lib/python-support/python2.5/
django
My website is at /home/published/www/django/catalog

My httpd used to look like:


ServerName  www.example.com
DocumentRoot/home/published/www/django/
SetHandler  python-program
PythonHandler   django.core.handlers.modpython
PythonDebug On
PythonPath  "['/home/published/www/django', '/home/
published/www/django/catalog'] + sys.path"
SetEnv  DJANGO_SETTINGS_MODULE catalog.settings


At this point I can't remember where I brought Django down with SVN.
I thought it was /home/publisehd/www/django

Any advice on setting up mod_python using the default Hardy install
path?
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Great article about web2py

2008-04-29 Thread Joseph

With respect to using py2exe to compile Django app, refer these two:
http://www.jjude.com/index.php/archives/70, ideas which I borrowed
heavily from
http://www.silverstripesoftware.com/blog/archives/51

Ofcourse I didnt compile the templates.

Joseph

On Apr 29, 9:14 pm, mdipierro <[EMAIL PROTECTED]> wrote:
> About Left Outer Joins:
>
> Would the use of a custom Q object in Django to perform a LEFT OUTER
> JOIN require programming in raw SQL or can it be done programming with
> the ORM API only? In the first case it does not count as explained in
> the document. In the second case I will be happy to amend the slides.
>
> About ByteCode compilation:
>
> Although I agree with your observation below you are comparing apples
> with oranges. It is true that you can bytecode compile any python
> application but what about templates for example? With one click,
> web2py collapses the template hierarchy for each page into a single py
> file, then bytecode compiles all models, controllers and templates and
> zips everything into a single plug-in package. The main purposes of
> this are ease of deplyment and speed since there is no more template
> parsing at runtime.
>
> The web2py binary distribution is compiled with py2exe (for widnows)
> and py2app (for Mac). That is what cx_freeze can be compared with.
>
> Anyway, if you post an example of a Django bytecode compiled
> application and documentation on how to create and deploy it, I will
> amend my document to reflect that. If a feature is not tested and not
> documented it does not count.
>
> Let me say once again: I like Django and I took inspiration from it.
> Great work guys!
>
> Massimo
>
> On Apr 29, 10:47 am, ydjango <[EMAIL PROTECTED]> wrote:
>
> > Article states...
> > "Web2py and J2ee are the only frameworks that allow byte code compile
> > applications and distribute them in closed source"
>
> > I read somewhere that "cx_Freeze" can be used to do the same for any
> > python app including those based on Django . I have not used
> > cx_freeze, but intend to do so soon as my code is closed source/
> > commercial.
>
> > What am I missing here?
>
> > any better alternatives to cx_freeze?
>
> > Ashish
>
> > On Apr 28, 10:19 am, Milan Andric <[EMAIL PROTECTED]> wrote:
>
> > > This is not Django specific but it is framework relevant.  I thought
> > > this was a great writeup of features for any framework.  At least I am
> > > one person who likes the features of this web2py framework.
>
> > >http://mdp.cti.depaul.edu/examples/static/web2py_vs_others.pdf
>
> > > Web2py makes development happen faster because people can get up and
> > > running quickly.  I have only played with it enough to be amazed.  It
> > > allows the less technical disciplines like designers, journalists and
> > > web producers to start building or collaborating with web based
> > > database driven apps.
>
> > > The difficulty for my organization (News21) is the biggest technical
> > > problem which is integrating different technologies like flash and
> > > javascript.  It is difficult to do when each discipline has their own
> > > tools and technologies that don't integrate well. I think this is one
> > > step closer to making these different disciplines work better.
>
> > > --
> > > Milan
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Great article about web2py

2008-04-29 Thread Rajesh Dhawan

Hi,

> About Left Outer Joins:
>
> Would the use of a custom Q object in Django to perform a LEFT OUTER
> JOIN require programming in raw SQL or can it be done programming with
> the ORM API only? In the first case it does not count as explained in
> the document. In the second case I will be happy to amend the slides.

See the custom Q object code here if you're interested:
http://www.djangosnippets.org/snippets/274/

As you can see, it does not use raw SQL statements at all. It makes
use of a well-defined/documented Django ORM API (custom Q objects)
that helps a developer extend the ORM functionality.

>
> About ByteCode compilation:
>
> Although I agree with your observation below you are comparing apples
> with oranges. It is true that you can bytecode compile any python
> application but what about templates for example?

But that's because, as you said, we are comparing apples with oranges:
Django's templating language is not Python-based. So, a discussion of
Python byte-code compilation of a Django template is irrelevant.
Perhaps you should consider stating a conditional "Yes - available for
models and views but not for templates" against Django in that slide?

Django templates can be easily cached so that the parsing effort is
not required on every request. Template caching at various layers is
already documented as well.

> With one click,
> web2py collapses the template hierarchy for each page into a single py
> file, then bytecode compiles all models, controllers and templates and
> zips everything into a single plug-in package. The main purposes of
> this are ease of deplyment and speed since there is no more template
> parsing at runtime.

Django does not have this one-click feature.

As many owners of high-performance Django apps will attest, template
rendering in Django is already very fast especially with gracious use
of caching. So template parsing at each request is easily avoided.

>
> The web2py binary distribution is compiled with py2exe (for widnows)
> and py2app (for Mac). That is what cx_freeze can be compared with.
>
> Anyway, if you post an example of a Django bytecode compiled
> application and documentation on how to create and deploy it, I will
> amend my document to reflect that. If a feature is not tested and not
> documented it does not count.

As we both agree, byte code compilation is a Python feature and as
such it is well-documented and well-tested. The documentation for
deploying a pre-compiled Django app would be:

1. Precompile your Django app using:

import compileall
compileall.compile_dir(APP_ROOT_DIR_PATH, force=1)

2. Optionally delete *.py source files from the app.

3. Deploy it as you would deploy any other Django app. This is already
documented by Django.

>
> Let me say once again: I like Django and I took inspiration from it.

Welcome to the club :)

-Rajesh D
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Great article about web2py

2008-04-29 Thread Kumar McMillan

On Tue, Apr 29, 2008 at 11:14 AM, mdipierro <[EMAIL PROTECTED]> wrote:
>  Anyway, if you post an example of a Django bytecode compiled
>  application and documentation on how to create and deploy it, I will
>  amend my document to reflect that. If a feature is not tested and not
>  documented it does not count.

http://jerakeen.org/code/djangokit/
(but Mac only, and experimental)

includes a small bit of documentation:
http://code.google.com/p/djangokit/wiki/HomePage

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: change path to django project.

2008-04-29 Thread Karen Tracey
On Tue, Apr 29, 2008 at 12:39 PM, igor.potapenko <[EMAIL PROTECTED]>
wrote:

>
>   Hello!
>
> I installed new project in path1 (... django/nola). After that I make
> copy of this project to path2.
> Why it work with path1 and don't work with path2 ?
>
> I thought, that there is some options (path_var or smth) in
> setting.py, but I found no variables.
> Where is information about path's store?
>

Check the INSTALLED_APPS values in your settings.py.  It probably contains
an app that references the old pathname.

Karen

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Suggestions on UI (client side web) framework to complement Django

2008-04-29 Thread Ken

If you're going to use YUI, I'd check out Ojay (http://
ojay.othermedia.org/). Raw YUI is very verbose; Ojay is a convenience
layer on top of it.

-Ken


On Apr 29, 12:09 pm, ydjango <[EMAIL PROTECTED]> wrote:
> Thanks, Going ahead with YUI.
>
> Reasons for choosing yui
> 1) Free and from Yahoo. Well supported.
> 2) Grids
> 3) Datatable
>
> Surprising,  how very few frameworks support data tables and  how hard
> is to do data table. I would have expected this to be something out of
> box for all frameworks.
> Even Mainframes have it and had it for decades.
>
> Ashish
>
> On Apr 22, 6:23 am, desfrenes <[EMAIL PROTECTED]> wrote:
>
> > Don't miss JQuery !
>
> > On Apr 21, 8:33 pm, Rajesh Dhawan <[EMAIL PROTECTED]> wrote:
>
> > > On Apr 21, 2:13 pm,ydjango<[EMAIL PROTECTED]> wrote:
>
> > > > Django is a pretty good framework for server side web development.
>
> > > > client side Web development is also very time consuming and painful.
>
> > > > For Web Client side development, are there any good web ui frameworks
> > > > which can make developing look and feel and ui of a web site as easy
> > > > and as productive as Django does for server side.
>
> > > > Any client side frameworks Django developers have used to ease that
> > > > pain and save time?
> > > > Recommendations will be appreciated.
>
> > > In no particular order:
>
> > > ExtJS
> > > YUI
> > > Prototype
> > > Dojo
> > > 
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



change path to django project.

2008-04-29 Thread igor.potapenko

   Hello!

I installed new project in path1 (... django/nola). After that I make
copy of this project to path2.
Why it work with path1 and don't work with path2 ?

I thought, that there is some options (path_var or smth) in
setting.py, but I found no variables.
Where is information about path's store?




$19:26 [EMAIL PROTECTED] ...django/nola(0/2)$ python manage.py test
Creating test database...
Creating table auth_message
Creating table auth_group
Creating table auth_user
Creating table auth_permission
Creating table django_content_type
Creating table django_session
Creating table django_site
Creating table django_admin_log
Creating table polls_poll
Creating table polls_choice
Installing index for auth.Message model
Installing index for auth.Permission model
Installing index for admin.LogEntry model
Installing index for polls.Choice model
Loading 'initial_data' fixtures...
No fixtures found.

--
Ran 0 tests in 0.000s

OK
Destroying test database...

$19:25 [EMAIL PROTECTED] ...django/nola(0/2)$ ll
total 36
drwxr-xr-x 6 igor igor - 512 Apr 29 15:26 ./
drwxr-xr-x 6 igor igor - 512 Apr 29 12:13 ../
drwxr-xr-x 6 igor igor - 512 Apr 29 16:28 .svn/
-rw-r--r-- 1 igor igor - 0 Apr 29 10:46 __init__.py
-rw-r--r-- 1 igor igor - 145 Apr 29 10:47 __init__.pyc
-rw-r--r-- 1 igor igor - 159 Apr 29 10:46 __init__.pyo
-rw-r--r-- 1 igor igor - 546 Apr 29 10:46 manage.py
-rw-r--r-- 1 igor igor - 754 Apr 29 10:46 manage.pyo
drwxr-xr-x 3 igor igor - 512 Apr 29 10:46 nola/
drwxr-xr-x 3 igor igor - 512 Apr 29 16:28 polls/
-rw-r--r-- 1 igor igor - 2958 Apr 29 12:13 settings.py
-rw-r--r-- 1 igor igor - 2025 Apr 29 12:17 settings.pyc
-rw-r--r-- 1 igor igor - 1813 Apr 29 10:46 settings.pyo
-rw-r--r-- 1 igor igor - 64 Apr 29 12:17 svn-commit.tmp
drwxr-xr-x 5 igor igor - 512 Apr 29 12:17 template/
-rw-r--r-- 1 igor igor - 261 Apr 29 15:17 urls.py
-rw-r--r-- 1 igor igor - 360 Apr 29 15:26 urls.pyc
-rw-r--r-- 1 igor igor - 256 Apr 29 10:46 urls.pyo
$19:25 [EMAIL PROTECTED] ...django/nola(0/2)$ svn info
Path: .
URL: svn://localhost/nola/trunk
Repository Root: svn://localhost/nola
Repository UUID: 2c586082-b415-dd11-a18b-00c0df0c7a31
Revision: 33
Node Kind: directory
Schedule: normal
Last Changed Author: igor
Last Changed Rev: 33
Last Changed Date: 2008-04-29 16:28:10 +0400 (Tue, 29 Apr 2008)

$19:25 [EMAIL PROTECTED] ...django/nola(0/2)$ svn up
At revision 33.
$19:25 [EMAIL PROTECTED] ...django/nola(0/2)$ cd ..
$19:25 [EMAIL PROTECTED] ...python/django(0/2)$ mkdir nola2
$19:25 [EMAIL PROTECTED] ...python/django(0/2)$ cd nola2
$19:25 [EMAIL PROTECTED] ...django/nola2(0/2)$ svn co svn://localhost/nola/trunk
.
A manage.py
A urls.pyc
A __init__.pyo
A __init__.py
A settings.pyo
A settings.py
A __init__.pyc
A nola
A polls
A polls/views.pyo
A polls/views.py
A polls/__init__.pyo
A polls/__init__.py
A polls/__init__.pyc
A polls/models.pyo
A polls/models.py
A polls/urls.py
A polls/models.pyc
A settings.pyc
A template
A template/admin
A template/admin/change_list.html
A template/admin/template_validator.html
A template/admin/edit_inline_stacked.html
A template/admin/filter.html
A template/admin/object_history.html
A template/admin/search_form.html
A template/admin/pagination.html
A template/admin/field_line.html
A template/admin/edit_inline_tabular.html
A template/admin/base_site.html
A template/admin/auth
A template/admin/auth/user
A template/admin/auth/user/change_password.html
A template/admin/auth/user/add_form.html
A template/admin/change_list_results.html
A template/admin/500.html
A template/admin/invalid_setup.html
A template/admin/index.html
A template/admin/404.html
A template/admin/filters.html
A template/admin/change_form.html
A template/admin/login.html
A template/admin/delete_confirmation.html
A template/admin/base.html
A template/admin/submit_line.html
A template/admin/date_hierarchy.html
A template/polls
A template/polls/poll_list.html
A template/polls/results.html
A template/polls/detail.html
A template/polls/index.html
A template/polls/poll_detail.html
A urls.pyo
A urls.py
A manage.pyo
Checked out revision 33.
l% $19:25 [EMAIL PROTECTED] ...django/nola2(0/2)$ ll
total 34
drwxr-xr-x 6 igor igor - 512 Apr 29 19:25 ./
drwxr-xr-x 7 igor igor - 512 Apr 29 19:25 ../
drwxr-xr-x 6 igor igor - 512 Apr 29 19:25 .svn/
-rw-r--r-- 1 igor igor - 0 Apr 29 19:25 __init__.py
-rw-r--r-- 1 igor igor - 143 Apr 29 19:25 __init__.pyc
-rw-r--r-- 1 igor igor - 159 Apr 29 19:25 __init__.pyo
-rw-r--r-- 1 igor igor - 546 Apr 29 19:25 manage.py
-rw-r--r-- 1 igor igor - 754 Apr 29 19:25 manage.pyo
drwxr-xr-x 3 igor igor - 512 Apr 29 19:25 nola/
drwxr-xr-x 3 igor igor - 512 Apr 29 19:25 polls/
-rw-r--r-- 1 igor igor - 2953 Apr 29 19:25 settings.py
-rw-r--r-- 1 igor igor - 2020 Apr 29 19:25 settings.pyc
-rw-r--r-- 1 igor igor - 1813 Apr 29 19:25 settings.pyo
drwxr-xr-x 5 igor igor - 512 Apr 29 19:25 template/
-rw-r--r-- 1 igor igor - 261 Apr 29 19:25 urls.py
-rw-r--r-- 1 

I think psyco breaks Django trunk (post qs-rf merge)

2008-04-29 Thread Ken

I just updated my production site to latest trunk, and got hard 500
errors (not even going through the exception handler). Problem caused
by bad interaction of new Query objects and psyco. Disable psyco.

The exception was:

 File "/csc/django/db/models/sql/query.py", line 185, in clone
obj.__dict__.update(kwargs)
TypeError: descriptor '__dict__' for 'Empty' objects doesn't apply to
'Query' object

The problem appears to be due to the magic that function does of
changing the runtime class of an object.

I was using a Psyco middleware (from the wiki, using psyco.full()).

Just thought I'd give people a heads-up. Is psyco+Django dead?

-Ken

PS - The reason this didn't go through the error handling for me is
that I have a module-level model object retrieved from the database at
import time. Bad idea for a number of reasons, so it's gone in my
devel branch.

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



The Summer of Trance vol.3

2008-04-29 Thread furkan atacan
[image: alt] 

download  now 
The Summer of Trance vol.3 

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Eurovision Song Contest 2008 donwload now

2008-04-29 Thread furkan atacan
[image: Eurovision Song Contest 2008] 

Download now
Eurovision Song Contest 2008 

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Linkin Park AOL Full Concert

2008-04-29 Thread furkan atacan
[image: alt] 

Linkin Park AOL Full Concert donwload now 


sdc 

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Great article about web2py

2008-04-29 Thread mdipierro

About Left Outer Joins:

Would the use of a custom Q object in Django to perform a LEFT OUTER
JOIN require programming in raw SQL or can it be done programming with
the ORM API only? In the first case it does not count as explained in
the document. In the second case I will be happy to amend the slides.

About ByteCode compilation:

Although I agree with your observation below you are comparing apples
with oranges. It is true that you can bytecode compile any python
application but what about templates for example? With one click,
web2py collapses the template hierarchy for each page into a single py
file, then bytecode compiles all models, controllers and templates and
zips everything into a single plug-in package. The main purposes of
this are ease of deplyment and speed since there is no more template
parsing at runtime.

The web2py binary distribution is compiled with py2exe (for widnows)
and py2app (for Mac). That is what cx_freeze can be compared with.

Anyway, if you post an example of a Django bytecode compiled
application and documentation on how to create and deploy it, I will
amend my document to reflect that. If a feature is not tested and not
documented it does not count.

Let me say once again: I like Django and I took inspiration from it.
Great work guys!

Massimo

On Apr 29, 10:47 am, ydjango <[EMAIL PROTECTED]> wrote:
> Article states...
> "Web2py and J2ee are the only frameworks that allow byte code compile
> applications and distribute them in closed source"
>
> I read somewhere that "cx_Freeze" can be used to do the same for any
> python app including those based on Django . I have not used
> cx_freeze, but intend to do so soon as my code is closed source/
> commercial.
>
> What am I missing here?
>
> any better alternatives to cx_freeze?
>
> Ashish
>
> On Apr 28, 10:19 am, Milan Andric <[EMAIL PROTECTED]> wrote:
>
> > This is not Django specific but it is framework relevant.  I thought
> > this was a great writeup of features for any framework.  At least I am
> > one person who likes the features of this web2py framework.
>
> >http://mdp.cti.depaul.edu/examples/static/web2py_vs_others.pdf
>
> > Web2py makes development happen faster because people can get up and
> > running quickly.  I have only played with it enough to be amazed.  It
> > allows the less technical disciplines like designers, journalists and
> > web producers to start building or collaborating with web based
> > database driven apps.
>
> > The difficulty for my organization (News21) is the biggest technical
> > problem which is integrating different technologies like flash and
> > javascript.  It is difficult to do when each discipline has their own
> > tools and technologies that don't integrate well. I think this is one
> > step closer to making these different disciplines work better.
>
> > --
> > Milan
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Suggestions on UI (client side web) framework to complement Django

2008-04-29 Thread ydjango

Thanks, Going ahead with YUI.

Reasons for choosing yui
1) Free and from Yahoo. Well supported.
2) Grids
3) Datatable

Surprising,  how very few frameworks support data tables and  how hard
is to do data table. I would have expected this to be something out of
box for all frameworks.
Even Mainframes have it and had it for decades.

Ashish

On Apr 22, 6:23 am, desfrenes <[EMAIL PROTECTED]> wrote:
> Don't miss JQuery !
>
> On Apr 21, 8:33 pm, Rajesh Dhawan <[EMAIL PROTECTED]> wrote:
>
> > On Apr 21, 2:13 pm,ydjango<[EMAIL PROTECTED]> wrote:
>
> > > Django is a pretty good framework for server side web development.
>
> > > client side Web development is also very time consuming and painful.
>
> > > For Web Client side development, are there any good web ui frameworks
> > > which can make developing look and feel and ui of a web site as easy
> > > and as productive as Django does for server side.
>
> > > Any client side frameworks Django developers have used to ease that
> > > pain and save time?
> > > Recommendations will be appreciated.
>
> > In no particular order:
>
> > ExtJS
> > YUI
> > Prototype
> > Dojo
> > 
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Great article about web2py

2008-04-29 Thread ydjango

Article states...
"Web2py and J2ee are the only frameworks that allow byte code compile
applications and distribute them in closed source"

I read somewhere that "cx_Freeze" can be used to do the same for any
python app including those based on Django . I have not used
cx_freeze, but intend to do so soon as my code is closed source/
commercial.

What am I missing here?

any better alternatives to cx_freeze?

Ashish

On Apr 28, 10:19 am, Milan Andric <[EMAIL PROTECTED]> wrote:
> This is not Django specific but it is framework relevant.  I thought
> this was a great writeup of features for any framework.  At least I am
> one person who likes the features of this web2py framework.
>
> http://mdp.cti.depaul.edu/examples/static/web2py_vs_others.pdf
>
> Web2py makes development happen faster because people can get up and
> running quickly.  I have only played with it enough to be amazed.  It
> allows the less technical disciplines like designers, journalists and
> web producers to start building or collaborating with web based
> database driven apps.
>
> The difficulty for my organization (News21) is the biggest technical
> problem which is integrating different technologies like flash and
> javascript.  It is difficult to do when each discipline has their own
> tools and technologies that don't integrate well. I think this is one
> step closer to making these different disciplines work better.
>
> --
> Milan
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Django Registration URLs

2008-04-29 Thread Szaijan

Thanks Nathaniel.

Adding the line to my urls.py just before the include works.

MJ

On Apr 29, 5:00 am, Nathaniel Whiteinge <[EMAIL PROTECTED]> wrote:
> On Apr 28, 6:30 pm, Szaijan <[EMAIL PROTECTED]> wrote:
>
> > The base urls function properly, i.e. /visionary/accounts/register
> > goes where it is supposed to, but when resulting URLs are called, they
> > all get called as /accounts/register/complete instead of /visionary/
> > accounts/register/complete.
>
> Look at the view [1] in django-registration where that is happening.
> That particular url can be overridden by passing a new value to the
> ``success_url`` parameter. If you don't want to modify your checkout
> of django-registration (which you shouldn't!), remember that Django
> stops at the first matching url, so before the line in your urlconf
> where you include ``registration.urls``, put something like the
> following::
>
>     url(r'^visionary/accounts/register/$', register, {'success_url': '/
> visionary/accounts/register/complete'}, name='registration_register'),
>
> .. [1]http://code.google.com/p/django-registration/source/browse/trunk/regi...
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Great article about web2py

2008-04-29 Thread Rajesh Dhawan

Here are a couple of comments on your slides:

1. Slide: "web2py and j2ee are the only frameworks that allow to byte
code compile applications and distribute them in closed source."

You can distribute Django applications too with just the .pyc/.pyo
compiled files instead of the .py sources. Furthermore, pre-compiling
any Python app takes only a couple of lines of code in a Python shell:
http://effbot.org/librarybook/compileall.htm

2. Slide: "Left Outer Joins: Django: no"

Left outer joings are possible via Django's custom Q objects
interface. See: 
http://blog.michaeltrier.com/2007/8/12/finding-lookup-items-that-are-not-used

So, your slide should say something like: "Yes: via a custom Q
object".

-Rajesh D

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: making a stand-alone program call a django app directly

2008-04-29 Thread Andrew D. Ball

Perfect!  Thanks,
Andrew

On Mon, Apr 28, 2008 at 03:18:45PM -0700, [EMAIL PROTECTED] wrote:
> 
> http://www.b-list.org/weblog/2007/sep/22/standalone-django-scripts/
> 
> On Apr 28, 5:10 pm, "Andrew D. Ball" <[EMAIL PROTECTED]> wrote:
> > Greetings.
> >
> > I'm working on a Django application and would like
> > to be able to write a stand-alone Python program
> > that calls my Django application directly.
> >
> > Accomplishing like seems to require me to import
> > the project settings file, which I've figured out
> > how to do.  However, I'm still looking for how
> > to satisfy the rest of the requirements (which
> > are probably what 'python manage.py shell'
> > does for me...).
> >
> > I have the Python script in the application's
> > directory and am using some silly manipulation
> > of sys.path to import the module named 'settings'
> > in the previous directory (which is the Django
> > project directory).
> >
> > It looks like I need to set some environment
> > variables.  Here's the error message I'm getting
> > when I try to import the application's models:
> >
> > [EMAIL PROTECTED]:$ python batch_process.py
> > Traceback (most recent call last):
> >   File "batch_process.py", line 16, in ?
> >     import models
> >   File 
> > "/home/nfs/aball/devel/power_reg/trunk/power_reg_2/pr2_core_services/models.py",
> >  line 6, in ?
> >     from django.db import models
> >   File "/var/lib/python-support/python2.4/django/db/__init__.py", line 7, 
> > in ?
> >     if not settings.DATABASE_ENGINE:
> >   File "/var/lib/python-support/python2.4/django/conf/__init__.py", line 
> > 28, in __getattr__
> >     self._import_settings()
> >   File "/var/lib/python-support/python2.4/django/conf/__init__.py", line 
> > 53, in _import_settings
> >     raise EnvironmentError, "Environment variable %s is undefined." % 
> > ENVIRONMENT_VARIABLE
> > EnvironmentError: Environment variable DJANGO_SETTINGS_MODULE is undefined.
> >
> > Anybody know how to do this?
> >
> > Thanks for your help.
> >
> > Peace,
> > Andrew
> > =
> > Andrew D. Ball <[EMAIL PROTECTED]>
> > software engineer
> > American Research Institute, Inc.
> > 

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Session/Varibale and HttpResponseRedirect help please

2008-04-29 Thread Doug Van Horn

You may want to make sure your browser cache isn't showing you an old
page.  Hit F5 a few times, and also make sure your browser settings
have the cache at 0MB, so it doesn't cache anything.

After that I'd start by adding some print statements after you add the
variable to the session and right before you push the variable into
the template, to see if it's making it through the redirect.

If it is, then the issue is with your template, if it's not then the
issue is with the session.


Doug Van Horn
http://maydigital.com/

On Apr 29, 12:04 am, Brandon Taylor <[EMAIL PROTECTED]> wrote:
> Hello everyone,
>
> I'm doing a redirect after a form to a "thank you" page, which I would
> like to personalize with some of the data from the form. I've tried
> setting a session as such:
>
> ### views.py code
>
> if form.is_valid():
> first_name = form.cleaned_data['first_name']
> request.session['first_name'] = first_name
>
> return HttpResponseRedirect('training/thanks/')
>
> But, when I try to output the value in the "thanks" template, as such:
>
> def thanks(request):
> first_name = request.session.get('first_name')
> return render_to_response('thanks.html', 'first_name' :
> first_name)
>
> I get nothing. I've checked to make sure that the sessions middleware,
> and the sessions app are included in my settings.py file. What am I
> doing wrong? Help appreciated!
>
> Brandon
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Queryset-refactor branch has been merged into trunk

2008-04-29 Thread Kevin Monceaux


On Sun, 27 Apr 2008, simonbun wrote:

> So qs-rf hit trunk and was merged into nfa on the same day! That's
> excellent news, both for me and for django. Thanks so much for your
> efforts Malcolm (and Brosner for the quick merge)!

I'll second that.  I've been running against the nfa branch.  I just 
updated to pull in the qs-rf changes.  I only had to make a couple of 
minor code changes to my site in cases where I was ordering by fields from 
another model.  I like the new syntax much better than having to use the 
underlying table names.  Congratulations to all involved!!



Kevin
http://www.RawFedDogs.net
http://www.WacoAgilityGroup.org
Bruceville, TX

Si hoc legere scis nimium eruditionis habes.
Longum iter est per praecepta, breve et efficax per exempla!!!


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Great article about web2py

2008-04-29 Thread Rajesh Dhawan



On Apr 29, 9:57 am, mdipierro <[EMAIL PROTECTED]> wrote:
> Actually, the document is not linked to the web page yet because I am
> hoping to get comments and corrections from the different communities.
> I admit bias in the choice of comparables and topics but I decide the
> target audience. Nevertheless I would like to the document to be
> accurate. If I say something wrong about Django please correct me at
> [EMAIL PROTECTED] Thanks.

Is there an HTML version of this document by any chance?
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: passing form to base template

2008-04-29 Thread skunkwerk

should do the trick, thanks

On Apr 28, 7:49 pm, "Ronny Haryanto" <[EMAIL PROTECTED]> wrote:
> On Tue, Apr 29, 2008 at 9:33 AM, skunkwerk <[EMAIL PROTECTED]> wrote:
> >  I've got two forms included in my base template, from which a few
> >  others inherit.  Currently I'm passing a newly-constructed form to
> >  each of the inherited templates in the functions using
> >  render_to_response, like so:
>
> >  return render_to_response('contact.html', {'form': form,  'suggform':
> >  suggform,  'searchform':searchform })
>
> >  it's getting tedious though... is there some way I can pass the forms
> >  to only the base template, and have all the other inherited templates
> >  get the forms too?  the default forms are all static - no dynamic
> >  values.
>
> Would a custom context processor work for 
> you?http://www.djangoproject.com/documentation/templates_python/#subclass...
>
> Ronny
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: class in models.py 'not defined' exception

2008-04-29 Thread skunkwerk

thanks!
  that was exactly the problem.  after i removed the django-created
tables from models.py, it started working again.

On Apr 28, 10:57 pm, "Karen Tracey" <[EMAIL PROTECTED]> wrote:
> On Tue, Apr 29, 2008 at 1:31 AM, skunkwerk <[EMAIL PROTECTED]> wrote:
>
> > thanks karen,
> >   i think my views.py file is the source of the error, as it tries to
> > import from winebago.models like so:
>
> > from winebago.models import Models
>
> > (Models is defined after AuthPermission in models.py, and there are 3
> > other tables defined before AuthPermission in models.py - none of
> > which raise an error).  As far as I can tell, AuthPermission was
> > created by the authentication module; i've commented out everything
> > else in my views.py file after the 'from winebago.models import
> > Models', so it's not like I'm trying to call AuthPermission without it
> > being defined.  these are the only lines in views.py:
>
> Wait, why are you including in your models.py file definitions for classes
> created by Django-provided components?  You don't need to do that.  If you
> need to use an auth model, import it from django.contrib.auth.models or
> wherever it is defined.  You should not duplicate the model definitions for
> Django-provided models.  I'd get rid of everything in your models file that
> is not related to one of your own application's models, and move on from
> there.
>
> Karen
>
>
>
> > from django.shortcuts import render_to_response
> > from django.http import HttpResponseRedirect
> > from django.core.urlresolvers import reverse
> > from winebago.models import Models
>
> > here is my urls.py file (i commented everything out to figure out
> > where the error was from):
>
> > from django.conf.urls.defaults import *
> > from winebago.views import homepage
> > urlpatterns = patterns('',
> > )
>
> > am i doing something wrong?
>
> > On Apr 28, 9:11 pm, "Karen Tracey" <[EMAIL PROTECTED]> wrote:
> > > On Mon, Apr 28, 2008 at 11:54 PM, skunkwerk <[EMAIL PROTECTED]> wrote:
>
> > > > I've been struggling with this error for the past hour.
>
> > > > Error while importing URLconf 'winebago.urls': name 'AuthPermission'
> > > > is not defined
> > > > Exception Location: /usr/lib/python2.5/site-packages/django/core/
> > > > urlresolvers.py in _get_urlconf_module, line 255
>
> > > > my models.py was generated by: ./manage.py inspectdb > models.py
>
> > > > the relevant lines from models.py:
> > > > class AuthPermission(models.Model):
> > > >    id = models.IntegerField(primary_key=True)
> > > >    name = models.CharField(max_length=150)
> > > >    content_type = models.ForeignKey(DjangoContentType)
> > > >    codename = models.CharField(unique=True, max_length=300)
> > > >    class Meta:
> > > >        db_table = u'auth_permission'
>
> > > > i can't figure out why this is happening, as i didn't change anything
> > > > to do with the models.
>
> > > The problem is in your winebago urls.py file.  You are apparently
> > referring
> > > to AuthPermission without having first imported it (via something like
> > from
> > > winebago.models import AuthPermission).  Without an import Python
> > doesn't
> > > know where to find the definition for something that has not already
> > been
> > > defined in the file it is processing.
>
> > > Karen
>
>
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: two choices questions

2008-04-29 Thread dimrub

I finally solved #2 with plain vanilla 0.96. Basically, it involves
overriding the fields property of the AdminOptions for the application
in question (similar to what's described here: 
http://lukeplant.me.uk/blog.php?id=1107301634)
by a function, that looks up the necessary info, and replaces the
field's _choices property with the options sorted to my liking. I can
provide the necessary code samples, if anyone is interested.

On Apr 25, 11:57 pm, dimrub <[EMAIL PROTECTED]> wrote:
> 2. Is there a way to sort the order of the choices dynamically (e.g.,
> based on the current user's history of activity)? I would like to have
> the most commonly chosen options to appear first, then I would like to
> have a separator followed by the rest of the choices.

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Choosing database settings based on request?

2008-04-29 Thread dimrub

What you can try out is the following approach (a variation of which I
use in order to customize the data being presented based on the
identity of the currently logged in user).

1. Create a middleware that pushes the relevant info from the request
into a thread local storage.
2. Create a custom manager, that looks up this info and uses it to
create a custom connection to the DB.

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Great article about web2py

2008-04-29 Thread mdipierro

Actually, the document is not linked to the web page yet because I am
hoping to get comments and corrections from the different communities.
I admit bias in the choice of comparables and topics but I decide the
target audience. Nevertheless I would like to the document to be
accurate. If I say something wrong about Django please correct me at
[EMAIL PROTECTED] Thanks.

Massimo

On Apr 29, 1:09 am, simonbun <[EMAIL PROTECTED]> wrote:
> It's beyond me why they would classify PHP as a web framework, and on
> top of that, include CakePHP in the comparison as well... Other than
> that, it's hardly an independant and unbiased review, coming from the
> authors of web2py themselves.
> A thing that does seem handy is their integrated ticketing system.
> Seems like a day well spent for me to develop something similar for
> Django.
>
> regards,
> Simon.
>
> On Apr 28, 7:19 pm, Milan Andric <[EMAIL PROTECTED]> wrote:
>
> > This is not Django specific but it is framework relevant.  I thought
> > this was a great writeup of features for any framework.  At least I am
> > one person who likes the features of this web2py framework.
>
> >http://mdp.cti.depaul.edu/examples/static/web2py_vs_others.pdf
>
> > Web2py makes development happen faster because people can get up and
> > running quickly.  I have only played with it enough to be amazed.  It
> > allows the less technical disciplines like designers, journalists and
> > web producers to start building or collaborating with web based
> > database driven apps.
>
> > The difficulty for my organization (News21) is the biggest technical
> > problem which is integrating different technologies like flash and
> > javascript.  It is difficult to do when each discipline has their own
> > tools and technologies that don't integrate well. I think this is one
> > step closer to making these different disciplines work better.
>
> > --
> > Milan
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: urls stumping me

2008-04-29 Thread Peter of the Norse

That's totally it. The reverse function is fairly stupid (for speed),  
and it always goes for the first match. You've got two URLS with the  
same view. That's when it's time for:
http://www.djangoproject.com/documentation/url_dispatch/#naming-url-patterns


> No, I don't think thats it.  Like I said, if I reverse the elections
> and precincts url in the urls.py file (the main one), it happens
> exactly opposite.  Whichever one is listed first in the urls.py file
> works, while the other one doesn't.

>> On Apr 18, 1:14 pm, jeffself <[EMAIL PROTECTED]> wrote:
>>
>>> My project contains two apps, elections and precincts.  My main
>>> urls.py file looks like this:
>>
>>> from django.conf.urls.defaults import *
>>
>>> urlpatterns = patterns('',
>>>   (r'^precincts/', include('precincts.urls')),
>>>   (r'^elections/', include('elections.urls')),
>>>   (r'^admin/', include('django.contrib.admin.urls')),
>>> )
>>
>>> The urls.py file under my precincts app looks like this:



>>> urlpatterns += patterns('django.views.generic.list_detail',
>>>   (r'^(?P[\w-]+)/$', 'object_detail',  
>>> precinct_detail_info),
>>> )
>>
>>> And my urls.py file under my elections app looks like this:




>>> urlpatterns += patterns('django.views.generic.list_detail',
>>>   (r'^(?P[\w-]+)/$', 'object_detail', election_detail_info),
>>> )

-- 
Peter of the Norse

-- 
Peter of the Norse


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Choosing database settings based on request?

2008-04-29 Thread Tim Chase

While playing around, I found myself wandering down this path, 
wondering if anybody else had been here before.

In summary, I'm wondering if there's an easy way to jockey my DB 
settings based on information completely self-contained within 
the request.

In longer detail...

In this case, it was the subdomain, so one might have

   customer1.example.com -> customer1_db
   customer2.example.com -> customer2_db

but it would translate fairly well to a top-level target like

   example.com/customer1/ -> customer1_db
   example.com/customer2/ -> customer2_db

I don't know enough yet about the internals of Django's DB 
connecting-calls and the timing involved there.

One option is to have a separate settings.py for every customer, 
but as customers are added, this grows unwieldy especially as the 
code base remains the same.  Ideally, only a handful of Django 
processes would be needed to maintain as many DBs have been 
established.

My first idea at a hack involved a middleware that poked at the 
django.settings module but this is a dangerous sort of sport if I 
rely on it and the core devs aren't expecting crazy folks to do 
something like this.  From digging at the code a little, it 
appears that the DB-connection is made on first request via a 
call to cursor(), and that connection cached for the lifetime of 
the DatabaseWrapper object (which seems to be indefinitely the 
lifespan of the Django/Python code itself).  Thus, monkeying with 
the django.settings file wouldn't work predictably unless I also 
monkeyed with the db.connection.connection, something like


   if db.connection.connection is not None:
 # manage transaction(s) here?
 db.connection.connection.close()
 db.connection.connection = None
   settings.DATABASE_NAME = get_db_name_from_request(request)

Do any developers better versed in the internals of Django see 
any obvious flaws in this line of reasoning?  Other than the 
one-request-means-one-connect overhead where currently the 
connection-overhead is only incurred once per Django-process-launch.

Appreciating your input,

-tim




--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Rendering specific widgets of a MultiWidget

2008-04-29 Thread Bram Duvigneau

Hello,

I'm using the DurationField from
http://gulopine.gamemusic.org/2007/nov/03/storing-passages-of-time/

This is working fine, but the included widget shows text fields for
days, hours, minutes, seconds and microseconds. I would like to have
hours:minutes. The best solution seems to be that I just render two
fields of the widget, I could copy the widget and modify this in code,
but that doesn't seem nice to me. So, here's my question: how could I
render specific widgets of a MultiWidget in my template?

Bram

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Django Registration URLs

2008-04-29 Thread Nathaniel Whiteinge

On Apr 28, 6:30 pm, Szaijan <[EMAIL PROTECTED]> wrote:
> The base urls function properly, i.e. /visionary/accounts/register
> goes where it is supposed to, but when resulting URLs are called, they
> all get called as /accounts/register/complete instead of /visionary/
> accounts/register/complete.

Look at the view [1] in django-registration where that is happening.
That particular url can be overridden by passing a new value to the
``success_url`` parameter. If you don't want to modify your checkout
of django-registration (which you shouldn't!), remember that Django
stops at the first matching url, so before the line in your urlconf
where you include ``registration.urls``, put something like the
following::

url(r'^visionary/accounts/register/$', register, {'success_url': '/
visionary/accounts/register/complete'}, name='registration_register'),


.. [1] 
http://code.google.com/p/django-registration/source/browse/trunk/registration/views.py?r=142#49
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: object.filter and accessing items

2008-04-29 Thread lars

http://code.djangoproject.com/ticket/7121 :-)
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Tutorial: __str__() problems

2008-04-29 Thread Juanjo Conti

Try with this code:

def __str__(self):
return "testing"

Does that work?

-- 
Juanjo Conti

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: sql_queries does not include all the sql statements

2008-04-29 Thread Simon Willison

On Apr 29, 9:31 am, leopay <[EMAIL PROTECTED]> wrote:
> oh,sorry ,I made a mistake,it is Entry.objects.all()[0:1]
> I means when I write like this Entry.objects.all()[0:1],I cannot find the
> this raw sql like 'select col_name from entry_table limit 1' in
> sql_queries,but if I write like this Entry.objects.all()[0],I could the sql
> in sql_queries when use django.core.context_processors.debug

This is due to the way QuerySets are lazily evaluated. A QuerySet will
not result in the execution of SQL until the last possible moment. You
can experiment with this in ./manage.py shell:

>>> from django.db import connection
>>> a = models.Question.objects.all()
>>> connection.queries
[]
>>> print a
[]
>>> connection.queries
[{'sql': u'SELECT `blah_question`.`id`,`blah_question`.`question` FROM
`blah_question`',
  'time': '0.001'}]

In the above case, the SQL was not executed until the queryset was
printed (which requires the database results).

In your case though:

>>> from django.db import connection
>>> a = models.Question.objects.all()[0]
>>> connection.queries
[{'sql': u'SELECT `blah_question`.`id`,`blah_question`.`question` FROM
`blah_question` LIMIT 1 ',
  'time': '0.001'}]

Accessing [0] on the QuerySet forces it to be executed, so the SQL
query has to be run.

Using the slice [0:1] does NOT cause the query to be run straight
away; instead, it adds limit and potentially offset clauses to the SQL
statement that is being prepared by the QuerySet.

Hope that clears things up,

Simon
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: object.filter and accessing items

2008-04-29 Thread lars

I was having a look at the code in order to find out what is going on.
First thing I noticed is the set_limit method of sql/query.py. The
high_mark is computed as follows:

self.high_mark = min(self.high_mark, self.low_mark + high)

Shouldn't it be max instead of min? Just wondering.

After I changed it to max the query looked ok (SELECT ... LIMIT 2).
Yet, accessing index 1 will still hit the database: SELECT ... LIMIT 1
OFFSET 1. It seems as if the result_cache doesn't get filled properly?
At least QuerySet.__get_item__ gets called twice. First for the query
itself (Article.objects.filter(id__lte=article_id).order_by('-id')
[0:2] ) and again for accessing the concrete entry by index
(result[1]).

Yours,
Lars




--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: generic delete_object issue on Firefox (redirect bug)

2008-04-29 Thread yml

Hello Koenb,
Thank you very much your workaround is working like a charm. I have
pasted below an example. In case someone else look for a solution to
this problem in the future. However this is close to witchcraft art. I
do not understand how FF can be aware that I am doing something in my
view with request.POST or not.
Does anyone has a rational explanation on why this work?

---8<---
@login_required()
def survey_delete(request,slug):
# TRICK: The following line does not have any logical explination
# except than working around a bug in FF. It has been suggested
there
# 
http://groups.google.com/group/django-users/browse_thread/thread/e6c96ab0538a544e/0e01cdda3668dfce#0e01cdda3668dfce
request_post = request.POST.copy()
return delete_object(request, slug=slug,
**{"model":Survey,
 "post_delete_redirect": "/survey/editable/",
 "template_object_name":"survey",
 "login_required": True,
 'extra_context': {'title': _('Delete survey')}
})
--->8---
Thank you

--yml

On Apr 28, 10:42 pm, koenb <[EMAIL PROTECTED]> wrote:
> The problem is FF does not like it if you do not consume the POST
> data.
> Just add the line
> request.POST
> somewhere in your view before redirecting.
>
> Koen
>
> On 28 apr, 17:33, yml <[EMAIL PROTECTED]> wrote:
>
> > Hello,
> > I noticed a very strange behavior with the generic view called :
> > "delete_object". The symptom is the following :
> >   * Firefox return an error message
> > ---8<---
> > The connection was reset
>
> > The connection to the server was reset while the page was loading.
>
> > *   The site could be temporarily unavailable or too busy. Try
> > again in a few
> >   moments.
>
> > *   If you are unable to load any pages, check your computer's
> > network
> >   connection.
>
> > *   If your computer or network is protected by a firewall or
> > proxy, make sure
> >   that Firefox is permitted to access the Web.
> > --->8---
> > It seems that the bug is in Firefox code. The same code is working
> > fine on IE 6.0 and Opéra, I am testing this on windows.
>
> > My code look like this (extracted form urls.py):
> > ---8<---
> >  url(r'^delete/(?P[-\w]+)/$', delete_object,
> > {"model":Survey,
> >  "post_delete_redirect": "/survey/editable/",
> >  "template_object_name":"survey",
> >  "login_required": True,
> >  'extra_context': {'title': _('Delete survey')}
> > },
> > name='survey-delete'),
> > --->8---
> > It would be nice if someone could help me with a workaround or a
> > solution.
>
> > Should I report issues in the django bug tracker ?
> > Thank you for your help.
> > --yml
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Tutorial: __str__() problems

2008-04-29 Thread Jarek Zgoda

[EMAIL PROTECTED] napisał(a):

> I'm just going through the mysite tutorial and can't seem to get the
> __str__() method to work when adding it to the two classes, I still
> get []. This happened before and I'm not really
> sure what fixed it. I'm running .096
> 
> polls/models.py:
> from django.db import models
> import datetime
> 
> class Poll(models.Model):
> question = models.CharField(maxlength=200)
> pub_date = models.DateTimeField('date published')
> def __str__(self):
>   return self.question
> def was_published_today(self):
> return self.pub_date.date() == datetime.date.today()
> 
> class Choice(models.Model):
>   poll = models.ForeignKey(Poll)
>   choice = models.CharField(maxlength=200)
>   votes = models.IntegerField()
>   def __str__(self):
>  return self.choice

This code is valid and it should work as advertized (partially because
it works in hundreds of other instances).

-- 
Jarek Zgoda
Skype: jzgoda | GTalk: [EMAIL PROTECTED] | voice: +48228430101

"We read Knuth so you don't have to." (Tim Peters)

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Tutorial: __str__() problems

2008-04-29 Thread Jarek Zgoda

shabda napisał(a):
> Though __str__ should work here, until you can get this working, try
> writing __unicode__ method
> 
> [EMAIL PROTECTED] wrote:
>> Hello,
>> I'm just going through the mysite tutorial and can't seem to get the
>> __str__() method to work when adding it to the two classes, I still
>> get []. This happened before and I'm not really
>> sure what fixed it. I'm running .096

0.96 is the key here -- this version is not unicode-aware, so __str__
performs good.

-- 
Jarek Zgoda
Skype: jzgoda | GTalk: [EMAIL PROTECTED] | voice: +48228430101

"We read Knuth so you don't have to." (Tim Peters)

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Disabling and clearing cache

2008-04-29 Thread Julien

Just after sending this post I had an idea. I could just add a
CACHE_ENABLED boolean setting and test it before pulling out the
cached version. That's for disabling cache.

Any idea about clearing?

I gorgot to mention that I'm using file caching. Do I necessarily have
to manually delete those files, or can Django do that for me somehow?

On Apr 29, 6:25 pm, Julien <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I'm using cache.get() and .set() so do fine-grained caching of my
> site. Works great, but I'd find convenient to be able to force
> clearing the cache or disabling it altogether at will? Is there a
> command in Django or a trick that could do that?
>
> Thanks a lot,
>
> Julien
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: sql_queries does not include all the sql statements

2008-04-29 Thread leopay
oh,sorry ,I made a mistake,it is Entry.objects.all()[0:1]
I means when I write like this Entry.objects.all()[0:1],I cannot find the
this raw sql like 'select col_name from entry_table limit 1' in
sql_queries,but if I write like this Entry.objects.all()[0],I could the sql
in sql_queries when use django.core.context_processors.debug

On Tue, Apr 29, 2008 at 4:11 PM, Amit Ramon <[EMAIL PROTECTED]> wrote:

>
> * leopay <[EMAIL PROTECTED]> [2008-04-29 00:07 -0700]:
> >
> > I use django.core.context_processors.debug to see the sql_queries in
> > template.
> > The raw sql of query
> >
> > Entry.objects.all()[0,1]
> >
> > does not in the sql_queries,but if I change the query like this
> >
> > Entry.objects.all()[0]
> >
> > and then the sql is in the sql_queries. why?
> >
> I didn't understand the problem completely, but the syntax of your first
> example is incorrect. You probably meant ...[0:1] - this is the syntax for
> slicing.
>
> If this doesn't help, try to provide more details.
>
> --- Amit
>
> >
>

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Tutorial: __str__() problems

2008-04-29 Thread shabda

Though __str__ should work here, until you can get this working, try
writing __unicode__ method

[EMAIL PROTECTED] wrote:
> Hello,
> I'm just going through the mysite tutorial and can't seem to get the
> __str__() method to work when adding it to the two classes, I still
> get []. This happened before and I'm not really
> sure what fixed it. I'm running .096
>
> polls/models.py:
> from django.db import models
> import datetime
>
> class Poll(models.Model):
> question = models.CharField(maxlength=200)
> pub_date = models.DateTimeField('date published')
> def __str__(self):
>   return self.question
> def was_published_today(self):
> return self.pub_date.date() == datetime.date.today()
>
> class Choice(models.Model):
>   poll = models.ForeignKey(Poll)
>   choice = models.CharField(maxlength=200)
>   votes = models.IntegerField()
>   def __str__(self):
>  return self.choice
>
> Thanks for any help,
> Jason
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Tutorial: __str__() problems

2008-04-29 Thread shabda

Though __str__ should work here, until you can get this working, try
writing __unicode__ method

[EMAIL PROTECTED] wrote:
> Hello,
> I'm just going through the mysite tutorial and can't seem to get the
> __str__() method to work when adding it to the two classes, I still
> get []. This happened before and I'm not really
> sure what fixed it. I'm running .096
>
> polls/models.py:
> from django.db import models
> import datetime
>
> class Poll(models.Model):
> question = models.CharField(maxlength=200)
> pub_date = models.DateTimeField('date published')
> def __str__(self):
>   return self.question
> def was_published_today(self):
> return self.pub_date.date() == datetime.date.today()
>
> class Choice(models.Model):
>   poll = models.ForeignKey(Poll)
>   choice = models.CharField(maxlength=200)
>   votes = models.IntegerField()
>   def __str__(self):
>  return self.choice
>
> Thanks for any help,
> Jason
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Custom Q object for Full-text

2008-04-29 Thread Grupo Django

HI,
I'm trying to make a custom Q-like object as Malcolm recommended me. I
have this code:
class FT:
def add_to_query( self, query, used_aliases ):
select={
'rank': "ts_rank_cd(tsv, query, 32)",
}
query.add_extra( select,None,('tsv @@
query',),None,None,None )

and I'm stuck with it. It's hard to understand the Query class
quickly.
I need a sql clause like this:
SELECT * FROM table, plainto_tsquery( %s ) as query WHERE tsv @@
query;
This is the simplest one.
I can't add 'plainto_tsquery( %s )' to extra tables since it renders
the content between double quotes.

Also, I try to use this class like the Q object:
items = Model.objects.filter( FT() )
FT should have a string argument to fill the content inside:
plainto_tsquery( %s )

Problems:
1.- This code fails. I get a TypeError, unpack non-sequence in line
914 of query.py:
arg, value = filter_expr
2.- I don't know how I can add: plainto_tsquery( %s ) to the sql
clause and make it work, it shouldn't be quoted.
3.-How can I pass the content to: plainto_tsquery( %s ) in order to
get: 'plainto_tsquery( 'words I want to search' )?

I'd appreciate your help.

Thank you.
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Disabling and clearing cache

2008-04-29 Thread Julien

Hi,

I'm using cache.get() and .set() so do fine-grained caching of my
site. Works great, but I'd find convenient to be able to force
clearing the cache or disabling it altogether at will? Is there a
command in Django or a trick that could do that?

Thanks a lot,

Julien
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Tutorial: __str__() problems

2008-04-29 Thread [EMAIL PROTECTED]

Hello,
I'm just going through the mysite tutorial and can't seem to get the
__str__() method to work when adding it to the two classes, I still
get []. This happened before and I'm not really
sure what fixed it. I'm running .096

polls/models.py:
from django.db import models
import datetime

class Poll(models.Model):
question = models.CharField(maxlength=200)
pub_date = models.DateTimeField('date published')
def __str__(self):
return self.question
def was_published_today(self):
return self.pub_date.date() == datetime.date.today()

class Choice(models.Model):
poll = models.ForeignKey(Poll)
choice = models.CharField(maxlength=200)
votes = models.IntegerField()
def __str__(self):
   return self.choice

Thanks for any help,
Jason
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: sql_queries does not include all the sql statements

2008-04-29 Thread Amit Ramon

* leopay <[EMAIL PROTECTED]> [2008-04-29 00:07 -0700]:
> 
> I use django.core.context_processors.debug to see the sql_queries in
> template.
> The raw sql of query
> 
> Entry.objects.all()[0,1]
> 
> does not in the sql_queries,but if I change the query like this
> 
> Entry.objects.all()[0]
> 
> and then the sql is in the sql_queries. why?
> 
I didn't understand the problem completely, but the syntax of your first 
example is incorrect. You probably meant ...[0:1] - this is the syntax for 
slicing.

If this doesn't help, try to provide more details.

--- Amit

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Regression with QS-RF

2008-04-29 Thread shabda

I have a queryset with .extra call where I do something like this,

self.get_query_set().extra
...
tables=['news_topic as permission_table']
..

Pre qs-rf, the values in tables were not being escaped and so this was
working, with qs-rf the value in tables is escaped, so my code fails.

http://www.djangoproject.com/documentation/db-api/#extra-select-none-where-none-params-none-tables-none-order-by-none-select-params-none

tells me,
[1]First, see if you can get by without including the extra table and
use the one already in the query. [2]If that isn’t possible, put your
extra() call at the front of the queryset construction so that your
table is the first use of that table. [3]Finally, if all else fails,
look at the query produced and rewrite your where addition to use the
alias given to your extra table. The alias will be the same each time
you construct the queryset in the same way, so you can rely upon the
alias name to not change.

1. I need this table an extra time.
2. I do not understand this.

My code is somethings like this,

class LinkManager(models.Model):
  def get_query_set():
 super(LinkManager, self).get_query_set().extra()

  def get_query_set_with_user(self, user):
  return self.get_query_set().extra()

The erros comes in get_query_set_with_user, and I have extra call in
get_query_set(), so I guess I can not do this.

3. I guess I can do this, but it seems sort of fragile. Would it not
be better to have an option to alias?
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



sql_queries does not include all the sql statements

2008-04-29 Thread leopay

I use django.core.context_processors.debug to see the sql_queries in
template.
The raw sql of query

Entry.objects.all()[0,1]

does not in the sql_queries,but if I change the query like this

Entry.objects.all()[0]

and then the sql is in the sql_queries. why?
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: class in models.py 'not defined' exception

2008-04-29 Thread g m
THANKYOU

On 4/29/08, skunkwerk <[EMAIL PROTECTED]> wrote:
>
>
> I've been struggling with this error for the past hour.
>
> Error while importing URLconf 'winebago.urls': name 'AuthPermission'
> is not defined
> Exception Location: /usr/lib/python2.5/site-packages/django/core/
> urlresolvers.py in _get_urlconf_module, line 255
>
> my models.py was generated by: ./manage.py inspectdb > models.py
>
> the relevant lines from models.py:
> class AuthPermission(models.Model):
>id = models.IntegerField(primary_key=True)
>name = models.CharField(max_length=150)
>content_type = models.ForeignKey(DjangoContentType)
>codename = models.CharField(unique=True, max_length=300)
>class Meta:
>db_table = u'auth_permission'
>
> i can't figure out why this is happening, as i didn't change anything
> to do with the models.
>
> any ideas?
> thanks
> >
>

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Session/Varibale and HttpResponseRedirect help please

2008-04-29 Thread g m
THANKYOU

On 4/29/08, Brandon Taylor <[EMAIL PROTECTED]> wrote:
>
>
> Hello everyone,
>
> I'm doing a redirect after a form to a "thank you" page, which I would
> like to personalize with some of the data from the form. I've tried
> setting a session as such:
>
> ### views.py code
>
> if form.is_valid():
>first_name = form.cleaned_data['first_name']
>request.session['first_name'] = first_name
>
>return HttpResponseRedirect('training/thanks/')
>
>
> But, when I try to output the value in the "thanks" template, as such:
>
> def thanks(request):
>first_name = request.session.get('first_name')
>return render_to_response('thanks.html', 'first_name' :
> first_name)
>
>
> I get nothing. I've checked to make sure that the sessions middleware,
> and the sessions app are included in my settings.py file. What am I
> doing wrong? Help appreciated!
>
> Brandon
> >
>

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Great article about web2py

2008-04-29 Thread g m
HAI

On 4/29/08, simonbun <[EMAIL PROTECTED]> wrote:
>
>
> It's beyond me why they would classify PHP as a web framework, and on
> top of that, include CakePHP in the comparison as well... Other than
> that, it's hardly an independant and unbiased review, coming from the
> authors of web2py themselves.
> A thing that does seem handy is their integrated ticketing system.
> Seems like a day well spent for me to develop something similar for
> Django.
>
> regards,
> Simon.
>
> On Apr 28, 7:19 pm, Milan Andric <[EMAIL PROTECTED]> wrote:
> > This is not Django specific but it is framework relevant.  I thought
> > this was a great writeup of features for any framework.  At least I am
> > one person who likes the features of this web2py framework.
> >
> > http://mdp.cti.depaul.edu/examples/static/web2py_vs_others.pdf
> >
> > Web2py makes development happen faster because people can get up and
> > running quickly.  I have only played with it enough to be amazed.  It
> > allows the less technical disciplines like designers, journalists and
> > web producers to start building or collaborating with web based
> > database driven apps.
> >
> > The difficulty for my organization (News21) is the biggest technical
> > problem which is integrating different technologies like flash and
> > javascript.  It is difficult to do when each discipline has their own
> > tools and technologies that don't integrate well. I think this is one
> > step closer to making these different disciplines work better.
> >
> > --
> > Milan
> >
>

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Great article about web2py

2008-04-29 Thread g m
HAI

On 4/28/08, Milan Andric <[EMAIL PROTECTED]> wrote:
>
>
> This is not Django specific but it is framework relevant.  I thought
> this was a great writeup of features for any framework.  At least I am
> one person who likes the features of this web2py framework.
>
> http://mdp.cti.depaul.edu/examples/static/web2py_vs_others.pdf
>
> Web2py makes development happen faster because people can get up and
> running quickly.  I have only played with it enough to be amazed.  It
> allows the less technical disciplines like designers, journalists and
> web producers to start building or collaborating with web based
> database driven apps.
>
> The difficulty for my organization (News21) is the biggest technical
> problem which is integrating different technologies like flash and
> javascript.  It is difficult to do when each discipline has their own
> tools and technologies that don't integrate well. I think this is one
> step closer to making these different disciplines work better.
>
> --
> Milan
> >
>

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: @@@HOME BASED BUSSINESS OPPERTUNITY@@@

2008-04-29 Thread g m
OK

On 4/29/08, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
>
> HiGuys & friends...   iam shyni.
>
>
> my website is interested here
>
>
>see this site
>
>   but not complesary ok .
>
>   by friends & guys.
>
>
> www.getitlove.blogspot.com
>
>  www.doitbetter5.blogspot.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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Template variable in filter?

2008-04-29 Thread g m
HAI



On 4/29/08, Mike Chambers <[EMAIL PROTECTED]> wrote:
>
>
> Is it possible to include a template variable inside a filter?
>
> Specifically, I want to have a global setting for the date format string:
>
> Something like:
>
> settings.py
> --
> DATE_TIME_FORMAT = "M j, F \a\t P"
>
>
> template
> --
> {{ comment.date_submitted|date:{{DATE_TIME_FORMAT
>
> I am guessing that I could write a custom filter that handles this, was
> curious if there was another way to do it.
>
> mike
>
>
> >
>

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: object.filter and accessing items

2008-04-29 Thread g m
HAI

On 4/29/08, lars <[EMAIL PROTECTED]> wrote:
>
>
> Hi all,
>
> I was playing around with object.filter when I noticed something funny
> in my postgresql.log.
> This is my query in the view:
>
>prev_and_current =
> Article.objects.filter(id__lte=article_id).order_by('-id')[0:2]
>article = prev_and_current[0]
>prev_article = prev_and_current[1]
>
> Now whenever I fetch a concrete article by its index django will
> perform an extra query on the database:
>
> article = prev_and_current[0] ->
>
> LOG:  statement: SELECT "blog_article"."id", "blog_article"."title",
> "blog_article"."body", "blog_article"."body_rendered",
> "blog_article"."text_more", "blog_article"."text_more_rendered",
> "blog_article"."num_reads", "blog_article"."num_comments",
> "blog_article"."visible", "blog_article"."allow_comments",
> "blog_article"."send_info_email", "blog_article"."published",
> "blog_article"."created", "blog_article"."last_modified" FROM
> "blog_article" WHERE "blog_article"."id" <= '132'  ORDER BY
> "blog_article"."id" DESC LIMIT 1
>
> prev_article = prev_and_current[1] ->
>
> LOG:  statement: SELECT "blog_article"."id", "blog_article"."title",
> "blog_article"."body", "blog_article"."body_rendered",
> "blog_article"."text_more", "blog_article"."text_more_rendered",
> "blog_article"."num_reads", "blog_article"."num_comments",
> "blog_article"."visible", "blog_article"."allow_comments",
> "blog_article"."send_info_email", "blog_article"."published",
> "blog_article"."created", "blog_article"."last_modified" FROM
> "blog_article" WHERE "blog_article"."id" <= '132'  ORDER BY
> "blog_article"."id" DESC LIMIT 1 OFFSET 1
>
> So if I fetch n articles through a filter django will perform n
> queries on the database.
> What am I doing wrong here? I am using the latest version from trunk.
>
> Yours,
> Lars
>
>
> >
>

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



  1   2   >