Re: Subclassing CommentForm

2009-02-07 Thread Shantp

Wow. Just removing the () after my subclassed commentform worked.
Thanks a lot. I hope that ticket is completed soon and added into
django.

On Feb 7, 8:31 pm, Eric Abrahamsen  wrote:
> On Feb 8, 2009, at 12:15 PM, Shantp wrote:
>
>
>
>
>
> > Hi,
>
> > I've got a custom comment form in my template using "get_comment_form"
> > and I'd like email to not be required. From some searching I see that
> > I need to subclass the CommentForm, but I don't know exactly how to go
> > about this. Here's what I put into my forms.py
>
> > from django.contrib.comments.forms import CommentForm
> > class EmailFreeCommentForm(CommentForm):
> >    email = forms.EmailField(label='Email address', required=False)
>
> > Then I put this in my urls.py
>
> > from django.contrib import admin, comments
> > from sharing.forms import EmailFreeCommentForm
> > def override_get_form():
> >    return EmailFreeCommentForm()
>
> > comments.get_form = override_get_form
>
> > This is giving me errors. Am I missing something?
>
> This is how I do it:
>
> def my_get_form():
>      return MyCommentForm
>
> comments.get_form = my_get_form
>
> This is a monkeypatch and not the way it should be done, but full  
> customizability for the comments app is a work in progress (see ticket  
> #8630http://code.djangoproject.com/ticket/8630), and until that's  
> finished I think this is what people are doing.
>
> Yours,
> Eric
>
> > If you can point me towards good subclassing docs that would be
> > appreciated as well. 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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Subclassing CommentForm

2009-02-07 Thread Shantp

Hi,

I've got a custom comment form in my template using "get_comment_form"
and I'd like email to not be required. From some searching I see that
I need to subclass the CommentForm, but I don't know exactly how to go
about this. Here's what I put into my forms.py

from django.contrib.comments.forms import CommentForm
class EmailFreeCommentForm(CommentForm):
email = forms.EmailField(label='Email address', required=False)

Then I put this in my urls.py

from django.contrib import admin, comments
from sharing.forms import EmailFreeCommentForm
def override_get_form():
return EmailFreeCommentForm()

comments.get_form = override_get_form

This is giving me errors. Am I missing something?

If you can point me towards good subclassing docs that would be
appreciated as well. 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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: syncdb Issue: OneToOneField with User model from contrib.admin

2009-02-07 Thread elith...@gmail.com

Worked perfectly - thanks very much.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Memory Leaks

2009-02-07 Thread Alex Gaynor
On Sat, Feb 7, 2009 at 10:27 PM, python6009  wrote:

>
> Hi,
>
> I am using matplotlib/pyplot on my site to dynamically generate PNG
> plots. And I am experiencing dramatic memory leaks. Within 10-15
> hits,  my Apache process grows from 15-20M to 100M.
>
> I am using Django 1.0.2-final, Apache 2.2.1, Python 2.4.3, matplotlib
> 0.98.5.2. The leak happens under both Apache (with mod_wsgi 2.3) and
> the development server. My OS is RHEL5.
>
> Below is a simple code snippet that causes the leak. Please let me
> know if I am doing something wrong or if there is a better way to
> write this. Thanks.
>
>
>
> from matplotlib import pyplot
>
> def test_graph (request):
>
>f = pyplot.figure()
>ax = f.add_subplot(111)
>ax.plot([1,2,3])
>
>ax.fill_between([1,2,3],[1,2,3],[1.1,2.1,3.1])
>
>ax.grid(True)
>ax.legend(['hello'],
>  'upper right', shadow=True, fancybox=True)
>ax.set_xlabel('Time')
>ax.set_ylabel('Value ')
>
>f.text(.5, 0.93, 'my title', horizontalalignment='center')
>
>response = HttpResponse(content_type='image/png')
>
> ### both ways causes a leak
>
>f.savefig( response, format = 'png' )
> OR
>canvas = FigureCanvas(f)
>canvas.print_png(response)
>canvas = None
>
>ax = None
>f = None
>
>return response
>
>
> >
>
Django isn't known to leak memory and nothing you're doing here is
particularly uncommon, or outlandish so I'd guess the issue is with
matplotlib, I'd try asking on their mailing list if there are any known
issues.

Alex

-- 
"I disapprove of what you say, but I will defend to the death your right to
say it." --Voltaire
"The people's good is the highest law."--Cicero

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Memory Leaks

2009-02-07 Thread python6009

Hi,

I am using matplotlib/pyplot on my site to dynamically generate PNG
plots. And I am experiencing dramatic memory leaks. Within 10-15
hits,  my Apache process grows from 15-20M to 100M.

I am using Django 1.0.2-final, Apache 2.2.1, Python 2.4.3, matplotlib
0.98.5.2. The leak happens under both Apache (with mod_wsgi 2.3) and
the development server. My OS is RHEL5.

Below is a simple code snippet that causes the leak. Please let me
know if I am doing something wrong or if there is a better way to
write this. Thanks.



from matplotlib import pyplot

def test_graph (request):

f = pyplot.figure()
ax = f.add_subplot(111)
ax.plot([1,2,3])

ax.fill_between([1,2,3],[1,2,3],[1.1,2.1,3.1])

ax.grid(True)
ax.legend(['hello'],
  'upper right', shadow=True, fancybox=True)
ax.set_xlabel('Time')
ax.set_ylabel('Value ')

f.text(.5, 0.93, 'my title', horizontalalignment='center')

response = HttpResponse(content_type='image/png')

### both ways causes a leak

f.savefig( response, format = 'png' )
OR
canvas = FigureCanvas(f)
canvas.print_png(response)
canvas = None

ax = None
f = None

return response


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: external non-ascii character is breaking my script

2009-02-07 Thread Alex Gaynor
On Sat, Feb 7, 2009 at 8:25 PM, redmonkey wrote:

>
> Thank you very much. That solved it, gave me all the information I
> needed to not make the same mistake again, and taught me a quick way
> to check the encoding of strings in python.
>
> As it happen, in this case, the script that generates the external
> file is some commercial software, so I can't touch it. It all seems to
> work though.
>
> Thanks again,
>
> RM
>
> On Feb 8, 12:57 am, Karen Tracey  wrote:
> > On Sat, Feb 7, 2009 at 7:27 PM, redmonkey  >wrote:
> >
> >
> >
> >
> >
> > > Sure, here's a bit more info.
> >
> > > The external data is generated by a script and it describes a
> > > catalogue of lot items for an auction site I'm building. The format
> > > includes a lot number, a brief description of the lot for sale, and an
> > > estimate for the item. Each lot is separated in the file by a '$' with
> > > some whitespace. Here's a snippet:
> >
> > > $
> > >  292 A collection of wine bottle and trinket boxes
> > > Est. 30-60
> > > $
> > >  293 A paper maché letter rack with painted foliate decoration and a
> > > C19th papier mache side chair and one other (a/f)
> > > Est. 20-30
> > > $
> > >  294 A wall mirror with bevelled plate within gilt frame
> > > Est. 40-60
> >
> > And this file is encoded in...?  It doesn't appear to be utf-8.  It may
> be
> > iso8859-1.
> >
> >  [snip]
> >
> >
> >
> >
> >
> > > And here's that handle_data_upload function (it's passed the uploaded
> > > file object):
> >
> > > def handle_data_upload(f, cat):
> > >"""
> > >Creates and Adds lots to catalogue.
> >
> > >"""
> >
> > >lot = re.compile(r'\s*(?P\d*) (?P.*)
> > > \s*Est. (?P\d*)-(?P\d*)')
> > >iterator = lot.finditer(f.read())
> > >f.close()
> >
> > >for item in iterator:
> > >if not item.group('description') == "end":
> > >Lot.objects.create(
> > >lot_number=int(item.group('lot_number')),
> > >description=item.group('description').strip(),
> >
> > Here you are setting description to a bytestring read from your file.
>  When
> > you don't pass Unicode to Django, Django will convert to unicode assuming
> a
> > utf-8 encoding, which will cause the error you are getting if the file is
> > not in fact using utf-8 as the encoding.  I suspect your file is encoded
> in
> > iso8859-1, in which case changing this line to:
> >
> > description=unicode(item.group('description').strip(), 'iso8859-1')
> >
> > Will probably fix the problem.  But, you should verify that that is the
> > encoding used by whatever is creating the file, and if possible you might
> > want to change whatever is creating the file to use utf-8 for the
> encoding,
> > if possible (and if these files aren't fed into other processes that
> might
> > get confused by changing their encoding).
> >
> > [snip]
> >
> > File "/Library/Python/2.5/site-packages/django/utils/encoding.py" in
> >
> > > force_unicode
> > >  70. raise DjangoUnicodeDecodeError(s, *e.args)
> >
> > > Exception Type: DjangoUnicodeDecodeError at /admin/catalogue/catalogue/
> > > add/
> > > Exception Value: 'utf8' codec can't decode bytes in position 12-14:
> > > invalid data. You passed in 'A paper mach\xe9 letter rack with painted
> > > foliate decoration and a C19th papier mache side chair and one other
> > > (a/f)' ()
> >
> > This is why I think your file is using iso889-1:
> >
> > Python 2.5.1 (r251:54863, Jul 31 2008, 23:17:40)
> > [GCC 4.1.3 20070929 (prerelease) (Ubuntu 4.1.2-16ubuntu2)] on linux2
> > Type "help", "copyright", "credits" or "license" for more information.>>>
> s = 'A paper mach\xe9 letter rack'
> > >>> print unicode(s, 'utf-8')
> >
> > Traceback (most recent call last):
> >   File "", line 1, in 
> > UnicodeDecodeError: 'utf8' codec can't decode bytes in position 12-14:
> > invalid data>>> print unicode(s, 'iso8859-1')
> >
> > A paper maché letter rack
> >
> >
> >
> > The one that causes the error is what Django does when handed a
> bytestring,
> > and matches what you are seeing.  Using iso8859-1 as the encoding makes
> the
> > value convert and print properly (plus it's a popular encoding).
> >
> >
> >
> > > I hope that clears a few things up.
> >
> > > Is this an admin thing? (http://www.factory-h.com/blog/?p=56)
> >
> > No, in that blog post the user had a broken __unicode__ method in their
> > model, it wasn't actually an admin problem.
> >
> > Karen
> >
>
FYI when you want to open a file with a specific encoding but deal with it
as unicode the python codecs library is great:
http://docs.python.org/library/codecs.html#codecs.open

Alex

-- 
"I disapprove of what you say, but I will defend to the death your right to
say it." --Voltaire
"The people's good is the highest law."--Cicero

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" 

Re: external non-ascii character is breaking my script

2009-02-07 Thread redmonkey

Thank you very much. That solved it, gave me all the information I
needed to not make the same mistake again, and taught me a quick way
to check the encoding of strings in python.

As it happen, in this case, the script that generates the external
file is some commercial software, so I can't touch it. It all seems to
work though.

Thanks again,

RM

On Feb 8, 12:57 am, Karen Tracey  wrote:
> On Sat, Feb 7, 2009 at 7:27 PM, redmonkey 
> wrote:
>
>
>
>
>
> > Sure, here's a bit more info.
>
> > The external data is generated by a script and it describes a
> > catalogue of lot items for an auction site I'm building. The format
> > includes a lot number, a brief description of the lot for sale, and an
> > estimate for the item. Each lot is separated in the file by a '$' with
> > some whitespace. Here's a snippet:
>
> > $
> >  292 A collection of wine bottle and trinket boxes
> >     Est. 30-60
> > $
> >  293 A paper maché letter rack with painted foliate decoration and a
> > C19th papier mache side chair and one other (a/f)
> >     Est. 20-30
> > $
> >  294 A wall mirror with bevelled plate within gilt frame
> >     Est. 40-60
>
> And this file is encoded in...?  It doesn't appear to be utf-8.  It may be
> iso8859-1.
>
>  [snip]
>
>
>
>
>
> > And here's that handle_data_upload function (it's passed the uploaded
> > file object):
>
> > def handle_data_upload(f, cat):
> >    """
> >    Creates and Adds lots to catalogue.
>
> >    """
>
> >    lot = re.compile(r'\s*(?P\d*) (?P.*)
> > \s*Est. (?P\d*)-(?P\d*)')
> >    iterator = lot.finditer(f.read())
> >    f.close()
>
> >    for item in iterator:
> >        if not item.group('description') == "end":
> >            Lot.objects.create(
> >                lot_number=int(item.group('lot_number')),
> >                description=item.group('description').strip(),
>
> Here you are setting description to a bytestring read from your file.  When
> you don't pass Unicode to Django, Django will convert to unicode assuming a
> utf-8 encoding, which will cause the error you are getting if the file is
> not in fact using utf-8 as the encoding.  I suspect your file is encoded in
> iso8859-1, in which case changing this line to:
>
> description=unicode(item.group('description').strip(), 'iso8859-1')
>
> Will probably fix the problem.  But, you should verify that that is the
> encoding used by whatever is creating the file, and if possible you might
> want to change whatever is creating the file to use utf-8 for the encoding,
> if possible (and if these files aren't fed into other processes that might
> get confused by changing their encoding).
>
> [snip]
>
> File "/Library/Python/2.5/site-packages/django/utils/encoding.py" in
>
> > force_unicode
> >  70.         raise DjangoUnicodeDecodeError(s, *e.args)
>
> > Exception Type: DjangoUnicodeDecodeError at /admin/catalogue/catalogue/
> > add/
> > Exception Value: 'utf8' codec can't decode bytes in position 12-14:
> > invalid data. You passed in 'A paper mach\xe9 letter rack with painted
> > foliate decoration and a C19th papier mache side chair and one other
> > (a/f)' ()
>
> This is why I think your file is using iso889-1:
>
> Python 2.5.1 (r251:54863, Jul 31 2008, 23:17:40)
> [GCC 4.1.3 20070929 (prerelease) (Ubuntu 4.1.2-16ubuntu2)] on linux2
> Type "help", "copyright", "credits" or "license" for more information.>>> s = 
> 'A paper mach\xe9 letter rack'
> >>> print unicode(s, 'utf-8')
>
> Traceback (most recent call last):
>   File "", line 1, in 
> UnicodeDecodeError: 'utf8' codec can't decode bytes in position 12-14:
> invalid data>>> print unicode(s, 'iso8859-1')
>
> A paper maché letter rack
>
>
>
> The one that causes the error is what Django does when handed a bytestring,
> and matches what you are seeing.  Using iso8859-1 as the encoding makes the
> value convert and print properly (plus it's a popular encoding).
>
>
>
> > I hope that clears a few things up.
>
> > Is this an admin thing? (http://www.factory-h.com/blog/?p=56)
>
> No, in that blog post the user had a broken __unicode__ method in their
> model, it wasn't actually an admin problem.
>
> 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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: optional foreign key

2009-02-07 Thread Alex Gaynor
On Sat, Feb 7, 2009 at 8:08 PM, J  wrote:

>  Truly amazing. I would have never guessed that the OR operator would
> combine two querysets. How does that work?
>
> Thanks for your help. You solved my problem.
> J
>
>
>
>
> Russell Keith-Magee wrote:
>
> On Sun, Feb 8, 2009 at 8:03 AM, J   
> wrote:
>
>
>  The idea is to be able to query all the items that have a specific 'group'
> record chosen, as well as all items that don't have anything set. Since some
> of them can be NULL or None, how do I go about selecting in a query both the
> items that are NULL, as well as the items that are linked to a specific
> 'group' in the related table?
>
> This does not work:
> qs = menuitem.objects.all().filter(group__in=[None, 1])
>
> This works:
> qs = menuitem.objects.all().filter(group=None)
>
> This works:
> qs = menuitem.objects.all().filter(group=1)
>
>
>  The confusion here is the result of a little concept leakage on the
> part of the Django ORM.
>
> In SQL, you can't actually ask for a field that is " = NULL", because
> by definition, _nothing_ is equal to NULL. Django helps out here by
> rolling out "group=None" filters to the SQL "group IS NULL"
>
> When you ask for the query group__in=[None, 1], this will roll out as
> "group IN (NULL, 1)", which obviously won't work for the NULL case.
>
> What you need to do is use an OR to combine your the two queries that
> work, making a special case of the NULL option:
>
> qs = menuitem.objects.all().filter(group=None) |
> menuitem.objects.all().filter(group=1)
>
> If you have multiple non-null groups that you want to compare to, you
> can use the __in operator on the second clause:
>
> qs = menuitem.objects.all().filter(group=None) |
> menuitem.objects.all().filter(group__in=[1,2])
>
> You just can't include the None in the __in - it needs to be made a
> special case.
>
> Yours,
> Russ Magee %-)
>
>
>
>
>
>
>
> >
>
__or__ on an object allows you to define the behavior on a or.
http://code.djangoproject.com/browser/django/trunk/django/db/models/query.py#L251is
the magic that makes it happen

-- 
"I disapprove of what you say, but I will defend to the death your right to
say it." --Voltaire
"The people's good is the highest law."--Cicero

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: optional foreign key

2009-02-07 Thread J
Truly amazing. I would have never guessed that the OR operator would
combine two querysets. How does that work?

Thanks for your help. You solved my problem.
J



Russell Keith-Magee wrote:
> On Sun, Feb 8, 2009 at 8:03 AM, J  wrote:
>   
>> The idea is to be able to query all the items that have a specific 'group'
>> record chosen, as well as all items that don't have anything set. Since some
>> of them can be NULL or None, how do I go about selecting in a query both the
>> items that are NULL, as well as the items that are linked to a specific
>> 'group' in the related table?
>>
>> This does not work:
>> qs = menuitem.objects.all().filter(group__in=[None, 1])
>>
>> This works:
>> qs = menuitem.objects.all().filter(group=None)
>>
>> This works:
>> qs = menuitem.objects.all().filter(group=1)
>> 
>
> The confusion here is the result of a little concept leakage on the
> part of the Django ORM.
>
> In SQL, you can't actually ask for a field that is " = NULL", because
> by definition, _nothing_ is equal to NULL. Django helps out here by
> rolling out "group=None" filters to the SQL "group IS NULL"
>
> When you ask for the query group__in=[None, 1], this will roll out as
> "group IN (NULL, 1)", which obviously won't work for the NULL case.
>
> What you need to do is use an OR to combine your the two queries that
> work, making a special case of the NULL option:
>
> qs = menuitem.objects.all().filter(group=None) |
> menuitem.objects.all().filter(group=1)
>
> If you have multiple non-null groups that you want to compare to, you
> can use the __in operator on the second clause:
>
> qs = menuitem.objects.all().filter(group=None) |
> menuitem.objects.all().filter(group__in=[1,2])
>
> You just can't include the None in the __in - it needs to be made a
> special case.
>
> 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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: external non-ascii character is breaking my script

2009-02-07 Thread Karen Tracey
On Sat, Feb 7, 2009 at 7:27 PM, redmonkey wrote:

>
> Sure, here's a bit more info.
>
> The external data is generated by a script and it describes a
> catalogue of lot items for an auction site I'm building. The format
> includes a lot number, a brief description of the lot for sale, and an
> estimate for the item. Each lot is separated in the file by a '$' with
> some whitespace. Here's a snippet:
>
> $
>  292 A collection of wine bottle and trinket boxes
> Est. 30-60
> $
>  293 A paper maché letter rack with painted foliate decoration and a
> C19th papier mache side chair and one other (a/f)
> Est. 20-30
> $
>  294 A wall mirror with bevelled plate within gilt frame
> Est. 40-60
>

And this file is encoded in...?  It doesn't appear to be utf-8.  It may be
iso8859-1.

 [snip]

>
> And here's that handle_data_upload function (it's passed the uploaded
> file object):
>
> def handle_data_upload(f, cat):
>"""
>Creates and Adds lots to catalogue.
>
>"""
>
>lot = re.compile(r'\s*(?P\d*) (?P.*)
> \s*Est. (?P\d*)-(?P\d*)')
>iterator = lot.finditer(f.read())
>f.close()
>
>for item in iterator:
>if not item.group('description') == "end":
>Lot.objects.create(
>lot_number=int(item.group('lot_number')),
>description=item.group('description').strip(),


Here you are setting description to a bytestring read from your file.  When
you don't pass Unicode to Django, Django will convert to unicode assuming a
utf-8 encoding, which will cause the error you are getting if the file is
not in fact using utf-8 as the encoding.  I suspect your file is encoded in
iso8859-1, in which case changing this line to:

description=unicode(item.group('description').strip(), 'iso8859-1')

Will probably fix the problem.  But, you should verify that that is the
encoding used by whatever is creating the file, and if possible you might
want to change whatever is creating the file to use utf-8 for the encoding,
if possible (and if these files aren't fed into other processes that might
get confused by changing their encoding).

[snip]

File "/Library/Python/2.5/site-packages/django/utils/encoding.py" in
> force_unicode
>  70. raise DjangoUnicodeDecodeError(s, *e.args)
>
> Exception Type: DjangoUnicodeDecodeError at /admin/catalogue/catalogue/
> add/
> Exception Value: 'utf8' codec can't decode bytes in position 12-14:
> invalid data. You passed in 'A paper mach\xe9 letter rack with painted
> foliate decoration and a C19th papier mache side chair and one other
> (a/f)' ()



This is why I think your file is using iso889-1:

Python 2.5.1 (r251:54863, Jul 31 2008, 23:17:40)
[GCC 4.1.3 20070929 (prerelease) (Ubuntu 4.1.2-16ubuntu2)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> s = 'A paper mach\xe9 letter rack'
>>> print unicode(s, 'utf-8')
Traceback (most recent call last):
  File "", line 1, in 
UnicodeDecodeError: 'utf8' codec can't decode bytes in position 12-14:
invalid data
>>> print unicode(s, 'iso8859-1')
A paper maché letter rack
>>>

The one that causes the error is what Django does when handed a bytestring,
and matches what you are seeing.  Using iso8859-1 as the encoding makes the
value convert and print properly (plus it's a popular encoding).


>
> I hope that clears a few things up.
>
> Is this an admin thing? (http://www.factory-h.com/blog/?p=56)
>

No, in that blog post the user had a broken __unicode__ method in their
model, it wasn't actually an admin problem.

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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: external non-ascii character is breaking my script

2009-02-07 Thread redmonkey

Sure, here's a bit more info.

The external data is generated by a script and it describes a
catalogue of lot items for an auction site I'm building. The format
includes a lot number, a brief description of the lot for sale, and an
estimate for the item. Each lot is separated in the file by a '$' with
some whitespace. Here's a snippet:

$
 292 A collection of wine bottle and trinket boxes
 Est. 30-60
$
 293 A paper maché letter rack with painted foliate decoration and a
C19th papier mache side chair and one other (a/f)
 Est. 20-30
$
 294 A wall mirror with bevelled plate within gilt frame
 Est. 40-60

I've got a regular expression to extract out all the bits I need from
the external file:

lot = re.compile(r'\s*(?P\d*) (?P.*)\s*Est. (?
P\d*)-(?P\d*)')

This information is extracted when this file is submitted to an 'add
new catalogue' form in Django's admin interface:

class CatalogueAdmin(admin.ModelAdmin):
# ...
def save_model(self, request, obj, form, change):
"""
Check for an attached data file, if instance is being created,
also
creates models within data file.
"""
obj.save()
if not change and form.cleaned_data['data']:
# Creating a new catalogue
handle_data_upload(form.cleaned_data['data'], obj)

And here's that handle_data_upload function (it's passed the uploaded
file object):

def handle_data_upload(f, cat):
"""
Creates and Adds lots to catalogue.

"""

lot = re.compile(r'\s*(?P\d*) (?P.*)
\s*Est. (?P\d*)-(?P\d*)')
iterator = lot.finditer(f.read())
f.close()

for item in iterator:
if not item.group('description') == "end":
Lot.objects.create(
lot_number=int(item.group('lot_number')),
description=item.group('description').strip(),
min_estimate=Decimal(item.group('min_estimate')),
max_estimate=Decimal(item.group('max_estimate')),
catalogue=cat
)

Again, this all seems to work fine until Django come across the "é" in
the external data when it decides to throw this error:

Environment:

Request Method: POST
Request URL: http://192.168.0.2:8000/admin/catalogue/catalogue/add/
Django Version: 1.1 pre-alpha SVN-9646
Python Version: 2.5.1
Installed Applications:
['django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.sites',
 'django.contrib.admin',
 'auction.catalogue',
 'auction.mailouts',
 'auction.users',
 'auction.bidding',
 'django.contrib.flatpages',
 'profiles',
 'registration',
 'django_extensions',
 'tinymce',
 'auction.lot-alerts']
Installed Middleware:
('django.middleware.common.CommonMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.flatpages.middleware.FlatpageFallbackMiddleware')


Traceback:
File "/Library/Python/2.5/site-packages/django/core/handlers/base.py"
in get_response
  86. response = callback(request, *callback_args,
**callback_kwargs)
File "/Library/Python/2.5/site-packages/django/contrib/admin/sites.py"
in root
  157. return self.model_page(request, *url.split('/',
2))
File "/Library/Python/2.5/site-packages/django/views/decorators/
cache.py" in _wrapped_view_func
  44. response = view_func(request, *args, **kwargs)
File "/Library/Python/2.5/site-packages/django/contrib/admin/sites.py"
in model_page
  176. return admin_obj(request, rest_of_url)
File "/Library/Python/2.5/site-packages/django/contrib/admin/
options.py" in __call__
  191. return self.add_view(request)
File "/Library/Python/2.5/site-packages/django/db/transaction.py" in
_commit_on_success
  238. res = func(*args, **kw)
File "/Library/Python/2.5/site-packages/django/contrib/admin/
options.py" in add_view
  494. self.save_model(request, new_object, form,
change=False)
File "/Library/Python/2.5/site-packages/auction/catalogue/admin.py" in
save_model
  34. handle_data_upload(form.cleaned_data['data'], obj)
File "/Library/Python/2.5/site-packages/auction/catalogue/utils.py" in
handle_data_upload
  27. catalogue=cat
File "/Library/Python/2.5/site-packages/django/db/models/manager.py"
in create
  99. return self.get_query_set().create(**kwargs)
File "/Library/Python/2.5/site-packages/django/db/models/query.py" in
create
  319. obj.save(force_insert=True)
File "/Library/Python/2.5/site-packages/auction/catalogue/models.py"
in save
  170. super(Lot, self).save(kwargs)
File "/Library/Python/2.5/site-packages/django/db/models/base.py" in
save
  328. self.save_base(force_insert=force_insert,
force_update=force_update)
File "/Library/Python/2.5/site-packages/django/db/models/base.py" in
save_base
  400. result = manager._insert(values,
return_id=update_pk)
File 

Re: external non-ascii character is breaking my script

2009-02-07 Thread Karen Tracey
On Sat, Feb 7, 2009 at 11:56 AM, redmonkey wrote:

>
> Hey everyone,
>
> I'm trying to create django model instances from data stored in a flat
> text file but I get `force_unicode` errors when the script comes
> across one of the data items containing the "é" character.
>
> Can anyone explain to me what this problem is and now I can fix it? I
> can't really get my head around unicode, ascii and UTF-8 stuff.
>
>
If you expect anyone on the list to help, you really need to share some
snippets of the code you are using to read the data from the file and create
Django model instances, plus the full traceback you get when it runs into
trouble.  Django certainly handles unicode data in models, so there's
something specific about what you are doing that is causing a problem.

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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Modify label from field.label_tag

2009-02-07 Thread Russell Keith-Magee

On Sun, Feb 8, 2009 at 7:08 AM, Kless  wrote:
>
> Thanks Russel for your fast reply.
> My answer is down
>
> On 7 feb, 10:05, Russell Keith-Magee  wrote:
>> On Sat, Feb 7, 2009 at 6:03 PM, Kless  wrote:
>>
>> > Does anybody could help me with this?
>>
>> First off - please be patient. You've waited less than a day for a
>> response. Sometimes it will take a day or two to get a response -
>> especially when you ask your question on a Friday night.
> Yes, I'm sorry. But I saw that my message is already on the second
> page or so.

Second page of what? This is an email distributed mailing list. I get
close to 70 emails a day from Django-related mailing lists. If you're
talking about the web interface, then sure - messages will fall off
the "front page" pretty quickly. However, I suspect you'll find that
people using the web interface are in the minority. Everyone using a
mail client will have the message in their inbox until the read it.

>> As for your question - the text displayed by label_tag is derived from
>> the label on the field in your form definition. If you want the text
>> to read E-MAIL rather than e-mail, then modify the label property to
>> suit:
>>
>> http://docs.djangoproject.com/en/dev/ref/forms/fields/#django.forms.F...
> Yes, I supposed that. But the problem is when you want use a form of
> an external application, and you wann't write a custom form to change
> simply the case of any letters.
>
> This is the case of RegistrationForm in djago-registration [1], which
> has labes as lower case as *label=_(u'username')*

If you don't like the default form that has been provided by an
external application, then you have two options:

1) Write your own form.

2) Subclass the form, providing a replacement field definition for the
fields you want to modify. Any field definition in your form that has
the same name as a field on the base class will override the field
definition for the base class.

class MyRegistrationForm(RegistrationForm):
username = forms.CharField(label='User Name')

However, if you want to modify every field, then you're essentially
back to option (1)

There are possibly a few other options that involve modifying the form
on a per instance basis - actually getting an instance of the form and
modifying the labels of each form in place, but they're not really
well advised - they could lead to some code fragility. If you're
particularly keen, have a play with a form instance - you should be
able to work out what to do.

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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Strange "problem" with tutorial

2009-02-07 Thread Chris Baker
I've had a similar problem on many of my python projects, where a package
seems to be on the pythonpath and everything is perfect but for some reason
I can't import it. Almost always the problem is that I forgot to include an
__init__.py in the package. If a directory does not have an __init__.py,
python will not consider it a package and it will not be importable.

Chris

On Sat, Feb 7, 2009 at 1:55 PM, Steve Holden  wrote:

>
> Joshua Russo wrote:
> >
> > On Feb 3, 6:04 pm, Adam Yee  wrote:
> >
> >> On Feb 3, 9:49 am, Joshua Russo  wrote:
> >>
> >>
> >>> I'm working through the tutorials and have encountered a strange
> >>> problem. So far everything works but Python doesn't acknowledge my
> >>> base site as a package. So everywhere that you see a reference like
> >>> "mysite.poll" I need to use only "poll". I think that my problems stem
> >>> from the following section that starts on line 263 of tutorial01.txt:
> >>>
> >> Make sure you're not mispelling 'polls'.  You've typed 'poll' above.
> >> If you're talking about the settings, yes you don't need to specify
> >> mysite.polls since the settings.py file is already in the mysite
> >> directory.  You could just put 'polls' into installed apps.
> >>
> >>
> >>
> >>
> >>
> >>
> >>> To create your app, make sure you're in the :file:`mysite` directory
> >>> and type
> >>> this command:
> >>>
> >>> .. code-block:: bash
> >>>
> >>> python manage.py startapp polls
> >>>
> >>> I ran the above command from my MySite directory that holds the
> >>> manage.py file. Is that correct? Anyone have any ideas why I can't
> >>> reference my base package? (I think I'm using the term package
> >>> correctly here.)
> >>>
> >>> Thanks
> >>> Josh
> >>>
> >> As far as I see your doing it correctly.  For technical purposes, the
> >> way that I see it (and the way django defines it):
> >> mysite = project
> >> polls = app
> >> I'm not quite sure what you're referring to as base package.  Hope
> >> this helps.
> >>
> >
> > Ya, what you suggest for settings.py is what I did. I just wanted to
> > make sure that I wasn't doing something wrong in my order of
> > operations for creating my project and app.
> >
> > I'm most of the way though part two of the tutorial and have run into
> > three places where I needed to remove "mysite." from in front of the
> > reference to polls. Once for the settings.py like you mentioned and
> > twice for the two tables in the admin.py in the second part of the
> > tutorial. It seems to me it's just a "bug" in the tutorial.
> >
> Technically the only requirement is that apps be loadable, so you can
> have an app anywhere on your PYTHONPATH and import it into several sites
> (assuming you want all thoses sites to share the same code). As long as
> each site has its own settings there should be no interference.
>
> The thing you should avoid at all costs is importing the same module
> into the same site under different names - that *will* cause confusion.
>
> regards
>  Steve
>
>
>
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: optional foreign key

2009-02-07 Thread Russell Keith-Magee

On Sun, Feb 8, 2009 at 8:03 AM, J  wrote:
>
> The idea is to be able to query all the items that have a specific 'group'
> record chosen, as well as all items that don't have anything set. Since some
> of them can be NULL or None, how do I go about selecting in a query both the
> items that are NULL, as well as the items that are linked to a specific
> 'group' in the related table?
>
> This does not work:
> qs = menuitem.objects.all().filter(group__in=[None, 1])
>
> This works:
> qs = menuitem.objects.all().filter(group=None)
>
> This works:
> qs = menuitem.objects.all().filter(group=1)

The confusion here is the result of a little concept leakage on the
part of the Django ORM.

In SQL, you can't actually ask for a field that is " = NULL", because
by definition, _nothing_ is equal to NULL. Django helps out here by
rolling out "group=None" filters to the SQL "group IS NULL"

When you ask for the query group__in=[None, 1], this will roll out as
"group IN (NULL, 1)", which obviously won't work for the NULL case.

What you need to do is use an OR to combine your the two queries that
work, making a special case of the NULL option:

qs = menuitem.objects.all().filter(group=None) |
menuitem.objects.all().filter(group=1)

If you have multiple non-null groups that you want to compare to, you
can use the __in operator on the second clause:

qs = menuitem.objects.all().filter(group=None) |
menuitem.objects.all().filter(group__in=[1,2])

You just can't include the None in the __in - it needs to be made a
special case.

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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Determine subclass of object in models.Model

2009-02-07 Thread Frank Becker

2009/2/7 Frank Becker :

Hi,


> My question: I have a CommonInfo(models.Model) and I do subclassing it for a
> couple of models. Getting CommonInfo.objects.all() returns a list of all
> objects of CommonInfo and it's subclasses. Q: How to determine what subclass 
> the
> object was instantiated of?

Stupid me. Now I found:
http://groups.google.com/group/django-users/browse_thread/thread/52f72cffebb705e/b76c9d8c89a5574f?lnk=gst=vietnam#b76c9d8c89a5574f

Thanks,

Frank

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



optional foreign key

2009-02-07 Thread J

Hello,

I'm making a menu bar for my website, and this menu bar will display
according to the permissions of the group that the user is in.

I've defined an optional foreign key 'group' for the menuitem model:

from django.db import models
from django.contrib.auth.models import Group

class menuitem(models.Model):
name = models.CharField(max_length=30)
parent = models.ForeignKey('self', blank=True, null=True)
*group = models.ForeignKey(Group, blank=True, null=True)*

The idea is to be able to query all the items that have a specific
'group' record chosen, as well as all items that don't have anything
set. Since some of them can be NULL or None, how do I go about selecting
in a query both the items that are NULL, as well as the items that are
linked to a specific 'group' in the related table?

This does not work:
*qs = menuitem.objects.all().filter(group__in=[None, 1])
*
This works:
qs = menuitem.objects.all().filter(group=None)

This works:
qs = menuitem.objects.all().filter(group=1)



Thanks for your help with this.

J


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Determine subclass of object in models.Model

2009-02-07 Thread Frank Becker

Hi,

First of all thanks for the Django framework. It's fun to work with it.

My question: I have a CommonInfo(models.Model) and I do subclassing it for a
couple of models. Getting CommonInfo.objects.all() returns a list of all
objects of CommonInfo and it's subclasses. Q: How to determine what subclass the
object was instantiated of?

Example:
my models.py contains:

class CommonInfo(models.Model):
name = models.CharField(max_length=100)
age = models.PositiveIntegerField()

class Student(CommonInfo):
home_group = models.CharField(max_length=5)

class Teacher(CommonInfo):
level = models.CharField(max_length=5)

>>> ci = CommonInfo(name="commoninfo", age=1)
>>> student = Student(name="student", age=2, home_group="AAA")
>>> teacher = Teacher(name="teacher", age=3, level="B")
[... .save() all objects   ...]

>>> for object in CommonInfo.objects.all():
...if hasattr(object, 'home_group'):
...print "found student"

Here I expected to find one object or say the if to print "found
student" one time.


Given the pure Python example:

module aaa.py:

class Foo(object):
objects = []
def __init__(self):
self.objects.append(self)

class Bar(Foo):
fnord = 5

I can do:
>>> foo = Foo()
>>> bar = Bar()
>>> Foo.objects
[, ]
>>> for object in Foo.objects:
... if hasattr(object, 'fnord'):
... print "bar"
...
bar

So, even if that might not be possible considering the SQL-DB behind
the ORM: What is the best way to determine the sub class?

Thanks,

Frank

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Modify label from field.label_tag

2009-02-07 Thread Kless

Thanks Russel for your fast reply.
My answer is down

On 7 feb, 10:05, Russell Keith-Magee  wrote:
> On Sat, Feb 7, 2009 at 6:03 PM, Kless  wrote:
>
> > Does anybody could help me with this?
>
> First off - please be patient. You've waited less than a day for a
> response. Sometimes it will take a day or two to get a response -
> especially when you ask your question on a Friday night.
Yes, I'm sorry. But I saw that my message is already on the second
page or so.

> As for your question - the text displayed by label_tag is derived from
> the label on the field in your form definition. If you want the text
> to read E-MAIL rather than e-mail, then modify the label property to
> suit:
>
> http://docs.djangoproject.com/en/dev/ref/forms/fields/#django.forms.F...
Yes, I supposed that. But the problem is when you want use a form of
an external application, and you wann't write a custom form to change
simply the case of any letters.

This is the case of RegistrationForm in djago-registration [1], which
has labes as lower case as *label=_(u'username')*


[1] 
http://bitbucket.org/ubernostrum/django-registration/src/tip/registration/forms.py

> Alternatively, fix the problem in CSS using the text-transform property:
>
> label { text-transform: uppercase; }
Thanks for this hint. If there is not a solution to accessing from
Django, then I'll use:

{ text-transform: capitalize; }

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



ABC/MTI and Generic Date Based Views

2009-02-07 Thread seanbrant

Im have troubling figuring about a good solution for blog posts. I
have created a ABC called Entry which Post, Link, Photo, Quote
inherit.

I first tired it with MTI and set Entry.objects.all() as the queryset
attribute. This will pass the list of Entry's to the template which I
can iterate over. However I would like to style each type of Entry
object a little different. Is there a way to know which type of Entry
you are dealing with.

Then I tried ABC with the same models. Obviously including abstract
True to the Base Entry class. With this approach I have know idea  how
to get a query set for all of these objects.

This seems like a fairly common use-case, so if anyone has any ideas I
would appreciate it. Im wide open if there is an approach that makes
more sense for this.

Below is my sample model:

class Entry(models.Model):
title = models.CharField(_('title'), max_length=100,
unique_for_date="publish_on")
published_on = models.DateTimeField(_('published on'))


class Post(Entry):
slug = models.SlugField(_('slug'))
teaser = models.TextField(_('teaser'), blank=True, null=False)
body = models.TextField(_('body'), blank=True, null=False)


class Link(Entry):
uri = models.CharField(_('uri'), max_length=200)
summery = models.TextField(_('summery'), blank=True, null=False)

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: How can import the Widgets of Admin.

2009-02-07 Thread Paul Nema

How to I get the value from a class verbose_name in a models.Model
based generic list?

I.E. I want to use the value in a class element verbose_name for a table header

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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: table display with AJAX

2009-02-07 Thread Antoni Aloy

2009/2/7 Gerard Flanagan :
>
> MrJogo wrote:
>> Hi,
>>
>> One of my pages is going to have a table that I'd like to be sortable,
>> and I'm wondering the best way to do this. I looked into django-
>> tables, which seems good, but once the page is loaded, I'd also like
>> to be able to sort dynamically (using javascript). Before I go and
>> implement this myself, anyone have any suggestions on already made
>> solutions? Thanks.
>
Look at my sample code at:

http://code.google.com/p/appfusedjango/source/browse/#svn/trunk/jqagenda

It uses a slighty patched version of jqgrid.

-- 
Antoni Aloy López
Blog: http://trespams.com
Site: http://apsl.net

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: CMS apps feature comparison matrix

2009-02-07 Thread akaihola

Kenneth Gonsalves kirjoitti:
> cool - but I think it is better if you had the features as column headers and
> the CMSs as row headers - easier to compare.

I actually had it that way originally until version 14 [1], but
tranposed the table because the large number of features (and still
growing) made it awfully wide. The original seems more difficult to
read to me. This may be a subjective, so I have nothing against
transposing it back.

Too bad the wiki doesn't allow us to add CSS definitions. Makes it
difficult to improve the layout.

[1] http://code.djangoproject.com/wiki/CMSAppsComparison?version=14
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Django Forms in HTML 4.01 Strict

2009-02-07 Thread akaihola

Isn't there a broader problem than just django.forms? Now that Django
1.0 seems to stand on the XHTML side, it encourages re-usable app
authors to generate XHTML instead of HTML in their default templates
as well as in any markup their apps might be generating
programmatically.

I have to admit that I've been ignorant re the HTML/XHTML debate, and
only now I skimmed through a pile of arguments on both sides. It
doesn't look like there will be a consensus any time soon (although
the HTML side convinced me better today).

To make sure most re-usable apps can serve both standards, too, Django
probably needs to provide appropriate tools for developers, 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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: openlayers TemplateSyntaxError

2009-02-07 Thread Justin Bronn

You need to add 'django.contrib.gis' to your INSTALLED_APPS.  This is
in the install docs:

http://geodjango.org/docs/install.html#add-django-contrib-gis-to-installed-apps

-Justin

On Feb 3, 11:39 pm, Waruna de Silva  wrote:
> Hi ,
>
> I'm newbie to django as well asgeodjango. I tried out first tutorial
> ingeodjangodocs using world data. When i tried to add new entry or
> tying to modified existing entry i get following errors.
>
> ""- 
> --
> TemplateSyntaxError at /admin/world/worldborders/add/
>
> Caught an exception while rendering: gis/admin/openlayers.html
>
> Request Method:         GET
> Request URL:    http://127.0.0.1:8000/admin/world/worldborders/add/
> Exception Type:         TemplateSyntaxError
> Exception Value:
>
> Caught an exception while rendering: gis/admin/openlayers.html
>
> Original Traceback (most recent call last):
>   File "/usr/lib/python2.5/site-packages/django/template/debug.py",
> line 71, in render_node
>     result = node.render(context)
>   File "/usr/lib/python2.5/site-packages/django/template/debug.py",
> line 87, in render
>     output = force_unicode(self.filter_expression.resolve(context))
>   File "/usr/lib/python2.5/site-packages/django/utils/encoding.py",
> line 49, in force_unicode
>     s = unicode(s)
>   File "/usr/lib/python2.5/site-packages/django/forms/forms.py", line
> 347, in __unicode__
>     return self.as_widget()
>   File "/usr/lib/python2.5/site-packages/django/forms/forms.py", line
> 379, in as_widget
>     return widget.render(name, data, attrs=attrs)
>   File "/usr/lib/python2.5/site-packages/django/contrib/gis/admin/
> widgets.py", line 64, in render
>     context_instance=geo_context)
>   File "/usr/lib/python2.5/site-packages/django/template/loader.py",
> line 102, in render_to_string
>     t = get_template(template_name)
>   File "/usr/lib/python2.5/site-packages/django/template/loader.py",
> line 80, in get_template
>     source, origin = find_template_source(template_name)
>   File "/usr/lib/python2.5/site-packages/django/template/loader.py",
> line 73, in find_template_source
>     raise TemplateDoesNotExist, name
> TemplateDoesNotExist: gis/admin/openlayers.html
>
> --- 
> 
>
> openlayers.html file is there, I also tried with latest version of
> django, getting it from SVN but still didn't fix the problem.
>
> What will be the possible problem, can some one plz help
>
> thanks in advance
> waruna
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



external non-ascii character is breaking my script

2009-02-07 Thread redmonkey

Hey everyone,

I'm trying to create django model instances from data stored in a flat
text file but I get `force_unicode` errors when the script comes
across one of the data items containing the "é" character.

Can anyone explain to me what this problem is and now I can fix it? I
can't really get my head around unicode, ascii and UTF-8 stuff.

Thanks,

RedMonkey
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Better approach in Database?

2009-02-07 Thread Alex Gaynor
On Sat, Feb 7, 2009 at 11:14 AM, Guri  wrote:

>
> Hi,
>Its been now approx. 6 months I am working with Django and
> I must say all issues that came my way were solved either by this or
> that post, blog, tutorial. Support of Django is marvelous.
>  This time I am stuck with a design issue rather Django.
>
> * I have a Users Master table and they have their profiles and stuff.
> Thing I am trying to implement is "User can follow many other users
> (something similar to people following on Twitter)".
>
> I can think of two approaches:
>
> 1. Add a new table with two fields( following user, followed user).
>
> 2. Add a field in User master table of type String and length say
> 200.
> Storing the user IDs of followed users separated by space.
>
> Which will be a better approach with scaling up in mind?
>
> I am using Django with MySql.
>
> Thanks In Advance
> Guri
>
> >
>
Using the second table is a far better architecture, since there are many
types of queries that you couldn't properly do on a string field, such as
how would you ask if user 1 was following user 10?

Alex

-- 
"I disapprove of what you say, but I will defend to the death your right to
say it." --Voltaire
"The people's good is the highest law."--Cicero

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Better approach in Database?

2009-02-07 Thread Guri

Hi,
Its been now approx. 6 months I am working with Django and
I must say all issues that came my way were solved either by this or
that post, blog, tutorial. Support of Django is marvelous.
  This time I am stuck with a design issue rather Django.

* I have a Users Master table and they have their profiles and stuff.
Thing I am trying to implement is "User can follow many other users
(something similar to people following on Twitter)".

I can think of two approaches:

1. Add a new table with two fields( following user, followed user).

2. Add a field in User master table of type String and length say
200.
Storing the user IDs of followed users separated by space.

Which will be a better approach with scaling up in mind?

I am using Django with MySql.

Thanks In Advance
Guri

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: SQLite, swedish signs

2009-02-07 Thread Karen Tracey
On Sat, Feb 7, 2009 at 6:28 AM, Daniel Sandberg
wrote:

>
> I,am getting the following error message when I,am trying to add a swedish
> sign:
> "'ascii' codec can't encode character u'\xe4' in position 4: ordinal not
> in range(128)"
>

Please include the full traceback that comes with the error.

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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



SQLite, swedish signs

2009-02-07 Thread Daniel Sandberg
Hi,
I have problem with saving special signs (a.g.  swedish åäö) in my SQlite
database. When I,am  reading about Django and the SQLite database it sais it
should be possible to use UTF-8 signs. But it does not work for me.

I dont't think it is the database settings that is the problem, because I
have downloaded a forum application where I can use swedish signs.

My classes looks like this:


from django.db import models
import datetime

class myClass(models.Model):
testField1 = models.TextField()
testField2  = models.TextField()

def __unicode__(self):
return self. testField1

*

I,am getting the following error message when I,am trying to add a swedish
sign:
"'ascii' codec can't encode character u'\xe4' in position 4: ordinal not in
range(128)"


I,am using Django 1.0.2.


Plz help me!:)


Best regards
Daniel

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Overrding queryset on a field in form generated with ModelForm

2009-02-07 Thread mrsource

Solved, I corrected the __init__ method with this:

def __init__(self,  *args,  **kwargs):
super(CategoriaForm,self).__init__(*args,**kwargs);
if kwargs.has_key('instance'):
self.fields['parent'].queryset = Categoria.objects.exclude
(parent=kwargs['instance'].id).exclude(id=kwargs['instance'].id)

On Feb 5, 10:11 am, mrsource  wrote:
> Maybe I missing some step:
> I trying to set up the the automatic admin page form to edit a
> category tree builded withtreebeardextension:
> #Model:
> class Categoria(AL_Node,Componente):
>     immagine = fields.ImageWithThumbnailsField
> (upload_to=Componente.image_path + 'categorie/',
>                                                thumbnail={'size':
> (100, 60),'options': ['crop', 'upscale'],},
>                                                help_text =
> Componente.image_help_text,
>
> blank=True,default=Componente.noimage_logo)
>     parent = models.ForeignKey('self',
>                                related_name='children_set',
>                                null=True,
>                                db_index=True)
>     node_order_by = ['data_creazione']
>     class Meta:
>         verbose_name = 'Categoria'
>         verbose_name_plural = 'Categorie'
>
> but the I would exclude some elements from the foreign key choice
> widget as itself object id and its descendants:
> First I tried this to exclude the element that I editing:
>
> #admin.py
>  class CategoriaForm(forms.ModelForm):
>     class Meta:
>         model = Categoria
>     def __init__(self,  *args,  **kwargs):
>         super(CategoriaForm,self).__init__(self,  *args,  **kwargs);
>         self.fields['parent'].queryset = Categoria.objects.filter
> ('id'<>kwargs['instance'].id)
>
> but I get this error in the Categoria admin editing page:
>
> Exception Type:              TypeError
> Exception Value:             'bool' object is not iterable
> Exception Location:     D:\codice\workspace\django\django\db\models\sql
> \query.py in add_filter, line 1101
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Postgresql v MySQL

2009-02-07 Thread Tim Chase

> Is there any clear reason for preferring one of these DBMS over the
> other for use with Django (1.0 onwards).

Historically, PostgreSQL has favored correctness, ANSI standards, 
and data-integrity while MySQL has favored speed and 
pluggability.  For the most part, they've reached equilibrium.

The GUI/web admin tools are also a bit more polished and diverse 
compared to the PostgreSQL tools.  I just use the command-line 
client for most administration, so it's not a big deal to me.

As of some very old stats I've seen (and thus likely invalid), 
MySQL handled higher initial loads, but wasn't able to sustain 
them as gracefully; while PostgreSQL kept up with traffic, even 
if initial request response-times were a wee bit slower than 
MySQL.  (MySQL had better performance until it reached a 
threshold and then started falling off; while PostgreSQL's didn't 
experience the same falling-off under high load).  Take this with 
a grain of salt as I mention, since the study was c. 2003 or 
something.  A lot happens in 5 years. :)

There are a couple distinguishing features offered by one that 
you won't find in the other such as:

MySQL is more popularly installed on cheaper shared-hosting 
plans, so you'll find it more in the wild. It's also possible to 
use various table-types ("storage engines" in MySQL-speak[1]) 
which may not offer transaction safety, but offer other benefits: 
  memory-only tables, "Merged" tables which can be split across 
drives, MyISAM tables which are faster but don't offer 
transactions, and "archive" tables which are good for 
infrequently accessed ("archived", duh :) data.

PostgreSQL has built-in GIS data-types and functions, which I 
believe are required for the GeoDjango functionality (or Oracle). 
  PG also allows flexible creation of new data-types and 
functions/operators as shown by the GIS data-types that were 
integrated early.  It also offers some under-the-covers stunts 
with table-inheritance.  It's very close to Oracle syntax (from 
what I understand, having never used Oracle), so Oracle admins 
may feel more at home in PG.

I personally find MySQL easier to administer, but MySQL has a 
reputation as being built for developers, while PosgreSQL has a 
reputation as being built for DBAs.  I'm a developer first.

So I can't really recommend one vs. the other unless I knew your 
needs.  Do you need GeoDjango, custom data-types, 
table-inheritance or "enterprise"y features for your DBA, then 
PostgreSQL may be a better choice.  Do you need flexibility in 
storage-engine choice, ready availability on shared/inexpensive 
web hosts, or spiffy GUI/web admin interfaces, then use MySQL.

My last bit of advice:  if you don't care strongly about any of 
these features, DEVELOP FOR BOTH -- they're both free to download 
and install, so there's little reason not to.  Django 
(particularly the work on the ORM -- special thanks to Malcolm 
here) makes this very easy.  You can then test against both and 
see which performs better.  And if it's an app you plan to share, 
it will let others choose a backing DB for their own reasons 
rather than reasons foisted by you.

-tim

[1]
http://dev.mysql.com/doc/refman/5.1/en/storage-engines.html





--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Two quick questions about __search

2009-02-07 Thread Seamus

Thank you. Fool on me, I did see the documentation although it was
late at night.

I think the documentation needs a simple addition of an example and a
link to the MySQL documentation < 
http://dev.mysql.com/doc/refman/5.0/en/fulltext-natural-language.html
>.


On Feb 6, 11:34 pm, Alex Gaynor  wrote:
> On Fri, Feb 6, 2009 at 11:32 PM, Seamus  wrote:
>
> > 1. Is there documentation for __search? (I swear I looked long and
> > hard)
> > 2. When using MySQL, do I need to manually alter the table for the
> > FULLTEXT index?
>
> > Thanks in advance.
>
> > Seamus
>
> 1) It's mentioned 
> here:http://docs.djangoproject.com/en/dev/ref/models/querysets/#search
> 2) Yes
>
> Alex
>
> --
> "I disapprove of what you say, but I will defend to the death your right to
> say it." --Voltaire
> "The people's good is the highest law."--Cicero
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



How can import the Widgets of Admin.

2009-02-07 Thread Neeru

I have been tring to import the widgets of Admin for the Date and time
to the ModelForm.

django.contrib.admin import widgets
 in that AdminDateWidget() get the date field.

lets say that a there is a modelform in which their is a date field
say name of it is 'date'. the Date field should be uneditable.

class sampleform(ModelForm):
class Meta:
model = sample
fields=['sample', 'date']


Can u suggest me a solution, it would helpful.
thanks in adavnce..
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



django amf with python property()

2009-02-07 Thread Adda Badda

Does anyone with experience of DjangoAMF know whether its possible to
serialize properties of a class defined with the the python property
function?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Postgresql v MySQL

2009-02-07 Thread Peter2108

Is there any clear reason for preferring one of these DBMS over the
other for use with Django (1.0 onwards).

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: table display with AJAX

2009-02-07 Thread Gerard Flanagan

MrJogo wrote:
> Hi,
> 
> One of my pages is going to have a table that I'd like to be sortable,
> and I'm wondering the best way to do this. I looked into django-
> tables, which seems good, but once the page is loaded, I'd also like
> to be able to sort dynamically (using javascript). Before I go and
> implement this myself, anyone have any suggestions on already made
> solutions? Thanks.


http://developer.yahoo.com/yui/datatable/



--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: syncdb Issue: OneToOneField with User model from contrib.admin

2009-02-07 Thread Ramiro Morales

On Sat, Feb 7, 2009 at 7:26 AM, elith...@gmail.com  wrote:
>
> Hi all - I'm having an issue when trying to generate my models after a
> syncdb command. I know where it's failing, and almost why - but I'm
> also trying to figure out the correct solution to what I'm trying to
> achieve.
>
> In my model (http://github.com/elithrar/eatsleeprepeat.net/blob/
> 5f63cac3dda09421882905abbb5b268569f6de1d/projects/articulate/
> models.py) I have the following line:
>
>author = models.OneToOneField(User, _('author'))

Try using:

author = models.OneToOneField(User, verbose_name=_('author'))

the verbose_name option for the relationship type fields
is currenty documented in the model topics document but not in the
field options refererence.

HTH,

-- 
 Ramiro Morales

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Modify label from field.label_tag

2009-02-07 Thread Russell Keith-Magee

On Sat, Feb 7, 2009 at 6:03 PM, Kless  wrote:
>
> Does anybody could help me with this?

First off - please be patient. You've waited less than a day for a
response. Sometimes it will take a day or two to get a response -
especially when you ask your question on a Friday night.

As for your question - the text displayed by label_tag is derived from
the label on the field in your form definition. If you want the text
to read E-MAIL rather than e-mail, then modify the label property to
suit:

http://docs.djangoproject.com/en/dev/ref/forms/fields/#django.forms.Field.label

Alternatively, fix the problem in CSS using the text-transform property:

label { text-transform: uppercase; }

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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



syncdb Issue: OneToOneField with User model from contrib.admin

2009-02-07 Thread elith...@gmail.com

Hi all - I'm having an issue when trying to generate my models after a
syncdb command. I know where it's failing, and almost why - but I'm
also trying to figure out the correct solution to what I'm trying to
achieve.

In my model (http://github.com/elithrar/eatsleeprepeat.net/blob/
5f63cac3dda09421882905abbb5b268569f6de1d/projects/articulate/
models.py) I have the following line:

author = models.OneToOneField(User, _('author'))

Which generates the following error:

matts-macbook:projects matt$ python manage.py syncdb
Creating table auth_permission
Creating table auth_group
Creating table auth_user
Creating table auth_message
Creating table django_content_type
Creating table django_session
Creating table django_site
Creating table django_admin_log
Creating table articulate_category
Traceback (most recent call last):
  File "manage.py", line 11, in 
execute_manager(settings)
  File "/Library/Python/2.5/site-packages/django/core/management/
__init__.py", line 347, in execute_manager
utility.execute()
  File "/Library/Python/2.5/site-packages/django/core/management/
__init__.py", line 295, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/Library/Python/2.5/site-packages/django/core/management/
base.py", line 195, in run_from_argv
self.execute(*args, **options.__dict__)
  File "/Library/Python/2.5/site-packages/django/core/management/
base.py", line 222, in execute
output = self.handle(*args, **options)
  File "/Library/Python/2.5/site-packages/django/core/management/
base.py", line 351, in handle
return self.handle_noargs(**options)
  File "/Library/Python/2.5/site-packages/django/core/management/
commands/syncdb.py", line 66, in handle_noargs
sql, references = connection.creation.sql_create_model(model,
self.style, seen_models)
  File "/Library/Python/2.5/site-packages/django/db/backends/
creation.py", line 41, in sql_create_model
col_type = f.db_type()
  File "/Library/Python/2.5/site-packages/django/db/models/fields/
related.py", line 713, in db_type
rel_field = self.rel.get_related_field()
  File "/Library/Python/2.5/site-packages/django/db/models/fields/
related.py", line 606, in get_related_field
data = self.to._meta.get_field_by_name(self.field_name)
  File "/Library/Python/2.5/site-packages/django/db/models/
options.py", line 284, in get_field_by_name
% (self.object_name, name))
django.db.models.fields.FieldDoesNotExist: User has no field named


I have from django.contrib.auth.models import User as an import, of
course - but in short, I'd just like to define the author field in my
Article model as having a direct relationship with the User model from
contrib.admin. I don't need to extend it at all, as for this project
the User model already has the fields I need.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Why Syntax Errors in URLconf are Silent?

2009-02-07 Thread Kenneth Gonsalves

On Saturday 07 Feb 2009 2:38:46 pm Guy Rutenberg wrote:
> > what type of syntax error? I put an extra comma in my urls file and the
> > app promptly crashed.
>
> I wrote "pattenrs" instead of "patterns" and the sure did crash. But
> instead of crashing and reporting a Syntax Error exception it reported
> a failure to do a reverse lookup, which I found to be confusing.

that error message is a little confusing - if, for example, you have a url 
pointing to a view that doesnt exist, you get a message like 'module views' 
does not exist.

-- 
regards
KG
http://lawgon.livejournal.com

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Why Syntax Errors in URLconf are Silent?

2009-02-07 Thread Guy Rutenberg

Hi,

On Feb 7, 8:43 am, Kenneth Gonsalves  wrote:

> what type of syntax error? I put an extra comma in my urls file and the app
> promptly crashed.
>

I wrote "pattenrs" instead of "patterns" and the sure did crash. But
instead of crashing and reporting a Syntax Error exception it reported
a failure to do a reverse lookup, which I found to be confusing.

Thanks,

Guy
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Modify label from field.label_tag

2009-02-07 Thread Kless

Does anybody could help me with this?
Thanks in advance.

On 6 feb, 13:53, Kless  wrote:
> Is possible to modify the label value got from *{{ field.label_tag }}
> * ?
>
> By example, if it's got:
>
>    e-mail
>
> I would to modify that label to (as example):
>
>    E-MAIL
>
> And *{{ field.label_tag|upper }}* is not valid because it modifies
> all:
>
>    USERNAME
>
> Any idea?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Missing Debug Stack Traces?

2009-02-07 Thread Devel63

I just switched over from using webapp with Google App Engine to using
Django on App Engine.

Most errors are now silently disappearing as a 500 server response,
whereas before I started using "real" Django I would get a lovely
stack trace in the browser that would often pinpoint the exact problem
(for example, calling a function with 2 args instead of 3).  I've seen
a couple of stack traces since the switch, but 99% of the time,
nothing.

My settings.py does include DEBUG=True

I hope this is just a simple newbie question, and not indicative that
I have to give up all that help!

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---