Re: Where is the source code for Practical Django Projects?

2008-07-17 Thread Phillip Parrin

Hi James,

I'm also looking for the books source code, any chance you could put
it up somewhere?
Mainly i'm looking for the "advanced" templates you talk about in the
book, it's covered in the weblog section.

I also found a few typo's in the code examples, do you have a specific
page for this?

Another thing is about the markdown third party application, If one
should want to use this, make sure you download the latest svn
version, and not the tarball version. A rewrite of the queryset has
been made, wich could give you parse_lookup errors (i think), there's
also a patch available!

Anyways i would really like to have access to the books source code.

Kind regards,

Phillip Parrin

On Jul 9, 12:10 pm, "James Bennett" <[EMAIL PROTECTED]> wrote:
> On Wed, Jul 9, 2008 at 3:33 AM, Evan H. Carmi
>
> <[EMAIL PROTECTED]> wrote:
> > I am reading Practical Django Projects but am unable to find the online
> > source code. Does anyone know where this is located? I would think that
> > it would be athttp://www.apress.com/book/view/1590599969. However, that
> > doesn't seem to be the case.
>
> Long story made short:
>
> The source package was all ready to go when someone who had an early
> copy of the book ran into a problem with a third-party application,
> used in a couple of the projects in the book, that had a
> backwards-incompatible change after we went through tech review.
> Rather than have people downloading broken code, I went back to work
> trying to fix things up and provide some notes on the problem and how
> to work around it.
>
> Except I also have a day job which takes up quite a lot of my time.
> I'd planned to finish everything up over the weekend, but
> unfortunately I was wiped out by an illness and I'm just not starting
> to get back to the land of the usefully-living.
>
> So it's not online yet and probably won't be for a couple days yet,
> until I've had time to get caught up on other work and triple-check
> everything. In the meantime, all the code that's actually vital to
> working through the book is right there in the book; the downloadable
> package is simply a copy of what's in the book, plus a couple extra
> examples that aren't directly covered and don't really include any
> fundamentally-important stuff.
>
> --
> "Bureaucrat Conrad, you are technically correct -- the best kind of correct."

--~--~-~--~~~---~--~~
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: Where is the source code for Practical Django Projects?

2008-07-17 Thread Phillip Parrin

Hey James,

Seems like my first post, did not get posted at all..

I'm also looking for the souce code, mainly i'm looking for the
advanced templates you mention when building the weblog. Did you get
the chance to finish the source?

I also found a few typo's in the book, do you have a specific page
where i should submit them?

As for the tagging module used in your book, it seems that when one
downloads the tarball release of this package it won't be the latest
version, there has been a recent change in django, the queryset i
think. This removed the parse_lookup something the tarball version
does not like. When you download Tagging make sure you download the
SVN version, or download the patch to fix this problem. (I don't
really get why this wasn't updated!)

Kind regards,

Phillip Parrin

On Jul 9, 12:10 pm, "James Bennett" <[EMAIL PROTECTED]> wrote:
> On Wed, Jul 9, 2008 at 3:33 AM, Evan H. Carmi
>
> <[EMAIL PROTECTED]> wrote:
> > I am reading Practical Django Projects but am unable to find the online
> >sourcecode. Does anyone know where this is located? I would think that
> > it would be athttp://www.apress.com/book/view/1590599969. However, that
> > doesn't seem to be the case.
>
> Long story made short:
>
> Thesourcepackage was all ready to go when someone who had an early
> copy of the book ran into a problem with a third-party application,
> used in a couple of the projects in the book, that had a
> backwards-incompatible change after we went through tech review.
> Rather than have people downloading broken code, I went back to work
> trying to fix things up and provide some notes on the problem and how
> to work around it.
>
> Except I also have a day job which takes up quite a lot of my time.
> I'd planned to finish everything up over the weekend, but
> unfortunately I was wiped out by an illness and I'm just not starting
> to get back to the land of the usefully-living.
>
> So it's not online yet and probably won't be for a couple days yet,
> until I've had time to get caught up on other work and triple-check
> everything. In the meantime, all the code that's actually vital to
> working through the book is right there in the book; the downloadable
> package is simply a copy of what's in the book, plus a couple extra
> examples that aren't directly covered and don't really include any
> fundamentally-important stuff.
>
> --
> "Bureaucrat Conrad, you are technically correct -- the best kind of correct."

--~--~-~--~~~---~--~~
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 vs. Kohana

2008-07-17 Thread Oscar Carlsson
I've never used Kohana (or CodeIgniter), but I've used both PHP and Python -
and even if Kohana is a really nice framework, Python is still a great
advantage. Python is very friendly.
And Django (totally) kicks ass :-)

Oscar

2008/7/17 [EMAIL PROTECTED] <[EMAIL PROTECTED]>:

>
>
>
> Henrik Bechmann napisał(a):
> > Can anyone with experience or knowledge of both Django and Kohana (PHP
> > framework, son of CodeIgniter) list contexts in which each would be
> > most appropriate? I'm in a selection process right now with both on
> > the short list.
> >
> > Thanks!
> >
> > - Henrik
>
> Django is Python and CodeIgniter is PHP - that's the main difference.
> As for frameworks - I was using CodeIgniter, before Django. I switched
> because I wanted something with more feautres and easy to use.
> >
>

--~--~-~--~~~---~--~~
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 set CharField default value to logged in admin user?

2008-07-17 Thread etng
I don't think you can do that in you feild define phrase..
but you can use the pre_save hook to auto populate it with the current
logged user's name.Try to find the threadlocal middle ware,it can help you
to handle it!

-
Best regards,
etng
[EMAIL PROTECTED]
http://www.etng.net/blog


On Thu, Jul 17, 2008 at 12:25 PM, Gue <[EMAIL PROTECTED]> wrote:

> I wanted set CharField default value to logged in admin user in model. and
> i have no idea about this. :(
>
> please, Is there any documentation or tip could be reference?
>
> >
>

--~--~-~--~~~---~--~~
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: [i18n] How to switch/force a language from inside a usual view function?

2008-07-17 Thread Valery Khamenya

Hi Malcolm,

thanks for your reply.

Neither activate('de') nor translation.activate('de') have been
accepted by Python from inside my view function -- some import needed?

Anyway, both calls look for me rather like application-wide
"side-effects" -- what do you think?

Ideally, I'd like to apply this language change only for the given
HTTP request to the give URL not for all...

Thanks in advance for any further hints.

Best regards
--
Valery

--~--~-~--~~~---~--~~
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: Where is the source code for Practical Django Projects?

2008-07-17 Thread James Bennett

On Thu, Jul 17, 2008 at 2:14 AM, Phillip Parrin
<[EMAIL PROTECTED]> wrote:
> I'm also looking for the souce code, mainly i'm looking for the
> advanced templates you mention when building the weblog. Did you get
> the chance to finish the source?

I'm tracking down one other reported issue which -- hopefully -- will
be fixed for me soon by the merge of newforms-admin, but which is
holding me up a bit as I try to wrap up the tarball.

In the meantime, all the relevant code is right there in the book ;)


-- 
"Bureaucrat Conrad, you are technically correct -- the best kind of correct."

--~--~-~--~~~---~--~~
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 vs. Kohana

2008-07-17 Thread James Bennett

On Wed, Jul 16, 2008 at 6:05 PM, Henrik Bechmann <[EMAIL PROTECTED]> wrote:
> Can anyone with experience or knowledge of both Django and Kohana (PHP
> framework, son of CodeIgniter) list contexts in which each would be
> most appropriate? I'm in a selection process right now with both on
> the short list.

Both are most appropriate in the context of building a web application.

In all honesty, this is something that a random bunch of strangers
probably can't help you much with; only you know your actual
requirements and only you know your preferences for tools and coding
styles, so only you can make this decision. Django's feature set is
well-documented, and hopefully other frameworks do the same, so
reading through the available documentation and doing a tutorial or
two is probably your best bet.


-- 
"Bureaucrat Conrad, you are technically correct -- the best kind of correct."

--~--~-~--~~~---~--~~
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 help in using ComboField for Forms

2008-07-17 Thread Arien

On Thu, Jul 17, 2008 at 1:57 AM, Kadusale, Myles <[EMAIL PROTECTED]> wrote:
> Can anybody help me by sending snippets of code on using ComboField in
> forms?

Something like this from the regression tests?
http://code.djangoproject.com/browser/django/trunk/tests/regressiontests/forms/fields.py?rev=7859#L1104


Arien

--~--~-~--~~~---~--~~
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: Where is the source code for Practical Django Projects?

2008-07-17 Thread Phillip Parrin

I don't think the templates for the weblog(coltrane) app are in the
book... atleast not where they should be, in the chapter covering
it
the templates i'm talking about are:

entry_archive.html
entry_archive_year.html
entry_archve_month.html
entry_archive_day.html

and i think this is the same for the link_* templates.

 - btw great book :D

Kinda regards,

Phillip Parrin

On Jul 17, 9:36 am, "James Bennett" <[EMAIL PROTECTED]> wrote:
> On Thu, Jul 17, 2008 at 2:14 AM, Phillip Parrin
>
> <[EMAIL PROTECTED]> wrote:
> > I'm also looking for the souce code, mainly i'm looking for the
> > advanced templates you mention when building the weblog. Did you get
> > the chance to finish the source?
>
> I'm tracking down one other reported issue which -- hopefully -- will
> be fixed for me soon by the merge of newforms-admin, but which is
> holding me up a bit as I try to wrap up the tarball.
>
> In the meantime, all the relevant code is right there in the book ;)
>
> --
> "Bureaucrat Conrad, you are technically correct -- the best kind of correct."
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Field representation in n-f-admin

2008-07-17 Thread Alex Rades

Hi,
I have a field (a XMLField) which I'd like to format somehow before
presenting it into the admin change_list page.
How do i alter the string representation of a field in django?

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: request getlist() in order?

2008-07-17 Thread Arien

On Wed, Jul 16, 2008 at 7:29 PM, Rob Hudson <[EMAIL PROTECTED]> wrote:
>
> If I have a form like the example:
>
> 
> 
> 
>The Beatles
>The Who
>The Zombies
> 
> 
> 
>
> And I call request.POST.getlist('bands'), is the order of the bands
> going to always be the same as provided in the select box?
>
> Or another case, if I have the form:
>
> 
> Select bands in the order you want them to play:
> 
>The Beatles
>The Who
>The Zombies
> 
> 
>The Beatles
>The Who
>The Zombies
> 
> 
>The Beatles
>The Who
>The Zombies
> 
> 
> 
>
> In this case, only 1 item can be selected per select box but they are
> all named the same so I can get them as a list via getlist().  Will
> the value of getlist() be in order as selected in the form?

I'd expect this to be the case.

The HTML specification requires browser to submit forms
(application/x-www-form-urlencoded and multipart/form-data) encoded in
such a way that the order in which the name/value pairs is the order
in which they appear in the document[1], and Django's request
processing preserves this order when converting the encoded data to
MultiValueDicts.

> I'm trying to determine if I can do something the easy way (depend on
> the order as provided in the form) or do I have to name the fields in
> such a way to remember the order on POST.

You most likely can, but I don't think you should: the order in which
things appear on a page is a presentational issue.


Arien

[1] http://www.w3.org/TR/html401/interact/forms.html#h-17.13.4

--~--~-~--~~~---~--~~
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: Where is the source code for Practical Django Projects?

2008-07-17 Thread Johan Liseborn

On Thu, Jul 17, 2008 at 09:56, Phillip Parrin <[EMAIL PROTECTED]> wrote:
>
> I don't think the templates for the weblog(coltrane) app are in the
> book... atleast not where they should be, in the chapter covering
> it
> the templates i'm talking about are:
>
> entry_archive.html
> entry_archive_year.html
> entry_archve_month.html
> entry_archive_day.html

Pages 104-107 contains examples of the above, I believe.


> and i think this is the same for the link_* templates.

I didn't implement the link-part, but it seems some information is
available on pages 110-111. I guess "the details is left to reader"
regarding most of the link-templates... :-)

Also, it seems you have to run the trunk version of django-tagging if
you are running Django from trunk, and it seems the trunk version of
django-tagging works slightly differently than described in the book,
or at least I did not manage to get it working exactly as stated in
the book.

>  - btw great book :D

Agree.


Cheers,

johan

-- 
Johan Liseborn

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Problem testing ModelChoiceField in form

2008-07-17 Thread Florencio Cano

Hi!
When I try to test a post to a form that have a ModelChoiceField form
I get always a form error in that field "Select a valid choice".
The form is this:

class OperacionForm(forms.Form):
ticker = forms.ModelChoiceField(Valor.objects.all())
fecha = forms.DateField(widget=SelectDateWidget(years = 
range(1950,2010)))
cantidad = forms.CharField()
precio = forms.CharField()
comision = forms.CharField()
tipo = 
forms.ChoiceField(choices=[('Compra','Compra'),('Venta','Venta')])

And the test is this:

def testOperacionValida(self):
self.client.login(username='pepe', password='test')

usuario = User.objects.get(username='pepe') 
response = self.client.post('/carteras/', {
'cartera_nombre':'micartera',
'submit':'Crear'
})
carteras = Cartera.objects.filter(nombre='micartera') &
Cartera.objects.filter(usuarioID=usuario)

count_before = 
Operacion.objects.filter(carteraID=carteras[0]).count()

response = self.client.get('/carteras/nueva_operacion/%d' % 
carteras[0].id)
response = self.client.post('/carteras/nueva_operacion/', {
'ticker':Valor.objects.all()[0],
'cantidad':'100',
'precio':'5',
'fecha':'06/07/2008',
'comision':'9',
'tipo':'Compra',
'submit':'Crear'
})

count_after = 
Operacion.objects.filter(carteraID=carteras[0]).count()
self.assertEqual(count_after, count_before + 1)

The test fails with this message:
tickerSelect a
valid choice. That choice is not one of the available
choices.
F
==
FAIL: testOperacionValida (bolsacarteras.Carteras.tests.CrearOperacion)
--
Traceback (most recent call last):
  File "/home/fcano/djcode/bolsacarteras/../bolsacarteras/Carteras/tests.py",
line 92, in testOperacionValida
self.assertEqual(count_after, count_before + 1)
AssertionError: 0 != 1

--

I print the form error before the assertion to see what is happening
with the form and I see the error. The problem is with the ticker that
I try to introduce like this:

'ticker':Valor.objects.all()[0],

I print Valor.objects.all()[0] and I see that the fixture is imported
correctly. How I can introduce this value in the test?

--~--~-~--~~~---~--~~
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: single list items in templates

2008-07-17 Thread Ronny Haryanto

On Thu, Jul 17, 2008 at 2:03 AM, Tim Chase
<[EMAIL PROTECTED]> wrote:
>
>> I have a list: data = ['apple', 'orange', 'banana']
>> in my template: {{ data }} will output: ['apple', orange, banana]
>> but {{ data[0] }} will throw an error
>
>
> {{ data.0 }} should do the trick.

Or {{ data|first }}.

http://www.djangoproject.com/documentation/templates/#first

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
-~--~~~~--~~--~--~---



Django on Windows Mobile 6 (Standard)

2008-07-17 Thread warsng

After taking a look at the blogpost where someone got django running
on WM, i thought i would give it a try. however, i am not having much
success. Has anyone got this working recently? I am not using Pocket
PC unlike the blog author, I am using Windows Mobile 6 Standard, i.e.
non-touch-screen.

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Adding and removing template dirs on the fly

2008-07-17 Thread 3xM

Is there a "right" way to add and remove directories to TEMPLATE_DIRS
on the fly? Is it right to do at all?

I tried to just add a directory, but realized that the settings are
not per request, but per server thread, so that a directory added by
one request is also there for the next request, which causes some
trouble for me.

My case:

I am making a generic system for generating some playlists. Playlists
for most channels look exactly the same, but some has small
differences in how it should appear (e.g. they should not include a
thumbnail for the video, or maybe the order of the data presented
should be slightly different).

I'm using a set of templates, each one for each part of the playlist,
making it easy - in theory - to alter small parts of the playlist for
each channel, simply by adding another template directory for the
specific channel.

But when the added directory is stored across requests, a playlist for
Channel A might be generated with templates from Channel B if the
template directory for the latter has been added to TEMPLATE_DIRS.

My solution for now is adding the custom directory (if necessary), and
then removing it at the end of the request, after the HTML has been
generated.

BUT! What happens then if 2 request hit the same server thread at the
same time? Is there a risk of the second request getting the wrong
templates (from the first request) if the first request has not yet
removed it's directory from TEMPLATE_DIRS? Or are requests to the same
thread queued and won't interfere with each other?

--

Best regards, Mikkel
--~--~-~--~~~---~--~~
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: Adding and removing template dirs on the fly

2008-07-17 Thread Arien

On Thu, Jul 17, 2008 at 6:23 AM, 3xM <[EMAIL PROTECTED]> wrote:
[...]
> I am making a generic system for generating some playlists. Playlists
> for most channels look exactly the same, but some has small
> differences in how it should appear (e.g. they should not include a
> thumbnail for the video, or maybe the order of the data presented
> should be slightly different).
>
> I'm using a set of templates, each one for each part of the playlist,
> making it easy - in theory - to alter small parts of the playlist for
> each channel, simply by adding another template directory for the
> specific channel.

Have you seen the section on loading templates in the documentation?
It contains a tip that describes how you can use select_template to
nicely deal with this type of situation:
http://www.djangoproject.com/documentation/templates_python/#loading-templates


Arien

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



newforms and commit=False

2008-07-17 Thread Ian Lawrence

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Hi,
I wondered if someone has an about this?.
I take an uploaded zip/tarball and bind it to a model form. I then
extract it to a temporary folder and use this as a resources folder
when I compile a flash movie. If the contents of the flash movie are
ok for the user i want to commit to the database and move on to some
further processing
I call commit=False on the first view like:

variables = form.save(commit=False)

and i pass this to the flash preview like:
return render_to_response('preview.html', {'variables': variables})

can i pass the uncommitted 'variables' back to another view (in
another form submission if possible) and then call save() in this new
view?. Something like this in the second view:

if request.method == 'POST':
 # passed in hidden form variables from the flash preview
  data = {'themename' : form.themename,
 'userfile' : form.userfile}
# Save the user approved theme in the database
  final_form = ThemeForm(data)
  final_form.save()

Sorry if i have missed something obvious here

Ian
- --
http://ianlawrence.info

-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: http://getfiregpg.org

iD8DBQFIfzZjZXia3Con1vcRAiHgAKDLSDIkVR4JzrzLT7U1B1hv0iaEfACfYNud
rB/MUHuIOUVe8H5GAIRaLT4=
=qBUC
-END PGP SIGNATURE-

--~--~-~--~~~---~--~~
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 installation issue

2008-07-17 Thread zbiju

Hi guys,

I'm noobie with python and django but I would like to try it.
I have installed it as docs say but I have problem running it.

I'm getting error:
"Error while importing URLconf 'pyta.urls': No module named
core.handlers.wsgi"
which is a bit weird because in bootstrap file it seems to load this
module (or at least it knows where that module is).

This is what I'm getting when I type url in a browser:

Environment:

Request Method: GET
Request URL: http://zbiju.rootnode.net/pyta/
Django Version: 0.97-pre-SVN-7939
Python Version: 2.4.4
Installed Applications:
['django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.sites']
Installed Middleware:
('django.middleware.common.CommonMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.middleware.doc.XViewMiddleware')


Traceback:
File "/home2/zbiju/www/django/django/core/handlers/base.py" in
get_response
  76. callback, callback_args, callback_kwargs =
resolver.resolve(request.path)
File "/home2/zbiju/www/django/django/core/urlresolvers.py" in resolve
  231. for pattern in self.urlconf_module.urlpatterns:
File "/home2/zbiju/www/django/django/core/urlresolvers.py" in
_get_urlconf_module
  255. raise ImproperlyConfigured, "Error while
importing URLconf %r: %s" % (self.urlconf_name, e)

Exception Type: ImproperlyConfigured at /pyta/
Exception Value: Error while importing URLconf 'pyta.urls': No module
named core.handlers.wsgi


Thank in advance for any help.
Marcin

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Customising admin change_list_results.html template

2008-07-17 Thread Ayaz Ahmed Khan

Is it possible to have a customised `change_list_results.html` in
one's TEMPLATE_DIR/admin/app_label/model/ directory?  I've it along
with change_list.html, and while changes made to change_list are
picked up, those made to change_list_results aren't appearing.  I may
be doing it wrong, I am not sure.

I am using django build from svn trunk.  Thank you.

--
Ayaz Ahmed Khan
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



how to access foreignkey field (related_name) in newforms-admin list view?

2008-07-17 Thread Andre Meyer
hi all

imagine you have a first model class and a second model class with a
ForeignKey referring to the first one. for example, a Post model (taken from
the tutorial blog app) and a Comment model. of course, a post can have
multiple comments, so the Post model gets an attribute 'comments' (specified
using related_name).

how can the comments be displayed in the list view of the posts using
newforms-admin? i would like to indicate whether there are comments and how
many, if any.

but when adding the 'comments' attribute to the list_display of PostOptions,
syncdb throws an exception:

*django.core.exceptions.ImproperlyConfigured: `PostOptions.list_display[13]`
refers to `comments` that is neither a field, method or property of model
`Post`.
*
which is not true! Post does get a 'comments' field by the definition of
Comment.

inlined comments do appear in the detail view, though.

what's wrong?

thanks for your help
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: accessing an attribute for the first item in a template context

2008-07-17 Thread Tim Chase

>> example, I can do:
>>
>> {% for s in objectlist %}
>>   User name is: {{s.user_name}}
>> {% endfor %}
>>
>> But, I can't do this:
>> User name is: {{ objectlist.0.user_name }}

What is "objectlist"?  is it a list() or an iterable?  It may be 
trying to index into an iterable.  Thus you can either convert it 
to a list in your view:

   return render_to_response('x.html', {'objectlist' : 
list(objectlist)})

or you can try using the iterator as it stands:

   {{ objectlist.next.user_name }}

which should find next() as a callable on your iterable and 
return the next (first) item.

-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
-~--~~~~--~~--~--~---



Re: Customising admin change_list_results.html template

2008-07-17 Thread Ayaz Ahmed Khan

On Jul 17, 5:17 pm, Ayaz Ahmed Khan <[EMAIL PROTECTED]> wrote:
>
> Is it possible to have a customised `change_list_results.html` in
> one's TEMPLATE_DIR/admin/app_label/model/ directory?  I've it along
> with change_list.html, and while changes made to change_list are
> picked up, those made to change_list_results aren't appearing.  I may
> be doing it wrong, I am not sure.
>
> I am using django build from svn trunk.  Thank you.
>

It appears that if I move `change_list_results.html` to TEMPLATE_DIR/
admin/ instead, django picks it up.

--
Ayaz Ahmed Khan
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



i18n: How to the language on per-user basis

2008-07-17 Thread Torsten Bronger

Hallöchen!

In my Web application, every user has to log in.  In an additional
user database table, the prefered language of each user is given.
But how do I activate it?

I use django.contrib.auth.views.login for the login.  However, as
far as I can see, I have to copy-and-paste this function and add a
line to it which stors the language in the current session.  Am I
right?

Tschö,
Torsten.

-- 
Torsten Bronger, aquisgrana, europa vetus
   Jabber ID: [EMAIL PROTECTED]


--~--~-~--~~~---~--~~
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 on Windows Mobile 6 (Standard)

2008-07-17 Thread Russell Keith-Magee

On Thu, Jul 17, 2008 at 7:04 PM, warsng <[EMAIL PROTECTED]> wrote:
>
> After taking a look at the blogpost where someone got django running
> on WM, i thought i would give it a try. however, i am not having much
> success. Has anyone got this working recently? I am not using Pocket
> PC unlike the blog author, I am using Windows Mobile 6 Standard, i.e.
> non-touch-screen.

Yes, it can be done; no it isn't easy. The good news is that the
problems you will experience aren't Django related - it's a dependency
problem. In order to run Django, you need to get Python and SQLite
builds for your handheld. Installation binaries for handheld platforms
are not easily found, and using the Windows Mobile compiler toolchain
to produce installation binaries can be a painful process.

Once you have those dependencies compiled, Django works out of the box.

The bad news is that it has been a long time since I did this myself,
I have almost no recollection what combination of voodoo and black
magick was required, and I've changed jobs in the interim, so I can't
check a reference build to give you any guidance. However, I assure
you it can be done.

Yours,
Russ Magee %-)

--~--~-~--~~~---~--~~
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: Adding and removing template dirs on the fly

2008-07-17 Thread 3xM



On Jul 17, 1:59 pm, Arien <[EMAIL PROTECTED]> wrote:

> Have you seen the section on loading templates in the documentation?
> It contains a tip that describes how you can use select_template to
> nicely deal with this type of situation

Thanks for the fast reply.

I Don't see how this would help me. I still want to rely on the
fallback features of the template loading from directories in
TEMPLATE_DIRS, as I don't want to copy templates for all parts of the
playlist for each channel that differs a bit, but only those parts
being different.

I already tried loading templates a la

'%s/name_of_template.html' % channel_template_folder

but the result is that it when the template includes other templates,
it will look for it in the same folder, not doing the fallback thing
to the main generic template folder (as it is looking for something in
a subfolder with the name of the value of channel_template_folder).

Does it make sense?

I'll try to illustrate the current template structure to clarify:

.../templates
part_1.html
part_2.html
/channel_a
part_1.html
/channel_b
part_2.html

(I hope the identation in the above doesn't get ignored as whitespace)

So, normally I load e.g. 'part_1.html' which, somewhere in it,
includes 'part_2.html'. That works just fine.

But for Channel A I used to load 'channel_a/part_1.html', which will
also include 'part_2.html'. But now the template system will look for
a file called 'channel_a/part_2.html' which doesn't exist. And for
Channel B, where I only want 'part_2.html' to be different from the
generic, I can't get it to work without adding 'templates/channel_b'
to TEMPLATE_DIRS. A "solution" is to copy all templates each time I
want to make differences, but that seems quite stupid to me.

So what I want is to temporarily add 'templates/channel_b' to
TEMPLATE_DIRS for requests for playlists from Channel B. Is it somehow
possible?
--~--~-~--~~~---~--~~
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 on Windows Mobile 6 (Standard)

2008-07-17 Thread warsng

I have installed Python CE, but i am getting import errors - 'No
module named django'

I don't know which directory i am supposed to install django into, i
have tried putting it in python25/Lib/site-packages as the windows
version (i think?)

im fumbling around in the dark here, as the version of django on the
blogpost seems to be a very old one, and the version of WM is not even
the same. also there seems to be no command line for WM6, all i have
is the python interpreter, which does seem to run .py scripts

any guidance would be welcome



On Jul 17, 2:02 pm, "Russell Keith-Magee" <[EMAIL PROTECTED]>
wrote:
> On Thu, Jul 17, 2008 at 7:04 PM, warsng <[EMAIL PROTECTED]> wrote:
>
> > After taking a look at the blogpost where someone got django running
> > on WM, i thought i would give it a try. however, i am not having much
> > success. Has anyone got this working recently? I am not using Pocket
> > PC unlike the blog author, I am using Windows Mobile 6 Standard, i.e.
> > non-touch-screen.
>
> Yes, it can be done; no it isn't easy. The good news is that the
> problems you will experience aren't Django related - it's a dependency
> problem. In order to run Django, you need to get Python and SQLite
> builds for your handheld. Installation binaries for handheld platforms
> are not easily found, and using the Windows Mobile compiler toolchain
> to produce installation binaries can be a painful process.
>
> Once you have those dependencies compiled, Django works out of the box.
>
> The bad news is that it has been a long time since I did this myself,
> I have almost no recollection what combination of voodoo and black
> magick was required, and I've changed jobs in the interim, so I can't
> check a reference build to give you any guidance. However, I assure
> you it can be done.
>
> Yours,
> Russ Magee %-)
--~--~-~--~~~---~--~~
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: i18n: How to the language on per-user basis

2008-07-17 Thread Rajesh Dhawan

Hi,

> In my Web application, every user has to log in.  In an additional
> user database table, the prefered language of each user is given.
> But how do I activate it?
>
> I use django.contrib.auth.views.login for the login.  However, as
> far as I can see, I have to copy-and-paste this function and add a
> line to it which stors the language in the current session.  Am I
> right?

Yes, that would do it.

-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: how to access foreignkey field (related_name) in newforms-admin list view?

2008-07-17 Thread Rajesh Dhawan



On Jul 17, 8:32 am, "Andre Meyer" <[EMAIL PROTECTED]> wrote:
> hi all
>
> imagine you have a first model class and a second model class with a
> ForeignKey referring to the first one. for example, a Post model (taken from
> the tutorial blog app) and a Comment model. of course, a post can have
> multiple comments, so the Post model gets an attribute 'comments' (specified
> using related_name).
>
> how can the comments be displayed in the list view of the posts using
> newforms-admin? i would like to indicate whether there are comments and how
> many, if any.

Create a method in your Post class like this:

def comment_stats(self):
   return self.comments.count()

Then add 'comment_stats' to the list_display of your Post's Admin
options.

>
> but when adding the 'comments' attribute to the list_display of PostOptions,
> syncdb throws an exception:
>
> *django.core.exceptions.ImproperlyConfigured: `PostOptions.list_display[13]`
> refers to `comments` that is neither a field, method or property of model
> `Post`.
> *
> which is not true! Post does get a 'comments' field by the definition of
> Comment.

>From the Post's perspective comments is a multi-valued field. However,
the Admin list_display of Post is intended to show one Post record per
row. So displaying post.comments where comments can have a dozen rows
per post doesn't make sense i.e. the Admin can't guess that you want
to show just the presence of comments as a boolean flag or that you
want to show the count of comments. The above technique of using a
custom method is how you can accomplish what you want here.

See:
http://code.djangoproject.com/wiki/NewformsHOWTO#Q:HowdoIaddanextracolumntothechangelistview

-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: Django on Windows Mobile 6 (Standard)

2008-07-17 Thread warsng

a glimmer of hope

http://translate.google.co.uk/translate?hl=en&sl=ru&u=http://pyromann-dude.com/2008/01/15/django-on-asus-p535-under-windows-mobile-60/&sa=X&oi=translate&resnum=4&ct=result&prev=/search%3Fq%3Dpythonce%2Bdjango%26start%3D10%26hl%3Den%26client%3Dfirefox-a%26rls%3Dorg.mozilla:en-GB:official%26hs%3DC5o%26sa%3DN


On Jul 17, 2:21 pm, warsng <[EMAIL PROTECTED]> wrote:
> I have installed Python CE, but i am getting import errors - 'No
> module named django'
>
> I don't know which directory i am supposed to install django into, i
> have tried putting it in python25/Lib/site-packages as the windows
> version (i think?)
>
> im fumbling around in the dark here, as the version of django on the
> blogpost seems to be a very old one, and the version of WM is not even
> the same. also there seems to be no command line for WM6, all i have
> is the python interpreter, which does seem to run .py scripts
>
> any guidance would be welcome
>
> On Jul 17, 2:02 pm, "Russell Keith-Magee" <[EMAIL PROTECTED]>
> wrote:
>
> > On Thu, Jul 17, 2008 at 7:04 PM, warsng <[EMAIL PROTECTED]> wrote:
>
> > > After taking a look at the blogpost where someone got django running
> > > on WM, i thought i would give it a try. however, i am not having much
> > > success. Has anyone got this working recently? I am not using Pocket
> > > PC unlike the blog author, I am using Windows Mobile 6 Standard, i.e.
> > > non-touch-screen.
>
> > Yes, it can be done; no it isn't easy. The good news is that the
> > problems you will experience aren't Django related - it's a dependency
> > problem. In order to run Django, you need to get Python and SQLite
> > builds for your handheld. Installation binaries for handheld platforms
> > are not easily found, and using the Windows Mobile compiler toolchain
> > to produce installation binaries can be a painful process.
>
> > Once you have those dependencies compiled, Django works out of the box.
>
> > The bad news is that it has been a long time since I did this myself,
> > I have almost no recollection what combination of voodoo and black
> > magick was required, and I've changed jobs in the interim, so I can't
> > check a reference build to give you any guidance. However, I assure
> > you it can be done.
>
> > Yours,
> > Russ Magee %-)
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Countdown to 1.0 alpha

2008-07-17 Thread Dan
I was wondering when the 1.0alpha was due so I went to Trac and found this
page:

http://code.djangoproject.com/query?status=new&status=assigned&status=reopened&milestone=1.0+alpha

There is only 10 tickets left before alpha is complete. I don't know for
you, but I'm going to check this page every morning from 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: newforms and commit=False

2008-07-17 Thread Rajesh Dhawan

Hi Ian,

> I take an uploaded zip/tarball and bind it to a model form. I then
> extract it to a temporary folder and use this as a resources folder
> when I compile a flash movie. If the contents of the flash movie are
> ok for the user i want to commit to the database and move on to some
> further processing
> I call commit=False on the first view like:
>
> variables = form.save(commit=False)
>
> and i pass this to the flash preview like:
> return render_to_response('preview.html', {'variables': variables})
>
> can i pass the uncommitted 'variables' back to another view (in
> another form submission if possible) and then call save() in this new
> view?. Something like this in the second view:
>
> if request.method == 'POST':
>  # passed in hidden form variables from the flash preview
>   data = {'themename' : form.themename,
>  'userfile' : form.userfile}
> # Save the user approved theme in the database
>   final_form = ThemeForm(data)
>   final_form.save()
>
> Sorry if i have missed something obvious here

Take a look at how Form Preview works. You should be able to adapt
that to your above workflow:
http://www.djangoproject.com/documentation/form_preview/

-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: Django installation issue

2008-07-17 Thread James Matthews
I don't see much but it seems your aren't mapping you urls properly. Please
post your urls.py on http://dpaste.com/ then email the link.

On Thu, Jul 17, 2008 at 4:48 AM, zbiju <[EMAIL PROTECTED]> wrote:

>
> Hi guys,
>
> I'm noobie with python and django but I would like to try it.
> I have installed it as docs say but I have problem running it.
>
> I'm getting error:
> "Error while importing URLconf 'pyta.urls': No module named
> core.handlers.wsgi"
> which is a bit weird because in bootstrap file it seems to load this
> module (or at least it knows where that module is).
>
> This is what I'm getting when I type url in a browser:
>
> Environment:
>
> Request Method: GET
> Request URL: http://zbiju.rootnode.net/pyta/
> Django Version: 0.97-pre-SVN-7939
> Python Version: 2.4.4
> Installed Applications:
> ['django.contrib.auth',
>  'django.contrib.contenttypes',
>  'django.contrib.sessions',
>  'django.contrib.sites']
> Installed Middleware:
> ('django.middleware.common.CommonMiddleware',
>  'django.contrib.sessions.middleware.SessionMiddleware',
>  'django.contrib.auth.middleware.AuthenticationMiddleware',
>  'django.middleware.doc.XViewMiddleware')
>
>
> Traceback:
> File "/home2/zbiju/www/django/django/core/handlers/base.py" in
> get_response
>  76. callback, callback_args, callback_kwargs =
> resolver.resolve(request.path)
> File "/home2/zbiju/www/django/django/core/urlresolvers.py" in resolve
>  231. for pattern in self.urlconf_module.urlpatterns:
> File "/home2/zbiju/www/django/django/core/urlresolvers.py" in
> _get_urlconf_module
>  255. raise ImproperlyConfigured, "Error while
> importing URLconf %r: %s" % (self.urlconf_name, e)
>
> Exception Type: ImproperlyConfigured at /pyta/
> Exception Value: Error while importing URLconf 'pyta.urls': No module
> named core.handlers.wsgi
>
>
> Thank in advance for any help.
> Marcin
>
> >
>


-- 
http://search.goldwatches.com/?Search=Movado+Watches
http://www.jewelerslounge.com
http://www.goldwatches.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: How to switch/force a language from inside a usual view function?

2008-07-17 Thread Valery

Hi Malcolm,

> It's not documented in thei18n.txt file (which needs a bit of a rewrite
> and splitting up once the docs reorganisation lands in trunk), but have
> a look at the activate() function in
> django/utils/translation/trans_real.py.

according to what is stated here:
http://code.djangoproject.com/browser/django/trunk/django/utils/translation/trans_real.py?rev=6582#L189

The setting is applied to a current thread. Well, could I be sure that
other HTTP-requests handled by the same thread wouldn't be affected by
this setting? I mean, my language setting should be applied to the
current single HTTP-request (for a given URL) only.

I start to believe that it is impossible to control translation
language of a view from inside of view functions. Although I wouldn't
find this as a very odd use case.

Regards
Valery

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Why 2 servers to serve dynamic and static content?

2008-07-17 Thread eka

Hi,

I'm new to django, and reading around, found out that it's better to
have 2 different web servers for django and static content. How is so?

And in deployment, how should this be? I mean, should I have 2 apache
instances? or use another web server for static content or...?

Regards.

Eka
--~--~-~--~~~---~--~~
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: Countdown to 1.0 alpha

2008-07-17 Thread Jacob Kaplan-Moss

On Thu, Jul 17, 2008 at 9:20 AM, Dan <[EMAIL PROTECTED]> wrote:
> I was wondering when the 1.0alpha was due so I went to Trac and found this
> page:
>
> http://code.djangoproject.com/query?status=new&status=assigned&status=reopened&milestone=1.0+alpha
>
> There is only 10 tickets left before alpha is complete. I don't know for
> you, but I'm going to check this page every morning from now :)

You can see the schedule for the 1.0 release at
http://code.djangoproject.com/wiki/VersionOneRoadmap#schedule --
you'll see that 1.0 alpha is due early next week.

The tickets don't tell the *entire* story, but yes, we're very close!

Jacob

--~--~-~--~~~---~--~~
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: Countdown to 1.0 alpha

2008-07-17 Thread Dan
>
> The tickets don't tell the *entire* story, but yes, we're very close!
>
> Jacob
>

That's awesome!

Can we have many big-ass parties? If there's one near Montreal, I'm in! We
could set up a wiki page for that when the final release will be closer.

--~--~-~--~~~---~--~~
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: Why 2 servers to serve dynamic and static content?

2008-07-17 Thread 3xM

> And in deployment, how should this be? I mean, should I have 2 apache
> instances? or use another web server for static content or...?

You can use the same Apache instance, running 2 different virtual
hosts: One for the Django site and the other for serving static files.
That will probably be sufficient in most cases.

--

Mvh Mikkel
--~--~-~--~~~---~--~~
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: Why 2 servers to serve dynamic and static content?

2008-07-17 Thread Jon Brisbin


On Jul 17, 2008, at 10:43 AM, 3xM wrote:
>
>> And in deployment, how should this be? I mean, should I have 2 apache
>> instances? or use another web server for static content or...?
>
> You can use the same Apache instance, running 2 different virtual
> hosts: One for the Django site and the other for serving static files.
> That will probably be sufficient in most cases.
>

That's fine if you're only concerned about separating images, css, and  
other media from Django. I'm using GWT in my Django app, though, and  
using any method other than Aliases or mod_rewrite won't work for me.

In production, it'll be on a shared hosting provider, so I have to use  
rewrite rules running through an FCGI script and serve all other files  
and directories that actually exist through normal Apache.

Thanks!

Jon Brisibn
http://jbrisbin.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
-~--~~~~--~~--~--~---



keeping a list of objects sorted

2008-07-17 Thread jelle

Hi,

I'm using the tagging app to construct a view where the most recent
articles by tag are shown, ordered by date.
To do so I use the following code:

all_tags = set([i.name for i in Tag.objects.all()])
articles = []
for i in all_tags:
qs = TaggedItem.objects.get_by_model( Article, i )
if qs:
articles.append(qs.latest('date'))

articles = sorted(articles, key=operator.attrgetter('date'))

When running this in the shell, it results in the wanted ordering.
When rendered in html, I loose this precise ordering.
What can I do to overcome this issue?

Thanks,

-jelle
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Using an email as the user login

2008-07-17 Thread rootbit

Hey everyone.
i would like to change the authentication system, so that usernames
will be email
like on facebook.


how should i go about doing that?

--~--~-~--~~~---~--~~
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: ImageFiled Uploads

2008-07-17 Thread Dane Hesseldahl
Just FYI - I ended up using the models save__file method like
this:

if 'avatar' in request.FILES:
 uf = request.FILES['avatar']
 os.remove(settings.MEDIA_ROOT + "/avatars/" + user.username + ".jpg")
 profile.save_profile_avatar_file("avatars/" + user.username + ".jpg",
uf)

On Wed, Jul 16, 2008 at 12:36 PM, Marty Alchin <[EMAIL PROTECTED]>
wrote:

>
> On Wed, Jul 16, 2008 at 2:50 PM, d3f3nd3r <[EMAIL PROTECTED]> wrote:
> > hello,
> > I have another problem with file upload.
> > request.FILES['file'] represents a dictionary in my view, not an object.
> >
> > Here is my code :
> >class UserPicForm(forms.Form):
> >userpic  = forms.FileField()
> >
> >form = UserPicForm(request.POST,request.FILES)
> >if form.is_valid() :
> >handle_userpic(request.FILES['userpic'])
> >
> >def handle_userpic(f):
> >destination = open('/home/d3f3nd3r/hackerspace-os/mos/media/tmp',
> 'wb+')
> >for chunk in f.chunks() : -> ERROR : 'FileDict' object has no
> attribute 'chunks'
> >destination.write(chunk)
> >
> > I think I followed the docs at
> > http://www.djangoproject.com/documentation/upload_handling/ but it didnt
> work.
> > Any ideas ?
>
> You probably need to update to a more recent SVN checkout of Django.
> That document is only valid as of revision 7814, which went in a
> couple weeks ago.
>
> -Gul
>
> >
>

--~--~-~--~~~---~--~~
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: Using an email as the user login

2008-07-17 Thread Karen Tracey
On Thu, Jul 17, 2008 at 12:04 PM, rootbit <[EMAIL PROTECTED]> wrote:

>
> Hey everyone.
> i would like to change the authentication system, so that usernames
> will be email
> like on facebook.
>
>
> how should i go about doing that?
>
>
The answer that has been given other times people have asked for this is to
write your own authentication backend.  Which is documented here:

http://www.djangoproject.com/documentation/authentication/#other-authentication-sources

This might sound like a lot of work for a minor thing but here is a snippet
that does it:

http://www.djangosnippets.org/snippets/74/

Caveat: I haven't any experience with this myself, I'm just repeating
pointers I've seen given elsewhere.  It should at least give you a starting
point.

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: Using an email as the user login

2008-07-17 Thread Ayaz Ahmed Khan

On Jul 17, 9:04 pm, rootbit <[EMAIL PROTECTED]> wrote:
>
> Hey everyone.
> i would like to change the authentication system, so that usernames
> will be email
> like on facebook.
>
> how should i go about doing that?
>

For the current project I am working on, I had to do the same.  I
ended up modifying the User model.  Therefore, I am using a custom
Django of sorts.  The project is approaching its final stages; I have
not had any issues with anything from having hacked the User model.  I
couldn't think of any other workaround.

--
Ayaz Ahmed Khan
--~--~-~--~~~---~--~~
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 access foreignkey field (related_name) in newforms-admin list view?

2008-07-17 Thread Andre Meyer
hi Rajesh

thanks, that's a great link.

still, it's not exactly clear to me why the admin does not work the same as
other templates.

in my own template, it is no problem to refer to comments of a post using,
e.g.

{% for comment in post.comments.all %}
[...]
{% endfor %}

or

{{ post.comments.all|length }}

looks inconsistent to me.

thanks & cheers
André


On Thu, Jul 17, 2008 at 4:14 PM, Rajesh Dhawan <[EMAIL PROTECTED]>
wrote:

>
>
>
> On Jul 17, 8:32 am, "Andre Meyer" <[EMAIL PROTECTED]> wrote:
> > hi all
> >
> > imagine you have a first model class and a second model class with a
> > ForeignKey referring to the first one. for example, a Post model (taken
> from
> > the tutorial blog app) and a Comment model. of course, a post can have
> > multiple comments, so the Post model gets an attribute 'comments'
> (specified
> > using related_name).
> >
> > how can the comments be displayed in the list view of the posts using
> > newforms-admin? i would like to indicate whether there are comments and
> how
> > many, if any.
>
> Create a method in your Post class like this:
>
> def comment_stats(self):
>   return self.comments.count()
>
> Then add 'comment_stats' to the list_display of your Post's Admin
> options.
>
> >
> > but when adding the 'comments' attribute to the list_display of
> PostOptions,
> > syncdb throws an exception:
> >
> > *django.core.exceptions.ImproperlyConfigured:
> `PostOptions.list_display[13]`
> > refers to `comments` that is neither a field, method or property of model
> > `Post`.
> > *
> > which is not true! Post does get a 'comments' field by the definition of
> > Comment.
>
> From the Post's perspective comments is a multi-valued field. However,
> the Admin list_display of Post is intended to show one Post record per
> row. So displaying post.comments where comments can have a dozen rows
> per post doesn't make sense i.e. the Admin can't guess that you want
> to show just the presence of comments as a boolean flag or that you
> want to show the count of comments. The above technique of using a
> custom method is how you can accomplish what you want here.
>
> See:
>
> http://code.djangoproject.com/wiki/NewformsHOWTO#Q:HowdoIaddanextracolumntothechangelistview
>
> -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: Using an email as the user login

2008-07-17 Thread Marty Alchin

On Thu, Jul 17, 2008 at 12:34 PM, Ayaz Ahmed Khan
<[EMAIL PROTECTED]> wrote:
>
> On Jul 17, 9:04 pm, rootbit <[EMAIL PROTECTED]> wrote:
>>
>> Hey everyone.
>> i would like to change the authentication system, so that usernames
>> will be email
>> like on facebook.
>>
>> how should i go about doing that?
>>
>
> For the current project I am working on, I had to do the same.  I
> ended up modifying the User model.  Therefore, I am using a custom
> Django of sorts.  The project is approaching its final stages; I have
> not had any issues with anything from having hacked the User model.  I
> couldn't think of any other workaround.
>
> --
> Ayaz Ahmed Khan
> >
>

--~--~-~--~~~---~--~~
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 access foreignkey field (related_name) in newforms-admin list view?

2008-07-17 Thread Rajesh Dhawan

Hi,

> still, it's not exactly clear to me why the admin does not work the same as
> other templates.

The Admin is not a template. So, I don't know what you mean by that.

>
> in my own template, it is no problem to refer to comments of a post using,
> e.g.
>
> {% for comment in post.comments.all %}
> [...]
> {% endfor %}
>
> or
>
> {{ post.comments.all|length }}
>
> looks inconsistent to me.

The whole point is that in your own template, you decide whether you
want to display the count of comments or a list of comments or the
names of the commenters, and so on. How would the Admin know what you
want if you were allowed to put "comments" in the list_display? One
user may want the count, another may want something else. That's why
the Admin supports calling methods in your model class. And through
such methods you are able to display your comments field exactly the
way you want.

-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
-~--~~~~--~~--~--~---



URL encoding problem

2008-07-17 Thread [EMAIL PROTECTED]

Hi,
I have a problem about the encoding of the variables that i have in my
views..

I've an url like this:

http://elvis.sinedita.it/dossiers/Comunità/1/

my URLS:

   (r'(?P[^/]+)/section/$', 'views.listpersection'),


in the views i found something like 'Comunit\xe0'

and when i exec:
section_id =
Section.objects.get(section_name=section_name,id_site=Site.objects.get_current().id)

I've this error :
DoesNotExist at /dossiers/Comunità/1/
Section matching query does not exist.

I'm shure that the section with name 'Comunità' exists...
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
-~--~~~~--~~--~--~---



Different 500.html template for admin and frontend

2008-07-17 Thread apit

Noob here :)

In what circumstance admin template for 500 error used?

I use nfa-branch svn. In admin site, when my app raise exception,
django seems to load 500.html from my project, or from the app, but
not from admin template. Am i miss something? I want different 500
template between admin site and frontend. Is it 500_handler in urls is
the way to go, by eg. looking at request.META['PATH_INFO']?

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: how to access foreignkey field (related_name) in newforms-admin list view?

2008-07-17 Thread Andre Meyer
hi Rajesh

On Thu, Jul 17, 2008 at 6:55 PM, Rajesh Dhawan <[EMAIL PROTECTED]>
wrote:

>
> Hi,
>
> > still, it's not exactly clear to me why the admin does not work the same
> as
> > other templates.
>
> The Admin is not a template. So, I don't know what you mean by that.


admin is not using templates? well, i did not check the implementation.


The whole point is that in your own template, you decide whether you
> want to display the count of comments or a list of comments or the
> names of the commenters, and so on. How would the Admin know what you
> want if you were allowed to put "comments" in the list_display? One
> user may want the count, another may want something else. That's why
> the Admin supports calling methods in your model class. And through
> such methods you are able to display your comments field exactly the
> way you want.


agree, though it would make sense to me to return the RelatedManager
instance, just like in the templates.

anyway, problem solved

thanks a lot
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: how to access foreignkey field (related_name) in newforms-admin list view?

2008-07-17 Thread Rajesh Dhawan


> > > still, it's not exactly clear to me why the admin does not work the same
> > as
> > > other templates.
>
> > The Admin is not a template. So, I don't know what you mean by that.
>
> admin is not using templates? well, i did not check the implementation.

Sorry, if I wasn't clear. The admin does use templates but it's much
more than that (that's why I said that the Admin is not a template).
Moreover, the Admin change-list and all its other templates have to be
dynamic because they don't know beforehand what fields each model is
going to have and which of those are going to be displayed via
list_display.

So, as I explained above, there's no way for the admin to guess what
you want it to do with related many-valued fields like Post.comments
in your case. So, it chokes when you try to do such a thing.

>
> The whole point is that in your own template, you decide whether you
>
> > want to display the count of comments or a list of comments or the
> > names of the commenters, and so on. How would the Admin know what you
> > want if you were allowed to put "comments" in the list_display? One
> > user may want the count, another may want something else. That's why
> > the Admin supports calling methods in your model class. And through
> > such methods you are able to display your comments field exactly the
> > way you want.
>
> agree, though it would make sense to me to return the RelatedManager
> instance, just like in the templates.

What would that give you? In the change list you would just see the
class name of the RelatedManager. Is that what you mean?

Remember that in your own templates, you don't just say:

{{ post.comments }}

Instead you either loop over comments or do a length filter on them,
etc. In other words, you are actively making the decision on what you
want to do with that related manager instance.

Also, there's one other important difference: when you loop over
post.comments in your template, you are causing a DB query that brings
in the comments of that single  post instance. If an Admin were to do
that, it would have to issue an extra query for each row it is going
to display in the change-list screen.

All this is documented in the second bullet here:

http://www.djangoproject.com/documentation/model-api/#list-display

-Rajesh
--~--~-~--~~~---~--~~
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 switch/force a language from inside a usual view function?

2008-07-17 Thread Malcolm Tredinnick


On Thu, 2008-07-17 at 08:26 -0700, Valery wrote:
> Hi Malcolm,
> 
> > It's not documented in thei18n.txt file (which needs a bit of a rewrite
> > and splitting up once the docs reorganisation lands in trunk), but have
> > a look at the activate() function in
> > django/utils/translation/trans_real.py.
> 
> according to what is stated here:
> http://code.djangoproject.com/browser/django/trunk/django/utils/translation/trans_real.py?rev=6582#L189
> 
> The setting is applied to a current thread. Well, could I be sure that
> other HTTP-requests handled by the same thread wouldn't be affected by
> this setting? I mean, my language setting should be applied to the
> current single HTTP-request (for a given URL) only.

Since the language is set each time (by the middleware and by your
code), each request will be operating under the same assumptions. If you
change nothing then, yes, subsequent requests will use the same
settings. But that's why you will be setting it the same way each time.
Either by a common entry point for your views, or using middleware or
however is most convenient for your code.

You could even do something like this if you wanted it to be guaranteed
to be restricted to the view:

original_locale = translation.get_language()
translation.activate(new_locale)
try:
   ...
   output = render_to_string()
   ...
   return HttpResponse(output)
finally:
   translation.activate(original_locale)

Yes, the "active language" is per-thread, but it's really per-request
since it's set anew for each request (unless you have wildly different
code paths and very inconsistent code). As I think I mentioned in my
original resopnse, this is exactly how Django sets the active language
with the i18n middleware and in other places. How you choose to set the
language each time is going to be dependent on your circumstances and I
cannot possibly lay out all the possibilities, since they are literally
boundless. At some point it's a matter of just writing the code.

> I start to believe that it is impossible to control translation
> language of a view from inside of view functions. Although I wouldn't
> find this as a very odd use case.

If that was true, it would not be possible to use translations at all in
Django, since this is how the whole i18n support works (it is really
just something that is called right before your view).

Regards,
Malcolm


--~--~-~--~~~---~--~~
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: URL encoding problem

2008-07-17 Thread Malcolm Tredinnick


On Thu, 2008-07-17 at 10:01 -0700, [EMAIL PROTECTED] wrote:
> Hi,
> I have a problem about the encoding of the variables that i have in my
> views..
> 
> I've an url like this:
> 
> http://elvis.sinedita.it/dossiers/Comunità/1/
> 
> my URLS:
> 
>    (r'(?P[^/]+)/section/$', 'views.listpersection'),

This URL pattern has no chance of matching the URL you give above.
You'll need to show us the pattern you are really matching against for
this to make sense.


> in the views i found something like 'Comunit\xe0'

Found it where? Something has gone wrong there, since that is an
ISO-8559-1 encoding of Communitá, when it should be unicode inside
Django (or 'Communit\xc3\xa1' if it was printed as UTF-8). It doesn't
look like that string is coming from Django itself.

> 
> and when i exec:
> section_id =
> Section.objects.get(section_name=section_name,id_site=Site.objects.get_current().id)
> 
> I've this error :
> DoesNotExist at /dossiers/Comunità/1/
> Section matching query does not exist.

Since the string you provide above isn't a valid string to be passing
into this query (you should be passing in either UTF-8 encoded
bytestrings or unicode strings), it's not too surprising that nothing is
found.

You'll need to provide a bit more information for us to be able to help
here. In particular: what is the URL pattern that is being matched to
call that view and perhaps a short code sample showing how to repeat the
problem in the view (make your view as short as possible to demonstrate
the problem).

Regards,
Malcolm



--~--~-~--~~~---~--~~
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: ImageFiled Uploads

2008-07-17 Thread d3f3nd3r

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1



Yeah thank you, had an outdated django version.

but I have another fundamental question about ImageField.
If I use ImageFields in a Form, does to form handle the storage for me or have I
to save the image specially?
Because I cant figure out how ImageField works.

here is my code

model :
class ContactInfo(models.Model):
wiki_name = models.CharField(max_length=50, blank=True, null=True)
image = models.ImageField(upload_to='/site_media/userpics/', blank=True)
user = models.ForeignKey(User, unique=True, edit_inline=models.STACKED,
num_in_admin=1, max_num_in_admin=1)

form :
class UserPicForm(ModelForm):
class meta:
model = ContactInfo
include = ('image')

view :
ci = ContactInfo.objects.get(user=current_user)
form = UserPicForm(request.POST,request.FILES, instance=ci)

if form.is_valid() :
form_data = form.save()
print form_data.image # prints an empty string and I dont know why

form :
 
 Image
   

regards
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFIf4OzM/NgBE4GzRgRAlVVAKCL9fye86FITb+8fiheBK7hk20B0wCffZdK
Nf6tR66EfrBEzY7waig/pXE=
=6T7t
-END PGP SIGNATURE-

--~--~-~--~~~---~--~~
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: Why 2 servers to serve dynamic and static content?

2008-07-17 Thread Norman Harman

eka wrote:
> Hi,
> 
> I'm new to django, and reading around, found out that it's better to
> have 2 different web servers for django and static content. How is so?

It's scalability issue.  Each process of a server setup to serve dynamic 
content (using mod_python for instance) typically uses much more memory 
than a server tuned to serving just static content.  So, for example 
(made up numbers) with X memory you can run Y simultaneous dynamic 
servers or 10*Y static ones.  That means you can handle 10 times the 
(static)traffic.

And when you're a huge successful site you might only need 1-2 machines 
to serve static content were as you'll have many, many serving dynamic 
content.

Another reason would be to split static content from your regular 
hosting provider to something like a CDN or Amazon S3.  Which might be 
cheaper / faster than your regular hosting provider.


> And in deployment, how should this be? I mean, should I have 2 apache
> instances? or use another web server for static content or...?

If I was bothering with serving static and dynamic content separately I 
wouldn't use apache to serve the static content.  Use something 
lightweight and fast like nginx or lighttpd.  And depending on your 
situation you can get rid of apache all together and have the 
nginx/lighttpd proxy to something like wsgi or fastcgi django.

On the other hand if I didn't expect a moderate amount of traffic I 
might skip the whole splitting dynamic/static content issue until and if 
I run into scalability issues.

-- 
Norman J. Harman Jr.
Senior Web Specialist, Austin American-Statesman
___
You've got fun!  Check out Austin360.com for all the entertainment
info you need to live it up in the big city!

--~--~-~--~~~---~--~~
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: URL encoding problem

2008-07-17 Thread Karen Tracey
On Thu, Jul 17, 2008 at 1:01 PM, [EMAIL PROTECTED] <
[EMAIL PROTECTED]> wrote:

>
> Hi,
> I have a problem about the encoding of the variables that i have in my
> views..
>
> I've an url like this:
>
> http://elvis.sinedita.it/dossiers/Comunità/1/
>

> my URLS:
>
>    (r'(?P[^/]+)/section/$', 'views.listpersection'),
>
>
> in the views i found something like 'Comunit\xe0'
>

That looks like a bytestring, which would seem to indicate you are using an
0.96.x release of Django?  That release does not fully support Unicode,
which will probably cause you problems down the road (besides possibly
contributing to the problem you are having now) since you clearly are
needing to handle non-ASCII data.  I'd recommend upgrading to an SVN
checkout, where this variable passed to your view would be a Unicode object,
not a bytestring.


>
> and when i exec:
> section_id =
>
> Section.objects.get(section_name=section_name,id_site=Site.objects.get_current().id)
>
> I've this error :
> DoesNotExist at /dossiers/Comunità/1/
> Section matching query does not exist.
>
> I'm shure that the section with name 'Comunità' exists...
> Any ideas?
>

This is a guess, but it might be that your database table has a different
encoding than the bytestring from your URL.  That bytestring looks to be an
ISO 8859-1 (or windows codepage 1252, which has the same code value for à).


Also, the url should really have any non-ASCII characters percent-encoded,
see:

http://tools.ietf.org/html/rfc3986#section-2

Not sure where you 'got' that url from, but if your app is generating these
it should be url-encoding them before including them in links and such, I
believe.

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: keeping a list of objects sorted

2008-07-17 Thread Norman Harman

jelle wrote:
> Hi,
> 
> I'm using the tagging app to construct a view where the most recent
> articles by tag are shown, ordered by date.
> To do so I use the following code:
> 
> all_tags = set([i.name for i in Tag.objects.all()])
> articles = []
> for i in all_tags:
> qs = TaggedItem.objects.get_by_model( Article, i )
> if qs:
> articles.append(qs.latest('date'))
> 
> articles = sorted(articles, key=operator.attrgetter('date'))
> 
> When running this in the shell, it results in the wanted ordering.
> When rendered in html, I loose this precise ordering.

If you use the same code in your view as above then the ordering should 
not change.

How are you displaying in template?  Should be using something like

{% for article in articles %}
stuff
{% endfor %)


-- 
Norman J. Harman Jr.
Senior Web Specialist, Austin American-Statesman
___
You've got fun!  Check out Austin360.com for all the entertainment
info you need to live it up in the big city!

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Row-level permissions

2008-07-17 Thread [EMAIL PROTECTED]

Hi,

I need to use row level permissions on a project I'm developing.

I've found several solutions:
http://code.djangoproject.com/wiki/RowLevelPermissions
http://code.google.com/p/django-granular-permissions/
http://www.technobabble.dk/2008/jan/06/filtering-foreign-key-choices-newforms-admin/

and
http://code.djangoproject.com/wiki/GenericAuthorization
(with aparently was not finished)


Could someone please let me know what is the prefered way of doing
this?

Best regards,

Luis
--~--~-~--~~~---~--~~
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: keeping a list of objects sorted

2008-07-17 Thread jelle

Hi Norman,

Yep, I'm just looping through the list.
Pretty awkward, right?
--~--~-~--~~~---~--~~
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: keeping a list of objects sorted

2008-07-17 Thread Norman Harman

jelle wrote:
> Hi Norman,
> 
> Yep, I'm just looping through the list.
> Pretty awkward, right?

Yes, very.  Is the html output order seemingly random? or is there some 
pattern to it?  Cn you post the code for the view?  I'm guessing there 
is a typo or something similar going unnoticed.

-- 
Norman J. Harman Jr.
Senior Web Specialist, Austin American-Statesman
___
You've got fun!  Check out Austin360.com for all the entertainment
info you need to live it up in the big city!

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Source changes: How can I resolve import error -- cannot import django.db.models.query.parse_lookup

2008-07-17 Thread LRP

Hello,

Still working my way through James Bennett's Practical Django
Projects. Now on p. 64.

I get this import error when I try to syncdb the Coltrane models.

from tagging.models import Tag
  File "/usr/lib/python2.5/site-packages/tagging/models.py", line 9,
in from tagging.managers import TagManager,
TaggedItemManager
  File "/usr/lib/python2.5/site-packages/tagging/managers.py", line 6,
in 
from django.db.models.query import QuerySet, parse_lookup
ImportError: cannot import name parse_lookup

Googling around I find this note:

While the public interface for the ORM-layer should stay the same, the
internals have undergone massive change. So if you're relying on some
private part of the API, you will have to check if it still works.
Affected of this if for example the popular django-tagging app (guess
what it does ;-)) which in its current state (r132) uses the no longer
available django.db.models.query.parse_lookup function. A patch by
Joes Watts is available here and seems to solve this issue. For more
details check out this ticket on django-tagging's google code project
page.

I've never patched code before. Can some kind soul please walk me
through the process step-by-step so I can continue on to page 65?

Many thanks,

Lloyd


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Dreamhost now supports Django

2008-07-17 Thread Ramdas S
Hi,

Just recd notice that Dreamhost is officially supporting Django. Anyone has
tried it out lately. I've had extremely bad expeirence with Fast CGI a year
back.

Please give feedback

-- 
Ramdas S
+91 9342 583 065
My Personal Blog: http://ramdas.diqtech.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: Dreamhost now supports Django

2008-07-17 Thread Marinho Brandao

Hi Ramdas,

about 1 or 2 years ago, I head some headaches with DH Django's sites,
using their FastCGI sollution (the problema wasn't the FastCGI, but
the lot of shared accounts in the server).

now it is working well, in last months.

I don't know what really they changed to annound an official support,
can you send a link to us?

thank you :)

2008/7/17 Ramdas S <[EMAIL PROTECTED]>:
> Hi,
>
> Just recd notice that Dreamhost is officially supporting Django. Anyone has
> tried it out lately. I've had extremely bad expeirence with Fast CGI a year
> back.
>
> Please give feedback
>
> --
> Ramdas S
> +91 9342 583 065
> My Personal Blog: http://ramdas.diqtech.com
> >
>



-- 
Marinho Brandão (José Mário)
http://marinho.webdoisonline.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: Dreamhost now supports Django

2008-07-17 Thread Juanjo Conti

Where can I read the notice and get directions?

2008/7/17 Ramdas S <[EMAIL PROTECTED]>:
> Hi,
>
> Just recd notice that Dreamhost is officially supporting Django. Anyone has
> tried it out lately. I've had extremely bad expeirence with Fast CGI a year
> back.
>
> Please give feedback
>
> --
> Ramdas S
> +91 9342 583 065
> My Personal Blog: http://ramdas.diqtech.com
> >
>



-- 
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: Dreamhost now supports Django

2008-07-17 Thread Malcolm Tredinnick


On Fri, 2008-07-18 at 01:37 +0530, Ramdas S wrote:
> Hi,
> 
> Just recd notice that Dreamhost is officially supporting Django.
> Anyone has tried it out lately. I've had extremely bad expeirence with
> Fast CGI a year back.

Can anybody who is in a position to check this out please look at one
thing in particular: assuming the default database is still MySQL, which
version of the python MySQLdb wrapper are they using? If 

>>> import MySQLdb
>>> MySQLdb.version_info

doesn't say something like (1, 2, 1, 'final', 2) or (1, 2, 2, 'final',
0), then it's going to be problematic for them. Previously, Dreamhost
had been running a much older version of MySQLdb and I'd be very
interested in knowing for certain that they've upgraded at some point in
the past 12 months.

Regards,
Malcolm




--~--~-~--~~~---~--~~
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: Dreamhost now supports Django

2008-07-17 Thread Ramdas S
Ok this is the mail I recd just now



Hey!

This is just a note to let you know that the suggestion:

   "Add support for Django (a python web-development framework)."

from the category "New Features" has been marked as completed.

So you now have another 4 credit(s) to vote on more suggestions at:

   https://panel.dreamhost.com/?tree=home.sugg

Here's some IMPORTANT DETAILS on the resolution of this suggestion:


   Done! We've had FastCGI support available for some time, and we're
working on supporting Python web apps through Passenger too.

Thanks again for taking the time to vote for what you'd like implemented,
it really helps us keep on task!

Sincerely,
The Happy DreamHost Suggestation Team


On Fri, Jul 18, 2008 at 1:45 AM, Malcolm Tredinnick <
[EMAIL PROTECTED]> wrote:

>
>
> On Fri, 2008-07-18 at 01:37 +0530, Ramdas S wrote:
> > Hi,
> >
> > Just recd notice that Dreamhost is officially supporting Django.
> > Anyone has tried it out lately. I've had extremely bad expeirence with
> > Fast CGI a year back.
>
> Can anybody who is in a position to check this out please look at one
> thing in particular: assuming the default database is still MySQL, which
> version of the python MySQLdb wrapper are they using? If
>
>>>> import MySQLdb
>>>> MySQLdb.version_info
>
> doesn't say something like (1, 2, 1, 'final', 2) or (1, 2, 2, 'final',
> 0), then it's going to be problematic for them. Previously, Dreamhost
> had been running a much older version of MySQLdb and I'd be very
> interested in knowing for certain that they've upgraded at some point in
> the past 12 months.
>
> Regards,
> Malcolm
>
>
>
>
> >
>

--~--~-~--~~~---~--~~
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: Dreamhost now supports Django

2008-07-17 Thread Ned Batchelder
Here's what I got, I have no idea if I need to do anything unusual to 
change the python path or anything:

nedbat.coke ~> python
Python 2.3.5 (#2, Oct 16 2006, 19:19:48)
[GCC 3.3.5 (Debian 1:3.3.5-13)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
 >>> import MySQLdb
 >>> MySQLdb.version_info
(1, 2, 1, 'gamma', 3)
 >>>
nedbat.coke ~> python2.4
Python 2.4.4 (#2, Apr 29 2008, 08:45:14)
[GCC 3.3.5 (Debian 1:3.3.5-13)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
 >>> import MySQLdb
 >>> MySQLdb.version_info
(1, 2, 1, 'gamma', 3)
 >>>

--Ned.
http://nedbatchelder.com

Malcolm Tredinnick wrote:
> On Fri, 2008-07-18 at 01:37 +0530, Ramdas S wrote:
>   
>> Hi,
>>
>> Just recd notice that Dreamhost is officially supporting Django.
>> Anyone has tried it out lately. I've had extremely bad expeirence with
>> Fast CGI a year back.
>> 
>
> Can anybody who is in a position to check this out please look at one
> thing in particular: assuming the default database is still MySQL, which
> version of the python MySQLdb wrapper are they using? If 
>
> >>> import MySQLdb
> >>> MySQLdb.version_info
> 
> doesn't say something like (1, 2, 1, 'final', 2) or (1, 2, 2, 'final',
> 0), then it's going to be problematic for them. Previously, Dreamhost
> had been running a much older version of MySQLdb and I'd be very
> interested in knowing for certain that they've upgraded at some point in
> the past 12 months.
>
> Regards,
> Malcolm
>
>
>
>
> >
>
>   

-- 
Ned Batchelder, http://nedbatchelder.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: Dreamhost now supports Django

2008-07-17 Thread jake elliott



On Jul 17, 3:15 pm, Malcolm Tredinnick <[EMAIL PROTECTED]>
wrote:
> Can anybody who is in a position to check this out please look at one
> thing in particular: assuming the default database is still MySQL, which
> version of the python MySQLdb wrapper are they using? If
>
>         >>> import MySQLdb
>         >>> MySQLdb.version_info
>
> doesn't say something like (1, 2, 1, 'final', 2) or (1, 2, 2, 'final',
> 0), then it's going to be problematic for them. Previously, Dreamhost
> had been running a much older version of MySQLdb and I'd be very
> interested in knowing for certain that they've upgraded at some point in
> the past 12 months.

i get:
(1, 2, 1, 'final', 2)

-jake
--~--~-~--~~~---~--~~
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 on Windows Mobile 6 (Standard)

2008-07-17 Thread warsng

seem to be having a lot of trouble renaming the files using a python
script that WM has very kindly 'uppercased' for me. I'm trying to run
the script on the Russian blog but keep getting an Error 13 - Windows
error?

---
import os, sys

for root, dirs, files in os.walk('.', topdown=False):

for filename in files:

os.rename(os.path.join(root, filename), os.path.join(root,
'tmp'))

os.rename(os.path.join(root, 'tmp'), os.path.join(root,
filename.lower()))

for dirname in dirs:

os.rename(os.path.join(root, dirname), os.path.join(root,
'tmp'))

os.rename(os.path.join(root, 'tmp'), os.path.join(root,
dirname.lower()))
---

what am i doing wrong, please tell me? i am very new to python


On Jul 17, 3:18 pm, warsng <[EMAIL PROTECTED]> wrote:
> a glimmer of hope
>
> http://translate.google.co.uk/translate?hl=en&sl=ru&u=http://pyromann...
>
> On Jul 17, 2:21 pm, warsng <[EMAIL PROTECTED]> wrote:
>
> > I have installed Python CE, but i am getting import errors - 'No
> > module named django'
>
> > I don't know which directory i am supposed to install django into, i
> > have tried putting it in python25/Lib/site-packages as the windows
> > version (i think?)
>
> > im fumbling around in the dark here, as the version of django on the
> > blogpost seems to be a very old one, and the version of WM is not even
> > the same. also there seems to be no command line for WM6, all i have
> > is the python interpreter, which does seem to run .py scripts
>
> > any guidance would be welcome
>
> > On Jul 17, 2:02 pm, "Russell Keith-Magee" <[EMAIL PROTECTED]>
> > wrote:
>
> > > On Thu, Jul 17, 2008 at 7:04 PM, warsng <[EMAIL PROTECTED]> wrote:
>
> > > > After taking a look at the blogpost where someone got django running
> > > > on WM, i thought i would give it a try. however, i am not having much
> > > > success. Has anyone got this working recently? I am not using Pocket
> > > > PC unlike the blog author, I am using Windows Mobile 6 Standard, i.e.
> > > > non-touch-screen.
>
> > > Yes, it can be done; no it isn't easy. The good news is that the
> > > problems you will experience aren't Django related - it's a dependency
> > > problem. In order to run Django, you need to get Python and SQLite
> > > builds for your handheld. Installation binaries for handheld platforms
> > > are not easily found, and using the Windows Mobile compiler toolchain
> > > to produce installation binaries can be a painful process.
>
> > > Once you have those dependencies compiled, Django works out of the box.
>
> > > The bad news is that it has been a long time since I did this myself,
> > > I have almost no recollection what combination of voodoo and black
> > > magick was required, and I've changed jobs in the interim, so I can't
> > > check a reference build to give you any guidance. However, I assure
> > > you it can be done.
>
> > > Yours,
> > > Russ Magee %-)
>
>
--~--~-~--~~~---~--~~
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: Dreamhost now supports Django

2008-07-17 Thread Malcolm Tredinnick


On Thu, 2008-07-17 at 16:43 -0400, Ned Batchelder wrote:
> Here's what I got, I have no idea if I need to do anything unusual to
> change the python path or anything:
> 
> nedbat.coke ~> python
> Python 2.3.5 (#2, Oct 16 2006, 19:19:48)
> [GCC 3.3.5 (Debian 1:3.3.5-13)] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
> >>> import MySQLdb
> >>> MySQLdb.version_info
> (1, 2, 1, 'gamma', 3)
> >>>
> nedbat.coke ~> python2.4
> Python 2.4.4 (#2, Apr 29 2008, 08:45:14)
> [GCC 3.3.5 (Debian 1:3.3.5-13)] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
> >>> import MySQLdb
> >>> MySQLdb.version_info
> (1, 2, 1, 'gamma', 3)
> >>>

Thanks for the rapid feedback, Ned.

That's a little problematic, since it's the old release they've been
using forever and was a release prior to 1.2.1-final and has known
showstopper-style bugs. That version of MySQLdb doesn't work with
Django's mysql backend and the mysql_old backend is going to be removed
in 1.0.

However, Jake Elliot (elsewhere in this thread) indicates that they're
using a more recent version somewhere else on Dreamhost. So now I'm just
confused, but maybe it's not all doom and gloom for the Dreamhost
people.

In any case, if Dreamhost aren't using 1.2.1-final2 or later -- such as
1.2.2 -- then they won't be able to say that they're supporting anything
later than tomorrow's subversion checkout of Django, I suspect.

Regards,
Malcolm



--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Strange ProgrammingError - What causes it?

2008-07-17 Thread andrewljohnson

Hi,

I am getting a strange programming error, and I wonder what causes it?

The Error

ProgrammingError at /trips/viewtrip/2/
ERROR: current transaction is aborted, commands ignored until end of
transaction block SET client_encoding to 'UNICODE'

This error is triggered by calling {{trip.owner}}

If you go to this URL you will see the error in question (I have debug
mode turned on): http://www.trailbehind.com/trips/viewtrip/2/


A Couple of Notes
==
1) This error does not occur if you are logged in as the trip.owner
(i.e. trip.owner == request.user).

2. This error doesn't occur on my development machine, and I think
that may be because I am running a slightly different version of
psycopg.

3. Here are my relevant models:

class Trip(models.Model):
"""A trip, future or present"""
owner = models.ForeignKey("UserProfile", related_name="owner")
start_date = models.DateField(null = True)
end_date = models.DateField(null = True)
time_created  = models.DateField(auto_now=True)

park = models.ForeignKey(Park, blank = True, null = True)
route = models.ManyToManyField(Trail, null = True, blank = True)

comments = generic.GenericRelation(Comment, null = True, blank =
True)

invitee_list = models.ManyToManyField("Invitee")

def __str__(self):
return  str(self.id)

class Admin:
pass


class UserProfile(models.Model):
"""Extra data about each user."""

user = models.ForeignKey(User, unique=True, null=True, blank=True)
summary = models.TextField(null=True)
url = models.URLField(null=True)
home_address = models.TextField(null=True)
phone_number = models.PhoneNumberField(null=True)
email_address = models.EmailField(null=True, unique=True)
user_key = models.CharField(max_length=64, null=True)

comments = generic.GenericRelation(Comment)

def __str__(self):
if self.user:
return str(self.user)
return str(False)

class Admin:
pass


Thanks for any help!

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: accessing site settings in templates

2008-07-17 Thread gordyt

Jon I don't see why you couldn't make a custom template tag (see
http://tinyurl.com/2zlzf6).  I made one to display the current
application revision and so to use it in a template is just this:

{% revision %}

--gordon
--~--~-~--~~~---~--~~
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: accessing site settings in templates

2008-07-17 Thread Jon Brisbin

I was considering this option, but went with some custom middleware,  
which allows me to mix in some other things I was wanting to add to  
the context as well...

Thanks for the suggestion!

Jon Brisibn
http://jbrisbin.com

On Jul 17, 2008, at 4:16 PM, gordyt wrote:

>
> Jon I don't see why you couldn't make a custom template tag (see
> http://tinyurl.com/2zlzf6).  I made one to display the current
> application revision and so to use it in a template is just this:
>
> {% revision %}
>
> --gordon
> >


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Download source-code feature.

2008-07-17 Thread J . Pablo Fernández

Hello,

Is there any reusable or copyable implementation of download-source-
code feature as it would be used when using the Affero GPL license?

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: Strange ProgrammingError - What causes it?

2008-07-17 Thread Julien Phalip

Which version of Django are you using?

As a first attempt, I'd replace your __str__ method by __unicode__ and
replace the calls to 'str' by 'unicode'.

On Jul 18, 7:02 am, andrewljohnson <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I am getting a strange programming error, and I wonder what causes it?
>
> The Error
> 
> ProgrammingError at /trips/viewtrip/2/
> ERROR: current transaction is aborted, commands ignored until end of
> transaction block SET client_encoding to 'UNICODE'
>
> This error is triggered by calling {{trip.owner}}
>
> If you go to this URL you will see the error in question (I have debug
> mode turned on):http://www.trailbehind.com/trips/viewtrip/2/
>
> A Couple of Notes
> ==
> 1) This error does not occur if you are logged in as the trip.owner
> (i.e. trip.owner == request.user).
>
> 2. This error doesn't occur on my development machine, and I think
> that may be because I am running a slightly different version of
> psycopg.
>
> 3. Here are my relevant models:
>
> class Trip(models.Model):
>     """A trip, future or present"""
>     owner = models.ForeignKey("UserProfile", related_name="owner")
>     start_date = models.DateField(null = True)
>     end_date = models.DateField(null = True)
>     time_created  = models.DateField(auto_now=True)
>
>     park = models.ForeignKey(Park, blank = True, null = True)
>     route = models.ManyToManyField(Trail, null = True, blank = True)
>
>     comments = generic.GenericRelation(Comment, null = True, blank =
> True)
>
>     invitee_list = models.ManyToManyField("Invitee")
>
>     def __str__(self):
>         return  str(self.id)
>
>     class Admin:
>         pass
>
> class UserProfile(models.Model):
>     """Extra data about each user."""
>
>     user = models.ForeignKey(User, unique=True, null=True, blank=True)
>     summary = models.TextField(null=True)
>     url = models.URLField(null=True)
>     home_address = models.TextField(null=True)
>     phone_number = models.PhoneNumberField(null=True)
>     email_address = models.EmailField(null=True, unique=True)
>     user_key = models.CharField(max_length=64, null=True)
>
>     comments = generic.GenericRelation(Comment)
>
>     def __str__(self):
>         if self.user:
>             return str(self.user)
>         return str(False)
>
>     class Admin:
>         pass
>
> Thanks for any help!
>
> 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: Strange ProgrammingError - What causes it?

2008-07-17 Thread Julien Phalip

Seems like it could be, as you say, related to a problem with psycopg,
see: 
http://groups.google.com/group/comp.lang.python/browse_thread/thread/8e78649ac40472fe/


On Jul 18, 9:14 am, Julien Phalip <[EMAIL PROTECTED]> wrote:
> Which version of Django are you using?
>
> As a first attempt, I'd replace your __str__ method by __unicode__ and
> replace the calls to 'str' by 'unicode'.
>
> On Jul 18, 7:02 am, andrewljohnson <[EMAIL PROTECTED]> wrote:
>
> > Hi,
>
> > I am getting a strange programming error, and I wonder what causes it?
>
> > The Error
> > 
> > ProgrammingError at /trips/viewtrip/2/
> > ERROR: current transaction is aborted, commands ignored until end of
> > transaction block SET client_encoding to 'UNICODE'
>
> > This error is triggered by calling {{trip.owner}}
>
> > If you go to this URL you will see the error in question (I have debug
> > mode turned on):http://www.trailbehind.com/trips/viewtrip/2/
>
> > A Couple of Notes
> > ==
> > 1) This error does not occur if you are logged in as the trip.owner
> > (i.e. trip.owner == request.user).
>
> > 2. This error doesn't occur on my development machine, and I think
> > that may be because I am running a slightly different version of
> > psycopg.
>
> > 3. Here are my relevant models:
>
> > class Trip(models.Model):
> >     """A trip, future or present"""
> >     owner = models.ForeignKey("UserProfile", related_name="owner")
> >     start_date = models.DateField(null = True)
> >     end_date = models.DateField(null = True)
> >     time_created  = models.DateField(auto_now=True)
>
> >     park = models.ForeignKey(Park, blank = True, null = True)
> >     route = models.ManyToManyField(Trail, null = True, blank = True)
>
> >     comments = generic.GenericRelation(Comment, null = True, blank =
> > True)
>
> >     invitee_list = models.ManyToManyField("Invitee")
>
> >     def __str__(self):
> >         return  str(self.id)
>
> >     class Admin:
> >         pass
>
> > class UserProfile(models.Model):
> >     """Extra data about each user."""
>
> >     user = models.ForeignKey(User, unique=True, null=True, blank=True)
> >     summary = models.TextField(null=True)
> >     url = models.URLField(null=True)
> >     home_address = models.TextField(null=True)
> >     phone_number = models.PhoneNumberField(null=True)
> >     email_address = models.EmailField(null=True, unique=True)
> >     user_key = models.CharField(max_length=64, null=True)
>
> >     comments = generic.GenericRelation(Comment)
>
> >     def __str__(self):
> >         if self.user:
> >             return str(self.user)
> >         return str(False)
>
> >     class Admin:
> >         pass
>
> > Thanks for any help!
>
> > 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: newforms and commit=False

2008-07-17 Thread Ian Lawrence

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Hi,

> Take a look at how Form Preview works. You should be able to adapt
> that to your above workflow:
> http://www.djangoproject.com/documentation/form_preview/

Thanks , that looks exactly like what I need!
I do not think however it is possible to use it with uploads as
django/contrib/formtools/preview.py does not seem to bind the upload
file to the form :

def preview_post(self, request):
"Validates the POST data. If valid, displays the preview page.
Else, redisplays form."
f = self.form(request.POST, auto_id=AUTO_ID)

so validation always fails.
There is also a warning in this file that preview_post is a METHOD
SUBCLASSES SHOULDN'T OVERRIDE.
Any idea why not and what to watch out for if I do
Thanks for your help
Ian

-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: http://getfiregpg.org

iD8DBQFIf9MQZXia3Con1vcRAmm3AKCcETc9AugirLk1LolCnc3za6mY7gCfQyyr
Pq3WR6yH9MvkvuASswHB0Sk=
=944Y
-END PGP SIGNATURE-

-- 
http://ianlawrence.info

--~--~-~--~~~---~--~~
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: accessing site settings in templates

2008-07-17 Thread [EMAIL PROTECTED]

Look at these sample code , is this you want ?

from django.template import loader, RequestContext
def custom_proc(request):
"A context processor that provides 'app', 'user' and
'ip_address'."
return {
'app': 'My app',
'user': request.user,
'ip_address': request.META['REMOTE_ADDR']
}
def view_1(request):
# ...
t = loader.get_template('template1.html')
c = RequestContext(request, {'message': 'I am view 1.'},
processors=[custom_proc])
return t.render(c)

On Jul 18, 5:52 am, Jon Brisbin <[EMAIL PROTECTED]> wrote:
> I was considering this option, but went with some custom middleware,
> which allows me to mix in some other things I was wanting to add to
> the context as well...
>
> Thanks for the suggestion!
>
> Jon Brisibnhttp://jbrisbin.com
>
> On Jul 17, 2008, at 4:16 PM, gordyt wrote:
>
>
>
> > Jon I don't see why you couldn't make a custom template tag (see
> >http://tinyurl.com/2zlzf6).  I made one to display the current
> > application revision and so to use it in a template is just this:
>
> > {% revision %}
>
> > --gordon

--~--~-~--~~~---~--~~
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: no more mail for ADMINS

2008-07-17 Thread EAMiller

Thanks again to you Rajesh, and Malcom for great troubleshooting tips.
Due to separate issue I discovered that I was missing the 127.0.0.1
localhost line from my /etc/hosts ... fixing that also fixed my mail
issue!

- Ethan

On Jul 14, 4:15 pm, Rajesh Dhawan <[EMAIL PROTECTED]> wrote:
> On Jul 14, 7:02 pm, EAMiller <[EMAIL PROTECTED]> wrote:
>
>
>
> > On Jul 14, 11:57 am, Rajesh Dhawan <[EMAIL PROTECTED]> wrote:
>
> > > Drop into a shell (python manage.py shell) and send yourself a test
> > > message using:
>
> > > from django.core.mail import send_mail
>
> > > send_mail('Subject test', 'Message test', '[EMAIL PROTECTED]',
> > >     ['your_email_address_here'], fail_silently=False)
>
> > > With fail_silently=False, you will receive some kind of an error
> > > message if that email send is unsuccessful. Use that to investigate
> > > further.
>
> > Thanks Rajesh, good suggestion.
>
> > Now I (sortof) know my problem...
>
> > File "smtplib.py", line 296, in connect
> >     for res in socket.getaddrinfo(host, port, 0, socket.SOCK_STREAM):
> > gaierror: (-2, 'Name or service not known')
>
> This looks like some kind of a name server lookup failure.
>
>
>
> > Not sure what this really means. Doesn't the fact that I can use
> > 'mail' to send mail from the CLI mean my postfix setup is basically
> > OK? I will keep working on it.
>
> Yes, that would mean that your Postfix setup is OK. Try setting
> EMAIL_HOST to '127.0.0.1' to see if that helps.
>
> Otherwise, try this in a Python shell:
>
> import socket
> host = socket.gethostname()
> print host
> ip = socket.gethostbyname(host)
> print ip
>
> If that ip= line fails, it means your server's hostname doesn't
> resolve to an IP address. Just add a 127.0.0.1 entry for it in your /
> etc/hosts and that should take care of it.
--~--~-~--~~~---~--~~
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: accessing site settings in templates

2008-07-17 Thread Jon Brisbin

Sort of, but not really because I wanted something that worked even  
using the built-in views (the problem manifested when I started  
working with the login views). I didn't have a problem passing my  
settings into the templates for the views I created myself, but I  
didn't have access to the same arbitrary settings in the templates  
created for the built-in views. I had to use middleware to intercept  
the context and add the variables, even when using views I didn't write.

It seemed like a fair amount of extra work just to make sure all my  
templates had a "media_base_url" variable! :) I've actually changed to  
using plain CGI (rather than manage.py runserver) in development so  
that I don't have to muck about with proxying the Django server and  
other such [*bleep*]...subtleties...to get a coherent environment  
where I can test in the GWT hosted mode browser, desktop Firefox, and  
the iPod Touch, all at the same time.

Thanks!

Jon Brisibn
http://jbrisbin.com

On Jul 17, 2008, at 6:45 PM, [EMAIL PROTECTED] wrote:

>
> Look at these sample code , is this you want ?
>
> from django.template import loader, RequestContext
> def custom_proc(request):
> "A context processor that provides 'app', 'user' and
> 'ip_address'."
> return {
> 'app': 'My app',
> 'user': request.user,
> 'ip_address': request.META['REMOTE_ADDR']
> }
> def view_1(request):
> # ...
> t = loader.get_template('template1.html')
> c = RequestContext(request, {'message': 'I am view 1.'},
> processors=[custom_proc])
> return t.render(c)
>
> On Jul 18, 5:52 am, Jon Brisbin <[EMAIL PROTECTED]> wrote:
>> I was considering this option, but went with some custom middleware,
>> which allows me to mix in some other things I was wanting to add to
>> the context as well...
>>
>> Thanks for the suggestion!
>>
>> Jon Brisibnhttp://jbrisbin.com
>>
>> On Jul 17, 2008, at 4:16 PM, gordyt wrote:
>>
>>
>>
>>> Jon I don't see why you couldn't make a custom template tag (see
>>> http://tinyurl.com/2zlzf6).  I made one to display the current
>>> application revision and so to use it in a template is just this:
>>
>>> {% revision %}
>>
>>> --gordon
>
> >


--~--~-~--~~~---~--~~
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: Source changes: How can I resolve import error -- cannot import django.db.models.query.parse_lookup

2008-07-17 Thread Bill Totman

Well, I'm not sure of the nature of the patch, but I hope to find out
how to do so.

I'll be certain to pass on the HOWTO to you here - since you found out
the solution and all. I, too, and going through the book and would
like to make progress.

-Bill

On Jul 17, 4:03 pm, LRP <[EMAIL PROTECTED]> wrote:
> Hello,
>
> Still working my way through James Bennett's Practical Django
> Projects. Now on p. 64.
>
> I get this import error when I try to syncdb the Coltrane models.
>
>     from tagging.models import Tag
>   File "/usr/lib/python2.5/site-packages/tagging/models.py", line 9,
> in     from tagging.managers import TagManager,
> TaggedItemManager
>   File "/usr/lib/python2.5/site-packages/tagging/managers.py", line 6,
> in 
>     from django.db.models.query import QuerySet, parse_lookup
> ImportError: cannot import name parse_lookup
>
> Googling around I find this note:
>
> While the public interface for the ORM-layer should stay the same, the
> internals have undergone massive change. So if you're relying on some
> private part of the API, you will have to check if it still works.
> Affected of this if for example the popular django-tagging app (guess
> what it does ;-)) which in its current state (r132) uses the no longer
> available django.db.models.query.parse_lookup function. A patch by
> Joes Watts is available here and seems to solve this issue. For more
> details check out this ticket on django-tagging's google code project
> page.
>
> I've never patched code before. Can some kind soul please walk me
> through the process step-by-step so I can continue on to page 65?
>
> Many thanks,
>
> Lloyd

--~--~-~--~~~---~--~~
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: Turning on mod_python in Apache does not allow non-Django pages to rendor correctly

2008-07-17 Thread danielk



On Jul 16, 2:34 pm, "Karen Tracey" <[EMAIL PROTECTED]> wrote:
> On Wed, Jul 16, 2008 at 1:49 PM, danielk <[EMAIL PROTECTED]> wrote:
>
> > On Jul 16, 12:03 pm, "Karen Tracey" <[EMAIL PROTECTED]> wrote:
> > > On Wed, Jul 16, 2008 at 10:51 AM, danielk <[EMAIL PROTECTED]>
> > wrote:
>
> > > > I've been doing things with PHP (and phpDocumentor) and recently
> > > > started looking into Django.
>
> > > > I now have the following in my 'httpd.conf' file:
>
> > > > LoadModule python_module "C:/Progra~1/Apache~1/Apache2.2/modules/
> > > > mod_python.so"
> > > > 
> > > >    SetHandler python-program
> > > >    PythonHandler django.core.handlers.modpython
> > > >    SetEnv DJANGO_SETTINGS_MODULE mysite.settings
> > > >    PythonPath "['C:/home/python/django'] + sys.path"
> > > >    PythonDebug On
> > > > 
>
> > > > When I restart Apache, Django works ok but the documentation generated
> > > > with phpDocumentor does not rendor the page correctly. None of the
> > > > colors show up and the page is just not formatted correctly, like it
> > > > is not utilizing any CSS information.
>
> > > > If I uncomment those lines in 'httpd.conf' and then restart Apache
> > > > then the pages rendor correctly. The pages also rendor correctly if I
> > > > open them locally (ie not via http).
>
> > > > I'm sure this is a Django configuration issue, I'm just not all that
> > > > familiar with Django as yet.
>
> > > > Does anyone have any idea what I need to do to get Django to display
> > > > these pages correctly?
>
> > > It's not a Django configuration problem, it's an Apache configuration
> > > problem.  Your Location '/' block routes the entire site to Django.
> > > Presumably you have other Location blocks that are overriding this for
> > > specific prefixes (like the admin media and your phpDocumentor pages),
> > > because Django doesn't handle serving those pages.  It sounds like you
> > need
> > > another such override to handle the CSS for the phpDocumentor pages so
> > that
> > > they are served directly from Apache and not routed to Django at all.  To
> > do
> > > that you'll first need to determine what urls are being used for these
> > CSS
> > > files, I'm not familiar with this tool so I have no idea what they might
> > be.
>
> > > Karen
>
> > Thanks, that makes more sense, but I still do not understand what the
> > association is between the  in Apache and where my Django
> > code is.
>
> There isn't really any natural association between  and where your
> Django code lives.
>
>  blocks tell Apache how to match on and handle URLs, they have
> nothing to do with file system paths.
>
> By specifying "/" for your Django  block, you are telling Apache
> to route all URLs to be handled by Django.  Within that block you have also
> specified (in the PythonPath) where your Django code is, but the structure
> of that tree of code need not have any resemblance to the structure of the
> URLs your site supports.  How Django maps a given URL to a bit of code (a
> view) to run to produce the response for that URL is described here:
>
> http://www.djangoproject.com/documentation/url_dispatch/
>
> (Have you run through the Django tutorial on the website?  It might help
> clarify things as well.)
>
> > How do I tell Apache where my Django stuff is? If my Django stuff is
> > in 'C:\home\django\mysite\' then what would the  tag be? Or
> > is this a mod_python configuration issue? Or should I be asking this
> > on an Apache group?
>
> > All I'm trying to do is to get Django working so that it does not
> > interfere with any of the php stuff I already have working.
>
> > I apologize if this is the wrong forum to be asking this.
>
> First you need to decide what portion of your site's URLs should be handled
> by Django.  Perhaps you want to partition your URLs so that anything that
> starts with a certain prefix gets routed to Django, The first example here:
>
> http://www.djangoproject.com/documentation/modpython/
>
> shows a config that only routes URLs that start with 'mysite' to Django,
> thus all other URLs would be handled just as they had been before.  (Note I
> believe the prefix is present in the URLs handed to the Django code to
> process, so doing this would likely require that your Django url
> configuration be modified to expect this prefix.)
>
> Alternatively you can leave the Location "/" block pointing to Django and
> just add override blocks (ones that specify something more specific than
> "/") that include SetHandler None (or whatever is appropriate for whatever
> generates the content for the matching URLs).  Its hard to give any specific
> recommendations since I don't know what the URL space for your site looks
> like and have no familiarity with this php tool you are using.
>
> Karen

Well, I've got it working now, thanks to Karen.

The config now looks like this:


SetHandler python-program
PythonHandler django.core.handlers.modpython
SetEnv DJANGO_SETTINGS_MODULE mysite.settings
PythonPath "['C:/ho

Re: Source changes: How can I resolve import error -- cannot import django.db.models.query.parse_lookup

2008-07-17 Thread Bill Totman

Here's the solution (so far):

1) Obtain the SVN version of django-tagging.
2) Place it or link the 'tagging' directory step '1' provides you into
your $PYTHONPATH
3) python manage.py syncdb (in your 'cms' directory)

To give helpful info:
1) Obtain the SVN version of django-tagging:
run:
svn checkout http://django-tagging.googlecode.com/svn/trunk/ NEW-
OR-EXISTING-DIRECTORY-OF-YOUR-CHOICE
Look into your target directory, the one 'of-your-choice', and find
the 'tagging' directory. That's the directory you'll need for step
'2'.
2) Place it or link the 'tagging' directory step '1' provides you into
your $PYTHONPATH
I kind of have a crazy $PYTHONPATH. Django's main site should have
more info on it. But, I run Debian Lenny and when I include this path:
/usr/lib/python2.5/site-packages/
in my $PYTHONPATH 'syncdb' finds it. Either moving the 'tagging'
directory from the 'directory-of-your-choice' into the 'site-packages'
directory would do the trick. Or, you can link it... something like
this:
sudo ln -s /tagging /usr/lib/python2.5/
site-packages/


Once 'syncdb' finds the (svn version of the) 'tagging' directory in
the $PYTHONPATH it will do it's job.


I hope this helps. (I'm off to the book.)

-Bill


On Jul 17, 4:03 pm, LRP <[EMAIL PROTECTED]> wrote:
> Hello,
>
> Still working my way through James Bennett's Practical Django
> Projects. Now on p. 64.
>
> I get this import error when I try to syncdb the Coltrane models.
>
>     from tagging.models import Tag
>   File "/usr/lib/python2.5/site-packages/tagging/models.py", line 9,
> in     from tagging.managers import TagManager,
> TaggedItemManager
>   File "/usr/lib/python2.5/site-packages/tagging/managers.py", line 6,
> in 
>     from django.db.models.query import QuerySet, parse_lookup
> ImportError: cannot import name parse_lookup
>
> Googling around I find this note:
>
> While the public interface for the ORM-layer should stay the same, the
> internals have undergone massive change. So if you're relying on some
> private part of the API, you will have to check if it still works.
> Affected of this if for example the popular django-tagging app (guess
> what it does ;-)) which in its current state (r132) uses the no longer
> available django.db.models.query.parse_lookup function. A patch by
> Joes Watts is available here and seems to solve this issue. For more
> details check out this ticket on django-tagging's google code project
> page.
>
> I've never patched code before. Can some kind soul please walk me
> through the process step-by-step so I can continue on to page 65?
>
> Many thanks,
>
> Lloyd
--~--~-~--~~~---~--~~
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: Strange ProgrammingError - What causes it?

2008-07-17 Thread Karen Tracey
On Thu, Jul 17, 2008 at 5:02 PM, andrewljohnson <[EMAIL PROTECTED]>
wrote:

>
> Hi,
>
> I am getting a strange programming error, and I wonder what causes it?
>
> The Error
> 
> ProgrammingError at /trips/viewtrip/2/
> ERROR: current transaction is aborted, commands ignored until end of
> transaction block SET client_encoding to 'UNICODE'
>

This means a prior sql statement has generated an error that has caused the
database to ignore all subsequent statements issued by your transaction.


> This error is triggered by calling {{trip.owner}}
>

This isn't really the root problem, it's just where the previous error is
getting noticed.  Something is generating an error earlier, and for some
reason that one is being silently ignored, but the database has gotten into
a state where it refuses to do any more work on this transaction.


>
> If you go to this URL you will see the error in question (I have debug
> mode turned on): http://www.trailbehind.com/trips/viewtrip/2/
>
>
> A Couple of Notes
> ==
> 1) This error does not occur if you are logged in as the trip.owner
> (i.e. trip.owner == request.user).
>

So one place to start is to look at what you are doing differently in those
two code paths.  Also it seems like it must be someplace where you have
caught an exception and continued on (because I think the backend must be
raising an exception when the original error happens).  You've let your code
continue but the database is not in a state where it will do so.


>
> 2. This error doesn't occur on my development machine, and I think
> that may be because I am running a slightly different version of
> psycopg.
>

I thought this was fairly normal psycopg/PostgreSQL behavior and not
version-specific, but I don't have a lot of experience with that DB so I
could be wrong there.

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: Strange ProgrammingError - What causes it?

2008-07-17 Thread andrewljohnson

I am using the current SVN version.

On Jul 17, 4:14 pm, Julien Phalip <[EMAIL PROTECTED]> wrote:
> Which version of Django are you using?
>
> As a first attempt, I'd replace your __str__ method by __unicode__ and
> replace the calls to 'str' by 'unicode'.
>
> On Jul 18, 7:02 am, andrewljohnson <[EMAIL PROTECTED]> wrote:
>
> > Hi,
>
> > I am getting a strange programming error, and I wonder what causes it?
>
> > The Error
> > 
> > ProgrammingError at /trips/viewtrip/2/
> > ERROR: current transaction is aborted, commands ignored until end of
> > transaction block SET client_encoding to 'UNICODE'
>
> > This error is triggered by calling {{trip.owner}}
>
> > If you go to this URL you will see the error in question (I have debug
> > mode turned on):http://www.trailbehind.com/trips/viewtrip/2/
>
> > A Couple of Notes
> > ==
> > 1) This error does not occur if you are logged in as the trip.owner
> > (i.e. trip.owner == request.user).
>
> > 2. This error doesn't occur on my development machine, and I think
> > that may be because I am running a slightly different version of
> > psycopg.
>
> > 3. Here are my relevant models:
>
> > class Trip(models.Model):
> >     """A trip, future or present"""
> >     owner = models.ForeignKey("UserProfile", related_name="owner")
> >     start_date = models.DateField(null = True)
> >     end_date = models.DateField(null = True)
> >     time_created  = models.DateField(auto_now=True)
>
> >     park = models.ForeignKey(Park, blank = True, null = True)
> >     route = models.ManyToManyField(Trail, null = True, blank = True)
>
> >     comments = generic.GenericRelation(Comment, null = True, blank =
> > True)
>
> >     invitee_list = models.ManyToManyField("Invitee")
>
> >     def __str__(self):
> >         return  str(self.id)
>
> >     class Admin:
> >         pass
>
> > class UserProfile(models.Model):
> >     """Extra data about each user."""
>
> >     user = models.ForeignKey(User, unique=True, null=True, blank=True)
> >     summary = models.TextField(null=True)
> >     url = models.URLField(null=True)
> >     home_address = models.TextField(null=True)
> >     phone_number = models.PhoneNumberField(null=True)
> >     email_address = models.EmailField(null=True, unique=True)
> >     user_key = models.CharField(max_length=64, null=True)
>
> >     comments = generic.GenericRelation(Comment)
>
> >     def __str__(self):
> >         if self.user:
> >             return str(self.user)
> >         return str(False)
>
> >     class Admin:
> >         pass
>
> > Thanks for any help!
>
> > 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: Strange ProgrammingError - What causes it?

2008-07-17 Thread andrewljohnson

Thanks Karen... I'll poke around a bit.

On Jul 17, 4:44 pm, "Karen Tracey" <[EMAIL PROTECTED]> wrote:
> On Thu, Jul 17, 2008 at 5:02 PM, andrewljohnson <[EMAIL PROTECTED]>
> wrote:
>
>
>
> > Hi,
>
> > I am getting a strange programming error, and I wonder what causes it?
>
> > The Error
> > 
> > ProgrammingError at /trips/viewtrip/2/
> > ERROR: current transaction is aborted, commands ignored until end of
> > transaction block SET client_encoding to 'UNICODE'
>
> This means a prior sql statement has generated an error that has caused the
> database to ignore all subsequent statements issued by your transaction.
>
> > This error is triggered by calling {{trip.owner}}
>
> This isn't really the root problem, it's just where the previous error is
> getting noticed.  Something is generating an error earlier, and for some
> reason that one is being silently ignored, but the database has gotten into
> a state where it refuses to do any more work on this transaction.
>
>
>
> > If you go to this URL you will see the error in question (I have debug
> > mode turned on):http://www.trailbehind.com/trips/viewtrip/2/
>
> > A Couple of Notes
> > ==
> > 1) This error does not occur if you are logged in as the trip.owner
> > (i.e. trip.owner == request.user).
>
> So one place to start is to look at what you are doing differently in those
> two code paths.  Also it seems like it must be someplace where you have
> caught an exception and continued on (because I think the backend must be
> raising an exception when the original error happens).  You've let your code
> continue but the database is not in a state where it will do so.
>
>
>
> > 2. This error doesn't occur on my development machine, and I think
> > that may be because I am running a slightly different version of
> > psycopg.
>
> I thought this was fairly normal psycopg/PostgreSQL behavior and not
> version-specific, but I don't have a lot of experience with that DB so I
> could be wrong there.
>
> 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
-~--~~~~--~~--~--~---



NEED HELP BADLY

2008-07-17 Thread Kadusale, Myles
Good Day to all!

 

I just want to clarify my knowledge in Django

Because right now I am a little bit confused.

 

The views.py is the "controller" so this file is the

one who will be handling the POST and GET.

 

So there will be only one method that will be handling

the POST and GET for the whole application, so how can you differentiate
if the user is using the POST to save the Inventory items and not
Employee profiles?

 

Or I should have separate views.py for the Inventory items and Employee
profiles? 

If yes, so where should I put my main page where the user can login?

Or what should be the directory structure of my application?

 

Right now this is what my sample application looks like this

 

I hope this don't get distorted

 

DjangoProj [Directory]

  |

  | __init__.py

  | manage.py

  | settings.py

  | urls.py

  |App [Directory]

|

|- __init__.py

|- models.py  [ All
my models are here ]

|- views.py   [ this
is where my web app starts ]

|

|- Forms [Directory]

|   |

|   |-
__init__.py

|   |-
LoginFrm.py  [ used for login ]

|   |-
EmpFrm.py[ used for adding employee and their access rights. I
just extended user of Django ]

|   |-
InvItemFrm.py[ used for add, delete, edit, view items]

|   |-
RcveItemFrm.py   [ used for receiving items ]

|   |-
ReturnItemFrm.py [ used for returning items ]

|

|

|- Templates [Directory]  

|

|-
base.html[ this is the base for all templates and it has a
checking feature to detect if user has login]


|-
base_login.html  [ this is used for login ]

|-
base_menu.html   [ this is used for viewing the menu ]

|-
index.html   [ this is the first page of my web app where you login
]

|-
main.html[ this will come out after login in index.html ]

|-
aed_emp.html [ used for add, delete, edit, view employees and their
rights ]

|-
aed_item.html[ used for add, delete, edit, view items ]

|-
rcv_item.html[ used for receiving items ]

|-
rtrn_item.html   [ used for returning items ]

|-
vrcv_items.html  [ used for viewing all items recieved ]

|

|- CSS [Directory]   [this is
where I put my CSS files ]

|- Media [ Directory ]   [this is
where I put my images ]

|- scripts [ Directory ]  [this is
where I put my javascripts ]

 

 

Is this the best way to organize the files in Django?

 

If you have comments, suggestion, anything please reply.

Need some inputs about this.

 

Also in a web cart scenario where is the best area to put the data of
the items inside the cart?

Is it good to put the checking if the user has login in the base
template and check the rights of the user in each page?

 

Hope someone here could be kind enough to help.

 

 

Thanks in advance

Myles

 

 

 


--~--~-~--~~~---~--~~
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 HELP BADLY

2008-07-17 Thread Juanjo Conti

In views.py you define as many python functions as cotrollers you
want. Hech one has thsi signature:

def view1(request, *args, **kwargs)

You also have a urls.py file that maps urls to view functions.

-- 
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: NEED HELP BADLY

2008-07-17 Thread Joshua Jonah
Is this the best way to organize the files in Django?

Not important, it's personal taste.

Also in a web cart scenario where is the best area to put the data of 
the items inside the cart?


Umm, i would say in a database


Is it good to put the checking if the user has login in the base 
template and check the rights of the user in each page?

Yeah, that's usually how it's handled.



Kadusale, Myles wrote:
>
> Good Day to all!
>
>  
>
> I just want to clarify my knowledge in Django
>
> Because right now I am a little bit confused.
>
>  
>
> The views.py is the "controller" so this file is the
>
> one who will be handling the POST and GET.
>
>  
>
> So there will be only one method that will be handling
>
> the POST and GET for the whole application, so how can you 
> differentiate if the user is using the POST to save the Inventory 
> items and not Employee profiles?
>
>  
>
> Or I should have separate views.py for the Inventory items and 
> Employee profiles?
>
> If yes, so where should I put my main page where the user can login?
>
> Or what should be the directory structure of my application?
>
>  
>
> Right now this is what my sample application looks like this
>
>  
>
> I hope this don't get distorted
>
>  
>
> DjangoProj [Directory]
>
>   |
>
>   | __init__.py
>
>   | manage.py
>
>   | settings.py
>
>   | urls.py
>
>   |App [Directory]
>
> |
>
> |- __init__.py
>
> |- models.py  [ 
> All my models are here ]
>
> |- views.py   [ 
> this is where my web app starts ]
>
> |
>
> |- Forms [Directory]
>
> |   |
>
> |   |- 
> __init__.py
>
> |   |- 
> LoginFrm.py  [ used for login ]
>
> |   |- 
> EmpFrm.py[ used for adding employee and their access rights. I 
> just extended user of Django ]
>
> |   |- 
> InvItemFrm.py[ used for add, delete, edit, view items]
>
> |   |- 
> RcveItemFrm.py   [ used for receiving items ]
>
> |   |- 
> ReturnItemFrm.py [ used for returning items ]
>
> |
>
> |
>
> |- Templates [Directory] 
>
> |
>
> |- 
> base.html[ this is the base for all templates and it has a 
> checking feature to detect if user has 
> login]  
>
> |- 
> base_login.html  [ this is used for login ]
>
> |- 
> base_menu.html   [ this is used for viewing the menu ]
>
> |- 
> index.html   [ this is the first page of my web app where you login ]
>
> |- 
> main.html[ this will come out after login in index.html ]
>
> |- 
> aed_emp.html [ used for add, delete, edit, view employees and 
> their rights ]
>
> |- 
> aed_item.html[ used for add, delete, edit, view items ]
>
> |- 
> rcv_item.html[ used for receiving items ]
>
> |- 
> rtrn_item.html   [ used for returning items ]
>
> |- 
> vrcv_items.html  [ used for viewing all items recieved ]
>
> |
>
> |- CSS [Directory]   [this is 
> where I put my CSS files ]
>
> |- Media [ Directory ]   [this is 
> where I put my images ]
>
> |- scripts [ Directory ]  [this is 
> where I put my javascripts ]
>
>  
>
>  
>
> Is this the best way to organize the files in Django?
>
>  
>
> If you have comments, suggestion, anything please reply.
>
> Need some inputs about this.
>
>  
>
> Also in a web cart scenario where is the best area to put the data of 
> the items inside the cart?
>
> Is it good to put the chec

Re: NEED HELP BADLY

2008-07-17 Thread TiNo
How about:http://www.djangoproject.com/documentation/tutorial03/



On Fri, Jul 18, 2008 at 4:53 AM, Joshua Jonah <[EMAIL PROTECTED]> wrote:

>  Is this the best way to organize the files in Django?
>
> Not important, it's personal taste.
>
>  Also in a web cart scenario where is the best area to put the data of the
> items inside the cart?
>
>
>  Umm, i would say in a database
>
> Is it good to put the checking if the user has login in the base template
> and check the rights of the user in each page?
>
> Yeah, that's usually how it's handled.
>
>
>
>
> Kadusale, Myles wrote:
>
>  Good Day to all!
>
>
>
> I just want to clarify my knowledge in Django
>
> Because right now I am a little bit confused.
>
>
>
> The views.py is the "controller" so this file is the
>
> one who will be handling the POST and GET.
>
>
>
> So there will be only one method that will be handling
>
> the POST and GET for the whole application, so how can you differentiate if
> the user is using the POST to save the Inventory items and not Employee
> profiles?
>
>
>
> Or I should have separate views.py for the Inventory items and Employee
> profiles?
>
> If yes, so where should I put my main page where the user can login?
>
> Or what should be the directory structure of my application?
>
>
>
> Right now this is what my sample application looks like this
>
>
>
> I hope this don't get distorted
>
>
>
> DjangoProj [Directory]
>
>   |
>
>   | __init__.py
>
>   | manage.py
>
>   | settings.py
>
>   | urls.py
>
>   |App [Directory]
>
> |
>
> |- __init__.py
>
> |- models.py  [ All my
> models are here ]
>
> |- views.py   [ this is
> where my web app starts ]
>
> |
>
> |- Forms [Directory]
>
> |   |
>
> |   |-
> __init__.py
>
> |   |-
> LoginFrm.py  [ used for login ]
>
> |   |-
> EmpFrm.py[ used for adding employee and their access rights. I just
> extended user of Django ]
>
> |   |-
> InvItemFrm.py[ used for add, delete, edit, view items]
>
> |   |-
> RcveItemFrm.py   [ used for receiving items ]
>
> |   |-
> ReturnItemFrm.py [ used for returning items ]
>
> |
>
> |
>
> |- Templates [Directory]
>
> |
>
> |-
> base.html[ this is the base for all templates and it has a checking
> feature to detect if user has login]
>
> |-
> base_login.html  [ this is used for login ]
>
> |-
> base_menu.html   [ this is used for viewing the menu ]
>
> |-
> index.html   [ this is the first page of my web app where you login ]
>
> |-
> main.html[ this will come out after login in index.html ]
>
> |-
> aed_emp.html [ used for add, delete, edit, view employees and their
> rights ]
>
> |-
> aed_item.html[ used for add, delete, edit, view items ]
>
> |-
> rcv_item.html[ used for receiving items ]
>
> |-
> rtrn_item.html   [ used for returning items ]
>
> |-
> vrcv_items.html  [ used for viewing all items recieved ]
>
> |
>
> |- CSS [Directory]   [this is where
> I put my CSS files ]
>
> |- Media [ Directory ]   [this is where
> I put my images ]
>
> |- scripts [ Directory ]  [this is
> where I put my javascripts ]
>
>
>
>
>
> Is this the best way to organize the files in Django?
>
>
>
> If you have comments, suggestion, anything please reply.
>
> Need some inputs about this.
>
>
>
> Also in a web cart scenario where is the best

Re: NEED HELP BADLY

2008-07-17 Thread Dan
On Thu, Jul 17, 2008 at 10:53 PM, Joshua Jonah <[EMAIL PROTECTED]> wrote:

>  Is this the best way to organize the files in Django?
>
> Not important, it's personal taste.
>

Although, it is most of the time preferable to use regex group in your URLs
rather than GET. It looks much nicer.

--~--~-~--~~~---~--~~
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 HELP BADLY

2008-07-17 Thread Kadusale, Myles
 

IndexPage.py




def index_page(request):

lgFrm = LoginForm()

 

 

#-- I this the only place where I should handle the POST

#-- or I could put the function to handle the POST in the Form
presented below

 

if request.method == 'POST':

#-- Do something



return render_to_response('index.html',{'lgForm':lgFrm})




 

 

LoginFrm.py




from django import newforms as forms

 

class LoginForm(forms.Form):

username = forms.CharField(max_length=30)

password = forms.CharField(max_length=20,
widget=forms.PasswordInput())

 

 

handler(request):

if request.method == 'POST':

#--- Do something

 

 

 



From: django-users@googlegroups.com
[mailto:[EMAIL PROTECTED] On Behalf Of Dan
Sent: Friday, July 18, 2008 11:25 AM
To: django-users@googlegroups.com
Subject: Re: NEED HELP BADLY

 

 

On Thu, Jul 17, 2008 at 10:53 PM, Joshua Jonah <[EMAIL PROTECTED]>
wrote:

Is this the best way to organize the files in Django?

Not important, it's personal taste.

 


Although, it is most of the time preferable to use regex group in your
URLs rather than GET. It looks much nicer.




--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



64 bit integer field

2008-07-17 Thread simon


How do i create a long long integer field in my model ? Do I use
decimal ? (worried about performance of the decimal field). I am using
the mysql backend.

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
-~--~~~~--~~--~--~---