Re: leading zeros

2010-01-22 Thread Mike Dewhirst

On 23/01/2010 11:12am, Patrick wrote:

Hello All,

I'm sorry for being a newbe and posting this site, but I'm desperate.
I inherited a django site and  when posts are added through the admin
page they render like this:

http://website/posts/category/2010/1/11/post_information/

but the link will only work if you add the leading zero to make it
look like this:


In the view called, extract the value which might need the leading zero 
(day and/or month) and give it one like this ...


def leadzero(val):
"""converts any val to a string"""
mth = '00%s' % val
# return the last 2 chars
return mth[-2:]



http://website/posts/category/2010/01/11/post_information/

Would any of you be kind enough to point me in the right direction to
resolve this?

thank you in advance,

patrick



--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To post to this group, send email to django-us...@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: Need your expertise

2010-01-22 Thread jRam
Thanks mate.

On Sat, Jan 23, 2010 at 12:32 AM, Malcolm Box  wrote:

> On Fri, Jan 22, 2010 at 9:03 AM, Jigs  wrote:
>
>> We are currently deciding if Django Framework will suit our needs.
>
> 
>
>>
>> Templates and Python is a must requirement for the project. Reporting
>> and Monitoring modules will be created in the future. Please advise if
>> we are going in the right direction if ever we are using Django.
>>
>> Django does all those things.
>
> It's not really possible to tell you whether Django is suitable for your
> app - only you know all the requirements and what you want to do.  Django
> can probably be used to create any sort of web application - what changes is
> how easy it is, and how much you have to do versus getting off-the-shelf.
>
> Your best bet is to read the Django docs to get a feel for what it does,
> and then evaluate yourself.
>
> Cheers,
>
> 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-us...@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.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: Looking for Lead Django Developer in LA please call 310 571 JOBS

2010-01-22 Thread James Bennett
On Fri, Jan 22, 2010 at 6:48 PM, CerenGuven  wrote:
> 3-5+ years Django/Python development experience

If you manage to find someone with 5+ years' Django experience, do let me know.

(meanwhile, job postings should go to djangogigs.com)


-- 
"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-us...@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.



Looking for Lead Django Developer in LA please call 310 571 JOBS

2010-01-22 Thread CerenGuven
Requirements:
3-5+ years Django/Python development experience
A good understanding of object oriented programming and relational
data modeling.
An understanding of Ajax
Demonstrated experience with HTML, CSS table-less design and
Javascript
Must have excellent problem solving skills and love technical
challenges
Must be self-motivated, and able to multi-task
Must be able to take initiative to be productive and efficient
Must be able to function independently and still work well in a "team
oriented" environment.
Strong communication skills (both in person and in writing) while
interacting with individuals with a range of technical understanding
Knowledge of and experience with source/version control systems is a
plus but not necessary
Experience with shell environments (bash,tcsh etc) and UNIX/Linux
administration
Adobe Flash is a plus but not necessary

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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.



Deploying for designers

2010-01-22 Thread Andrew Badr
How can I get a designer set up to be able to edit a Django project's
templates and static files with the minimum amount of effort? Django
itself is easy to get running, but a project with many external
dependencies can quickly become very hard for a less technical person
to set up, especially if they are running on an OS that's different
from the production OS and don't have VM software installed.

One ideal would be having to send them little more than Django and the
set of templates and template contexts that they try combinations of.
Clearly it's not possible to always remove some component in general,
because even just template tags can rely on arbitrary code. But on the
other hand, anything related to asynchronous task queues like Celery,
for example, is in practice always unnecessary for the designer to do
their work.

Is this line of thinking worth pursuing? Has anyone done something
along these lines? If not, how do you get the designer up and running?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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.



leading zeros

2010-01-22 Thread Patrick
Hello All,

I'm sorry for being a newbe and posting this site, but I'm desperate.
I inherited a django site and  when posts are added through the admin
page they render like this:

http://website/posts/category/2010/1/11/post_information/

but the link will only work if you add the leading zero to make it
look like this:

http://website/posts/category/2010/01/11/post_information/

Would any of you be kind enough to point me in the right direction to
resolve this?

thank you in advance,

patrick

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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 to Model a relationship on a constrained subset of the foreign key.

2010-01-22 Thread Atamert Ölçgen
Hi Taliesin,
Here is what I would do; I would set up relationships like this Contact -> 
Division -> Account. Then you can access a contacts account as 
`contact_instance.division.account`. This means you need to create a Division 
for each Account that represents no-division. It can be done automatically 
within Account.save() or via signals. I am aware this introduces some 
comlexity and queries spanning over three tables should run slower than 
queries spanning over two tables, but I believe this is simple and not 
horribly inefficient.

Regarding limiting ForeignKey choices question; take a look at 
`limit_choices_to`. Well documented as usual.

For composite FK question; AFAIK Django doesn't support them.

If you can't find an answer here I suggest you to try StackOverflow as well.

Regards,

-- 
Saygılarımla,
Atamert Ölçgen

 -+-
 --+
 +++

www.muhuk.com
mu...@jabber.org

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: Remove items from queryset?

2010-01-22 Thread Carl Zmola
I have a similar problem I want to exclude or include records based on 
the presence of other records.


I want to march through Users, get their profile, and exclude records who

I have 3 tables: auth_user, myapp_userprofile, myapp_resource  (with the 
userprofile having a one to Many relationship with the resource)


I want a queryset of users who (through the convoluted mess) have access 
to a specific resource.
I have the sql to do this, but I can't figure out how to do this without 
a list.  It looks like I could do some magic in Django1.2 with the "raw" 
method, but I am in Django1.1.


Is there an API cookbook for more advanced querying?  I may be missing 
something simple about how to chain models together in a query (like I 
would with Join's in sql).


Carl



Bill Freeman wrote:

A final possibility is to enumerate the id's of the objects that you want to
exclude, and then apply them to an unevaluated copy of the queryset
using exclude, e.g.;

q = base_queryset_construction()
excludes = []

for i in q.all():
   if shoud_be_excluded(i):
  excludes.append(i.id)

q = q.exclude(id__in=excludes}


Or, if you'll be excluding more than you will be including, you can enumerate
those you want to keep and use them with filter instead of exclude.

On Fri, Jan 22, 2010 at 12:39 PM, Igor  wrote:
  

Bill,

You're correct in all your guesses - I want to be able to chain more
filtering to the query since I'm not sure what and how might use it
later. Even in the current situation it's much better from design
standpoint to chain a .distinct() on the set AFTER the exclusion of
the values I don't like.

I'm not (yet :)) an expert in Django as it's easy to guess, but in my
understanding even after I've accessed the elements (i.e. SQL has been
executed) filterng/sorting etc. should be working.

The solution I've implemented for now is instead of creating a list,
I've created an empty QuerySet and am joining every element I DO want
to that set. The last line is the join, and my concern is that it's
not too efficient. I know those result sets are not going to be more
than 20 elements or even less so the inefficiency is probably
negligible, but I would still be happy to find a way that would be
efficient for any set size.

   results = PDirectory.objects.none()
   for d in dirs:
   splitpath = d.path.split("/")

   if len(splitpath) == 3: # that would be root_dir/sub_dir
   results = results | dirs.filter(id=d.id) # This 
is not efficient
at all

Thanks,
Igor


On Jan 22, 5:14 pm, Bill Freeman  wrote:


On Fri, Jan 22, 2010 at 10:22 AM, Igor  wrote:
  

I would not like to rely on fieldname__regex because it's database-
dependent.
I've thought about lists as well, but not sure whether it's a good
idea if it loses the queryset-ness.


If a thing is still a queryset proper, it has to embody SQL that can fetch what
you want.  If you want database independence (good luck) the query must
only use (the commonly correctly implemented subset of) standard SQL.

Once you have examined the data in python, the query has already been
run.  If you look at all of the returned objects in python, they have
all arrived
in memory, and making a list of them is nearly free.

I'm guessing that you want this to remain queryset-like because you want
to apply further filtering to it beyond these exclusions.  If so, are you sure
that you can't reorganize to do these exclusions last?  Or do you need to
include instances (rows) in you calculation of the exclusion based on rows
that will eventually be excluded by the other filters?

Another possibility, if you can express your constraints in standard SQL is
to use the extra() method of querysets to specify additional WHERE clauses
(will be ANDed with other constraints).

Again if you can do it with standard SQL, there is always the custom query.
There is, however, a lot of manual labor involved in generating instances
from the return.  This is expected to get much easier, or so I've heard, in
1.2.  And, of course, you don't need to generate actual instances if you
don't intend to modify and save them, and can pick and choose the fields
you want to return (this, too, has it's details to work out).

Bill
  

--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To post to this group, send email to django-us...@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.





  


--
Carl Zmola
301-562-1900 x315
czm...@woti.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-us...@googlegroups.com.
To unsubscribe from this group, send 

filtering foreign key field in form

2010-01-22 Thread Gaffar Durmaz
hi everybody,
i have a problem with forms..

suppose we have a model class as like this
class Something(models.Model):
another_model = models.ForeignKey(AnotherModel, verbose_name=_
('AnotherModel'))



so i have a form for this class such as belove
class SomethingForm(ModelForm):
#another_model = forms.ModelChoiceField(AnotherModel.objects.all
().filter(something),label=('smthng'))
class Meta:
 model=Something


here I can only do something here based filtering by filter(something)
but i wanna filter something that not static ..
i wanna filtering by dynamic parameters
how can i do 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-us...@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: Send and Receive SMS from a django app

2010-01-22 Thread Chris Withers

Alessandro Ronchi wrote:


Because of the number of the SMS I must write. I need a web app that 
makes intense use of SMS without any external dependences (like Unicef 
app).


If you want to send a *lot* of sms'es then you definitely want to be 
using a gatway sending service rather than trying to rack up a load of 
cell phones and writing to them...


Chris

--
Simplistix - Content Management, Batch Processing & Python Consulting
- http://www.simplistix.co.uk

--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To post to this group, send email to django-us...@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: About generated html forms with django

2010-01-22 Thread Daniel Hilton
I'm just trying to help :-)

Google git clone or read the user guide on github to help you out.

Cheers,
Dan


On Friday, January 22, 2010, Ariel  wrote:
> I am asking you that because I am having problems to download it.
>
>
>
> On Fri, Jan 22, 2010 at 12:13 PM, Ariel  wrote:
>
> Why is this http://github.com/bartTC/django-frontendadmin helpfull ???
>
> Regards
> Ariel
>
>
>
>
>
> On Fri, Jan 22, 2010 at 12:00 PM, Daniel Hilton  
> wrote:
> 2010/1/22 Ariel :
>
>
>> Hi everybody:
>> I need to make an automatic admin interface with a behaviour similar to the
>> Django's default admin interface but not totally equal, then I need to know
>> how django generate all the html forms and views methods for any class
>> included in the model, how does django do that ??? Where are the classes
>> that control all the generated html forms and views methods ???
>> How could I make this ???
>> Could you help me ?
>> Thanks in advance
>> Ariel
>
> Django-frontendadmin may help you:
>
> http://github.com/bartTC/django-frontendadmin
>
> You'll need to read the forms documentation as well though and have an
> understanding of the basics of form processing:
> http://www.djangobook.com/en/2.0/chapter07/
>
> HTH
> Dan
>
>
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To post to this group, send email to django-us...@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.
>>
>
>
>
> --
> Dan Hilton
> 
> www.twitter.com/danhilton
> www.DanHilton.co.uk 
> 
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-us...@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.
>
>
>
>
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-us...@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.
>

-- 
Dan Hilton

www.twitter.com/danhilton
www.DanHilton.co.uk


-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: templatetag produce extra newline

2010-01-22 Thread Bill Freeman
I use emacs.  By default it does not add newlines, but can be configured to
do so.  If you remember the sed, that's fine, but you don't have to "learn
emacs" in order to use it for this task.  You can invoke it with the filename
on the command line, scroll to the bottom using the scroll bar, click to place
the curser at the end, hit backspace to remove the newline (cursor moves
back to the end of the last line), use the file menu to save, then use the file
menu to exit.

Alternatively, this is an easy job for a python script.

On Fri, Jan 22, 2010 at 3:52 PM, Ali Rıza Keleş  wrote:
> On Fri, 2010-01-22 at 15:07 -0500, Bill Freeman wrote:
>> I believe that you will find that the file
>> tags/find_which_display.html has a newline
>> at it's end.  If you don't have the *nix utility od, you can, with any
>> conventint
>> python, do:
>>
>> f=open('path_to_tags_template_dir/tags/find_which_display.html', 'rb')
>> s=f.read()
>> f.close()
>> print repr(s)
>>
>> Probably you have an editor that insists on ending files with
>> newlines.  Or perhaps
>> you had not considered that newline.  Anyway, I dummied up a test
>> version of your
>> code, and it works fine for me, with no trailing newline.
>>
>> Bill
>
> I use gedit, and tried it nano and vi also, but all of them add
> automatically a newline \n at the end of the files..
>
> I used sed to have a file without newline at the end.
>
> echo -en "{{display_url}}" | sed ':a;N;$!ba;$s/\(.*\)\n/\1/' ->
> find_which_display.html
>
> Yes funny but it works quite well.
>
> Thanks
>
>
>>
>> On Fri, Jan 22, 2010 at 1:15 PM, Ali Rıza Keleş  
>> wrote:
>> >
>> > On Fri, 2010-01-22 at 12:55 -0500, Bill Freeman wrote:
>> >> I'm pretty sure that your templatetag does produce the newline.  The url 
>> >> tag,
>> >> for example, doesn't add a newline.  How about posting the code?
>> >>
>> >
>> > Code here:
>> >
>> > @register.inclusion_tag('tags/find_which_display.html')
>> > def find_which_display(photo):
>> >    if photo.source == "ext":
>> >        display_url = photo.get_ext_url()
>> >    else:
>> >        display_url = photo.get_display_url()
>> >    return {'display_url': display_url}
>> >
>> >
>> > and tags/find_which_display.html:
>> >
>> > {{ display_url }}
>> >
>> > just have one line doesn't have the second.
>> >
>> >
>> > i tried to return like below but it was same.
>> >
>> >    ...
>> >    return {'display_url': remove_newlines(display_url)}
>> >
>> >
>> > def remove_newlines(text):
>> >    normalized_text = normalize_newlines(text)
>> >    return mark_safe(normalized_text.replace('\n', ''))
>> >
>> >
>> >
>> > Thanks
>> >
>> > --
>> > Ali
>> >
>> >
>> >
>> >
>> >> On Fri, Jan 22, 2010 at 12:37 PM, Ali Rıza Keleş  
>> >> wrote:
>> >> > Hi,
>> >> >
>> >> > I have a templatetag which decides somthing and returns it. I works well
>> >> > within HTML, but it causes error while it is in JavaScript, because of
>> >> > newline which is produced by django rendering this templatetag.
>> >> >
>> >> > For example:
>> >> >  produces
>> >> >
>> >> > http://media..com/images/2010/01/22/test_image.jpg
>> >> > " />
>> >> >
>> >> > and yes it has newline but it works and display image.
>> >> >
>> >> > But here:
>> >> > 
>> >> > ...
>> >> > replacePhoto('{% find_which_display photo %}');
>> >> > ...
>> >> >  produces
>> >> >
>> >> > 
>> >> > ...
>> >> > replacePhoto('http://media..com/images/2010/01/22/test_image.jpg
>> >> > ');
>> >> > ...
>> >> > 
>> >> >
>> >> > and of course it fails.
>> >> >
>> >> > I am sure that my templatetag find_which_display does not produce this
>> >> > newline, i tried and tested it, also I dont know who does and how I can
>> >> > fix it.
>> >> >
>> >> > Thanks for any help..
>> >> >
>> >> > --
>> >> > Ali Rıza Keleş
>> >> >
>> >> > --
>> >> > You received this message because you are subscribed to the Google 
>> >> > Groups "Django users" group.
>> >> > To post to this group, send email to django-us...@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.
>> >> >
>> >> >
>> >>
>> >
>> > --
>> > You received this message because you are subscribed to the Google Groups 
>> > "Django users" group.
>> > To post to this group, send email to django-us...@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.
>> >
>> >
>>
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to 
> 

Re: templatetag produce extra newline

2010-01-22 Thread Ali Rıza Keleş
On Fri, 2010-01-22 at 15:07 -0500, Bill Freeman wrote:
> I believe that you will find that the file
> tags/find_which_display.html has a newline
> at it's end.  If you don't have the *nix utility od, you can, with any
> conventint
> python, do:
> 
> f=open('path_to_tags_template_dir/tags/find_which_display.html', 'rb')
> s=f.read()
> f.close()
> print repr(s)
> 
> Probably you have an editor that insists on ending files with
> newlines.  Or perhaps
> you had not considered that newline.  Anyway, I dummied up a test
> version of your
> code, and it works fine for me, with no trailing newline.
> 
> Bill

I use gedit, and tried it nano and vi also, but all of them add
automatically a newline \n at the end of the files.. 

I used sed to have a file without newline at the end. 

echo -en "{{display_url}}" | sed ':a;N;$!ba;$s/\(.*\)\n/\1/' ->
find_which_display.html

Yes funny but it works quite well. 

Thanks


> 
> On Fri, Jan 22, 2010 at 1:15 PM, Ali Rıza Keleş  wrote:
> >
> > On Fri, 2010-01-22 at 12:55 -0500, Bill Freeman wrote:
> >> I'm pretty sure that your templatetag does produce the newline.  The url 
> >> tag,
> >> for example, doesn't add a newline.  How about posting the code?
> >>
> >
> > Code here:
> >
> > @register.inclusion_tag('tags/find_which_display.html')
> > def find_which_display(photo):
> >if photo.source == "ext":
> >display_url = photo.get_ext_url()
> >else:
> >display_url = photo.get_display_url()
> >return {'display_url': display_url}
> >
> >
> > and tags/find_which_display.html:
> >
> > {{ display_url }}
> >
> > just have one line doesn't have the second.
> >
> >
> > i tried to return like below but it was same.
> >
> >...
> >return {'display_url': remove_newlines(display_url)}
> >
> >
> > def remove_newlines(text):
> >normalized_text = normalize_newlines(text)
> >return mark_safe(normalized_text.replace('\n', ''))
> >
> >
> >
> > Thanks
> >
> > --
> > Ali
> >
> >
> >
> >
> >> On Fri, Jan 22, 2010 at 12:37 PM, Ali Rıza Keleş  
> >> wrote:
> >> > Hi,
> >> >
> >> > I have a templatetag which decides somthing and returns it. I works well
> >> > within HTML, but it causes error while it is in JavaScript, because of
> >> > newline which is produced by django rendering this templatetag.
> >> >
> >> > For example:
> >> >  produces
> >> >
> >> > http://media..com/images/2010/01/22/test_image.jpg
> >> > " />
> >> >
> >> > and yes it has newline but it works and display image.
> >> >
> >> > But here:
> >> > 
> >> > ...
> >> > replacePhoto('{% find_which_display photo %}');
> >> > ...
> >> >  produces
> >> >
> >> > 
> >> > ...
> >> > replacePhoto('http://media..com/images/2010/01/22/test_image.jpg
> >> > ');
> >> > ...
> >> > 
> >> >
> >> > and of course it fails.
> >> >
> >> > I am sure that my templatetag find_which_display does not produce this
> >> > newline, i tried and tested it, also I dont know who does and how I can
> >> > fix it.
> >> >
> >> > Thanks for any help..
> >> >
> >> > --
> >> > Ali Rıza Keleş
> >> >
> >> > --
> >> > You received this message because you are subscribed to the Google 
> >> > Groups "Django users" group.
> >> > To post to this group, send email to django-us...@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.
> >> >
> >> >
> >>
> >
> > --
> > You received this message because you are subscribed to the Google Groups 
> > "Django users" group.
> > To post to this group, send email to django-us...@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.
> >
> >
> 

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: templatetag produce extra newline

2010-01-22 Thread Bill Freeman
I believe that you will find that the file
tags/find_which_display.html has a newline
at it's end.  If you don't have the *nix utility od, you can, with any
conventint
python, do:

f=open('path_to_tags_template_dir/tags/find_which_display.html', 'rb')
s=f.read()
f.close()
print repr(s)

Probably you have an editor that insists on ending files with
newlines.  Or perhaps
you had not considered that newline.  Anyway, I dummied up a test
version of your
code, and it works fine for me, with no trailing newline.

Bill

On Fri, Jan 22, 2010 at 1:15 PM, Ali Rıza Keleş  wrote:
>
> On Fri, 2010-01-22 at 12:55 -0500, Bill Freeman wrote:
>> I'm pretty sure that your templatetag does produce the newline.  The url tag,
>> for example, doesn't add a newline.  How about posting the code?
>>
>
> Code here:
>
> @register.inclusion_tag('tags/find_which_display.html')
> def find_which_display(photo):
>    if photo.source == "ext":
>        display_url = photo.get_ext_url()
>    else:
>        display_url = photo.get_display_url()
>    return {'display_url': display_url}
>
>
> and tags/find_which_display.html:
>
> {{ display_url }}
>
> just have one line doesn't have the second.
>
>
> i tried to return like below but it was same.
>
>    ...
>    return {'display_url': remove_newlines(display_url)}
>
>
> def remove_newlines(text):
>    normalized_text = normalize_newlines(text)
>    return mark_safe(normalized_text.replace('\n', ''))
>
>
>
> Thanks
>
> --
> Ali
>
>
>
>
>> On Fri, Jan 22, 2010 at 12:37 PM, Ali Rıza Keleş  
>> wrote:
>> > Hi,
>> >
>> > I have a templatetag which decides somthing and returns it. I works well
>> > within HTML, but it causes error while it is in JavaScript, because of
>> > newline which is produced by django rendering this templatetag.
>> >
>> > For example:
>> >  produces
>> >
>> > http://media..com/images/2010/01/22/test_image.jpg
>> > " />
>> >
>> > and yes it has newline but it works and display image.
>> >
>> > But here:
>> > 
>> > ...
>> > replacePhoto('{% find_which_display photo %}');
>> > ...
>> >  produces
>> >
>> > 
>> > ...
>> > replacePhoto('http://media..com/images/2010/01/22/test_image.jpg
>> > ');
>> > ...
>> > 
>> >
>> > and of course it fails.
>> >
>> > I am sure that my templatetag find_which_display does not produce this
>> > newline, i tried and tested it, also I dont know who does and how I can
>> > fix it.
>> >
>> > Thanks for any help..
>> >
>> > --
>> > Ali Rıza Keleş
>> >
>> > --
>> > You received this message because you are subscribed to the Google Groups 
>> > "Django users" group.
>> > To post to this group, send email to django-us...@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.
>> >
>> >
>>
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-us...@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.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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.



I18N

2010-01-22 Thread jrs_66
The following -

#: contrib/admin/templates/admin/base.html:26
msgid "Welcome,"
msgstr "Bienvenido/a,"

is from the Django spanish django.po file.  I understand that the
language supports the word 'Bienvenido' ending in an 'o' or an 'a'.
Any idea how the django template tag {% trans "Welcome," %} supports
choosing the correct end letter?

Also, after changing a *.po file and attempting to run 'django-
admin.py compilemessages', I throw an error-

/home/locale/de/LC_MESSAGES/._django.po:1:1: parse error
/home/locale/de/LC_MESSAGES/._django.po:1: keyword "R" unknown

Anyone know why?

Thanks.

ps- please keep any snarky, self-righteous comments to yourselves...

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: About generated html forms with django

2010-01-22 Thread Ariel
I am asking you that because I am having problems to download it.



On Fri, Jan 22, 2010 at 12:13 PM, Ariel  wrote:

> Why is this http://github.com/bartTC/django-frontendadmin helpfull ???
>
> Regards
> Ariel
>
>   On Fri, Jan 22, 2010 at 12:00 PM, Daniel Hilton  > wrote:
>
>> 2010/1/22 Ariel :
>>  > Hi everybody:
>> > I need to make an automatic admin interface with a behaviour similar to
>> the
>> > Django's default admin interface but not totally equal, then I need to
>> know
>> > how django generate all the html forms and views methods for any class
>> > included in the model, how does django do that ??? Where are the classes
>> > that control all the generated html forms and views methods ???
>> > How could I make this ???
>> > Could you help me ?
>> > Thanks in advance
>> > Ariel
>>
>> Django-frontendadmin may help you:
>>
>> http://github.com/bartTC/django-frontendadmin
>>
>> You'll need to read the forms documentation as well though and have an
>> understanding of the basics of form processing:
>> http://www.djangobook.com/en/2.0/chapter07/
>>
>> HTH
>> Dan
>>
>>
>> >
>> > --
>> > You received this message because you are subscribed to the Google
>> Groups
>> > "Django users" group.
>> > To post to this group, send email to django-us...@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.
>> >
>>
>>
>>
>> --
>> Dan Hilton
>> 
>> www.twitter.com/danhilton
>> www.DanHilton.co.uk 
>> 
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To post to this group, send email to django-us...@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.
>>
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: templatetag produce extra newline

2010-01-22 Thread Ali Rıza Keleş

On Fri, 2010-01-22 at 12:55 -0500, Bill Freeman wrote:
> I'm pretty sure that your templatetag does produce the newline.  The url tag,
> for example, doesn't add a newline.  How about posting the code?
> 

Code here: 

@register.inclusion_tag('tags/find_which_display.html')
def find_which_display(photo):
if photo.source == "ext":
display_url = photo.get_ext_url()
else:
display_url = photo.get_display_url()
return {'display_url': display_url}


and tags/find_which_display.html:

{{ display_url }}

just have one line doesn't have the second.


i tried to return like below but it was same. 

...
return {'display_url': remove_newlines(display_url)}


def remove_newlines(text):
normalized_text = normalize_newlines(text)
return mark_safe(normalized_text.replace('\n', ''))



Thanks

--
Ali




> On Fri, Jan 22, 2010 at 12:37 PM, Ali Rıza Keleş  
> wrote:
> > Hi,
> >
> > I have a templatetag which decides somthing and returns it. I works well
> > within HTML, but it causes error while it is in JavaScript, because of
> > newline which is produced by django rendering this templatetag.
> >
> > For example:
> >  produces
> >
> > http://media..com/images/2010/01/22/test_image.jpg
> > " />
> >
> > and yes it has newline but it works and display image.
> >
> > But here:
> > 
> > ...
> > replacePhoto('{% find_which_display photo %}');
> > ...
> >  produces
> >
> > 
> > ...
> > replacePhoto('http://media..com/images/2010/01/22/test_image.jpg
> > ');
> > ...
> > 
> >
> > and of course it fails.
> >
> > I am sure that my templatetag find_which_display does not produce this
> > newline, i tried and tested it, also I dont know who does and how I can
> > fix it.
> >
> > Thanks for any help..
> >
> > --
> > Ali Rıza Keleş
> >
> > --
> > You received this message because you are subscribed to the Google Groups 
> > "Django users" group.
> > To post to this group, send email to django-us...@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.
> >
> >
> 

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: About generated html forms with django

2010-01-22 Thread Ariel
Why is this http://github.com/bartTC/django-frontendadmin helpfull ???

Regards
Ariel

On Fri, Jan 22, 2010 at 12:00 PM, Daniel Hilton wrote:

> 2010/1/22 Ariel :
>  > Hi everybody:
> > I need to make an automatic admin interface with a behaviour similar to
> the
> > Django's default admin interface but not totally equal, then I need to
> know
> > how django generate all the html forms and views methods for any class
> > included in the model, how does django do that ??? Where are the classes
> > that control all the generated html forms and views methods ???
> > How could I make this ???
> > Could you help me ?
> > Thanks in advance
> > Ariel
>
> Django-frontendadmin may help you:
>
> http://github.com/bartTC/django-frontendadmin
>
> You'll need to read the forms documentation as well though and have an
> understanding of the basics of form processing:
> http://www.djangobook.com/en/2.0/chapter07/
>
> HTH
> Dan
>
>
> >
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Django users" group.
> > To post to this group, send email to django-us...@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.
> >
>
>
>
> --
> Dan Hilton
> 
> www.twitter.com/danhilton
> www.DanHilton.co.uk 
> 
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@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.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: About generated html forms with django

2010-01-22 Thread Daniel Hilton
2010/1/22 Ariel :
> Hi everybody:
> I need to make an automatic admin interface with a behaviour similar to the
> Django's default admin interface but not totally equal, then I need to know
> how django generate all the html forms and views methods for any class
> included in the model, how does django do that ??? Where are the classes
> that control all the generated html forms and views methods ???
> How could I make this ???
> Could you help me ?
> Thanks in advance
> Ariel

Django-frontendadmin may help you:

http://github.com/bartTC/django-frontendadmin

You'll need to read the forms documentation as well though and have an
understanding of the basics of form processing:
http://www.djangobook.com/en/2.0/chapter07/

HTH
Dan


>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@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.
>



-- 
Dan Hilton

www.twitter.com/danhilton
www.DanHilton.co.uk


-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: templatetag produce extra newline

2010-01-22 Thread Bill Freeman
I'm pretty sure that your templatetag does produce the newline.  The url tag,
for example, doesn't add a newline.  How about posting the code?

On Fri, Jan 22, 2010 at 12:37 PM, Ali Rıza Keleş  wrote:
> Hi,
>
> I have a templatetag which decides somthing and returns it. I works well
> within HTML, but it causes error while it is in JavaScript, because of
> newline which is produced by django rendering this templatetag.
>
> For example:
>  produces
>
> http://media..com/images/2010/01/22/test_image.jpg
> " />
>
> and yes it has newline but it works and display image.
>
> But here:
> 
> ...
> replacePhoto('{% find_which_display photo %}');
> ...
>  produces
>
> 
> ...
> replacePhoto('http://media..com/images/2010/01/22/test_image.jpg
> ');
> ...
> 
>
> and of course it fails.
>
> I am sure that my templatetag find_which_display does not produce this
> newline, i tried and tested it, also I dont know who does and how I can
> fix it.
>
> Thanks for any help..
>
> --
> Ali Rıza Keleş
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-us...@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.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: Remove items from queryset?

2010-01-22 Thread Bill Freeman
A final possibility is to enumerate the id's of the objects that you want to
exclude, and then apply them to an unevaluated copy of the queryset
using exclude, e.g.;

q = base_queryset_construction()
excludes = []

for i in q.all():
   if shoud_be_excluded(i):
  excludes.append(i.id)

q = q.exclude(id__in=excludes}


Or, if you'll be excluding more than you will be including, you can enumerate
those you want to keep and use them with filter instead of exclude.

On Fri, Jan 22, 2010 at 12:39 PM, Igor  wrote:
> Bill,
>
> You're correct in all your guesses - I want to be able to chain more
> filtering to the query since I'm not sure what and how might use it
> later. Even in the current situation it's much better from design
> standpoint to chain a .distinct() on the set AFTER the exclusion of
> the values I don't like.
>
> I'm not (yet :)) an expert in Django as it's easy to guess, but in my
> understanding even after I've accessed the elements (i.e. SQL has been
> executed) filterng/sorting etc. should be working.
>
> The solution I've implemented for now is instead of creating a list,
> I've created an empty QuerySet and am joining every element I DO want
> to that set. The last line is the join, and my concern is that it's
> not too efficient. I know those result sets are not going to be more
> than 20 elements or even less so the inefficiency is probably
> negligible, but I would still be happy to find a way that would be
> efficient for any set size.
>
>                results = PDirectory.objects.none()
>                for d in dirs:
>                        splitpath = d.path.split("/")
>
>                        if len(splitpath) == 3: # that would be 
> root_dir/sub_dir
>                                results = results | dirs.filter(id=d.id) # 
> This is not efficient
> at all
>
> Thanks,
> Igor
>
>
> On Jan 22, 5:14 pm, Bill Freeman  wrote:
>> On Fri, Jan 22, 2010 at 10:22 AM, Igor  wrote:
>> > I would not like to rely on fieldname__regex because it's database-
>> > dependent.
>> > I've thought about lists as well, but not sure whether it's a good
>> > idea if it loses the queryset-ness.
>>
>> If a thing is still a queryset proper, it has to embody SQL that can fetch 
>> what
>> you want.  If you want database independence (good luck) the query must
>> only use (the commonly correctly implemented subset of) standard SQL.
>>
>> Once you have examined the data in python, the query has already been
>> run.  If you look at all of the returned objects in python, they have
>> all arrived
>> in memory, and making a list of them is nearly free.
>>
>> I'm guessing that you want this to remain queryset-like because you want
>> to apply further filtering to it beyond these exclusions.  If so, are you 
>> sure
>> that you can't reorganize to do these exclusions last?  Or do you need to
>> include instances (rows) in you calculation of the exclusion based on rows
>> that will eventually be excluded by the other filters?
>>
>> Another possibility, if you can express your constraints in standard SQL is
>> to use the extra() method of querysets to specify additional WHERE clauses
>> (will be ANDed with other constraints).
>>
>> Again if you can do it with standard SQL, there is always the custom query.
>> There is, however, a lot of manual labor involved in generating instances
>> from the return.  This is expected to get much easier, or so I've heard, in
>> 1.2.  And, of course, you don't need to generate actual instances if you
>> don't intend to modify and save them, and can pick and choose the fields
>> you want to return (this, too, has it's details to work out).
>>
>> Bill
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-us...@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.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: Remove items from queryset?

2010-01-22 Thread Igor
Bill,

You're correct in all your guesses - I want to be able to chain more
filtering to the query since I'm not sure what and how might use it
later. Even in the current situation it's much better from design
standpoint to chain a .distinct() on the set AFTER the exclusion of
the values I don't like.

I'm not (yet :)) an expert in Django as it's easy to guess, but in my
understanding even after I've accessed the elements (i.e. SQL has been
executed) filterng/sorting etc. should be working.

The solution I've implemented for now is instead of creating a list,
I've created an empty QuerySet and am joining every element I DO want
to that set. The last line is the join, and my concern is that it's
not too efficient. I know those result sets are not going to be more
than 20 elements or even less so the inefficiency is probably
negligible, but I would still be happy to find a way that would be
efficient for any set size.

results = PDirectory.objects.none()
for d in dirs:
splitpath = d.path.split("/")

if len(splitpath) == 3: # that would be root_dir/sub_dir
results = results | dirs.filter(id=d.id) # This 
is not efficient
at all

Thanks,
Igor


On Jan 22, 5:14 pm, Bill Freeman  wrote:
> On Fri, Jan 22, 2010 at 10:22 AM, Igor  wrote:
> > I would not like to rely on fieldname__regex because it's database-
> > dependent.
> > I've thought about lists as well, but not sure whether it's a good
> > idea if it loses the queryset-ness.
>
> If a thing is still a queryset proper, it has to embody SQL that can fetch 
> what
> you want.  If you want database independence (good luck) the query must
> only use (the commonly correctly implemented subset of) standard SQL.
>
> Once you have examined the data in python, the query has already been
> run.  If you look at all of the returned objects in python, they have
> all arrived
> in memory, and making a list of them is nearly free.
>
> I'm guessing that you want this to remain queryset-like because you want
> to apply further filtering to it beyond these exclusions.  If so, are you sure
> that you can't reorganize to do these exclusions last?  Or do you need to
> include instances (rows) in you calculation of the exclusion based on rows
> that will eventually be excluded by the other filters?
>
> Another possibility, if you can express your constraints in standard SQL is
> to use the extra() method of querysets to specify additional WHERE clauses
> (will be ANDed with other constraints).
>
> Again if you can do it with standard SQL, there is always the custom query.
> There is, however, a lot of manual labor involved in generating instances
> from the return.  This is expected to get much easier, or so I've heard, in
> 1.2.  And, of course, you don't need to generate actual instances if you
> don't intend to modify and save them, and can pick and choose the fields
> you want to return (this, too, has it's details to work out).
>
> Bill

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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.



templatetag produce extra newline

2010-01-22 Thread Ali Rıza Keleş
Hi, 

I have a templatetag which decides somthing and returns it. I works well
within HTML, but it causes error while it is in JavaScript, because of
newline which is produced by django rendering this templatetag. 

For example: 
 produces

http://media..com/images/2010/01/22/test_image.jpg
" />

and yes it has newline but it works and display image.

But here: 

...
replacePhoto('{% find_which_display photo %}');
...
 produces


...
replacePhoto('http://media..com/images/2010/01/22/test_image.jpg
');
...


and of course it fails. 

I am sure that my templatetag find_which_display does not produce this
newline, i tried and tested it, also I dont know who does and how I can
fix it.

Thanks for any help..

--
Ali Rıza Keleş 

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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.



About generated html forms with django

2010-01-22 Thread Ariel
Hi everybody:
I need to make an automatic admin interface with a behaviour similar to the
Django's default admin interface but not totally equal, then I need to know
how django generate all the html forms and views methods for any class
included in the model, how does django do that ??? Where are the classes
that control all the generated html forms and views methods ???
How could I make this ???
Could you help me ?
Thanks in advance
Ariel

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: Localizing database textarea fields using gettext chokes on \r\n.

2010-01-22 Thread Doug Van Horn
I did a little digging to get this working and here's what's going on:

The process calls to xgettext, msguniq, and msgmerge all yield
warnings to standard error.  However, the programs exit with status 0
so they're not in error, just emitting messages to standard error.

The code in the management command 'makemessages', however, interprets
anything emitted to standard error as a CommandError and raises it as
such.

It looks like the process exit status could be captured, but it might
not work on non-unix platforms (I have to look deeper at the python
popen stuff).


Would it make sense to open a ticket for this?  Maybe bring this up in
Django Developers?


doug.

On Jan 22, 10:50 am, Doug Van Horn  wrote:
> I'm trying to avoid changing my database around to accommodate
> localized strings.  I'm putting all strings from the database into a
> holding file (db_messages.py) which get dumped into my django.po file.
>
> The problem is that textarea fields contain "\r\n" as line endings,
> and running something like:
>
> _("This is line 1\r\nThis is line 2")
>
> through makemessages will get you an error:
>
> Error: errors happened while running xgettext on db_messages.py
> [snip]/db_messages.py:10: internationalized messages should not
> contain the `\r' escape sequence
>
> If I add the \r manually to the .po file, the messages will compile
> without issue.
>
> Has anyone else bumped into this?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: get all foreign keys that point to

2010-01-22 Thread Malcolm Box
The list of all drivers in a team is

(assuming self is a team instance)

drivers = self.driver_set().all()

Hope that helps.

Malcolm


On Thu, Jan 21, 2010 at 2:49 AM, Ether Joe  wrote:

> Hello there, quick (hopefully) question for you - how do I get a list
> of records in a foreign table that point back to the object making the
> query?
>
> For example - a Formula One racing team, where each Team has 0 or more
> Drivers, and each Driver can be a member of only one Team. How do I
> get a list of all Drivers that point to a specific Team, and then
> display them on the Team page? Perhaps using a TeamAdmin or
> TeamManager class?
>
> class Team(models.Model):
>...
> class Driver(models.Model):
>...
>team = models.ForeignKey(Team)
>
> I looked at using a TeamAdmin with an InlineModelAdmin pointing to
> Driver. This gets me the Drivers on the Team page. But I don't want to
> edit the Drivers - just display. Also, I want to do things with the
> queryset (eg., count them).
>
> 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-us...@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.
>
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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.



Localizing database textarea fields using gettext chokes on \r\n.

2010-01-22 Thread Doug Van Horn
I'm trying to avoid changing my database around to accommodate
localized strings.  I'm putting all strings from the database into a
holding file (db_messages.py) which get dumped into my django.po file.

The problem is that textarea fields contain "\r\n" as line endings,
and running something like:

_("This is line 1\r\nThis is line 2")

through makemessages will get you an error:

Error: errors happened while running xgettext on db_messages.py
[snip]/db_messages.py:10: internationalized messages should not
contain the `\r' escape sequence

If I add the \r manually to the .po file, the messages will compile
without issue.

Has anyone else bumped into this?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: Templating problem: equal symbol "=" escaped to "=3D"

2010-01-22 Thread Malcolm Box
Try it and see!

Malcolm

On Thu, Jan 21, 2010 at 4:05 PM, Enrico Sartorello <
enrico.sartore...@gmail.com> wrote:

> Ok maybe I got it.
>
> I found those "=3D" symbols just looking at the output of the Python SMTP
> server that simulates the email process.
>
> I think that those mime escaped characters will be correctly converted back
> to "=" symbols when processed by a mail client.
>
> Am I correct?
>
>
>
> On Thu, Jan 21, 2010 at 4:49 PM, Enrico Sartorello <
> enrico.sartore...@gmail.com> wrote:
>
>> You're right, it's the mime escaping!
>>
>> In order to send emails I simply use:
>>
>> render_to_string(file)
>> send_mail()
>>
>> How can I send plain text messages with '=' symbols without getting it
>> escaped?
>>
>>
>>
>> On Thu, Jan 21, 2010 at 4:20 PM, Malcolm Box wrote:
>>
>>> Are you sure it's django templates that are doing the escaping? =3D is
>>> the mime escaping for = - could it be something else in your email
>>> processing chain that's escaping the sign?
>>> Malcolm
>>>
>>> On 1/21/10, Enrico Sartorello  wrote:
>>> > Hi,
>>> > i'm using Django template system to render some text files (not HTML
>>> pages)
>>> > that I use to send emails.
>>> >
>>> > I have a problem: in a template file, any occurence of the "=" symbol
>>> is
>>> > escaped to "=3D" no matter what is placed before or after it.
>>> > '=' is strangely escaped to '=3D' even if autoescape is off or the
>>> > containing string is marked with 'safe' filter.
>>> >
>>> > What's wrong with that?
>>> >
>>> > Please help me because I've lost a lot of time trying to solve this
>>> issue!
>>> >
>>> > Thanks in advance :-)
>>> >
>>> > --
>>> > Enrico Sartorello
>>> >
>>>
>>> --
>>> Sent from my mobile device
>>>
>>> --
>>> You received this message because you are subscribed to the Google Groups
>>> "Django users" group.
>>> To post to this group, send email to django-us...@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.
>>>
>>>
>>>
>>>
>>
>>
>> --
>> Enrico Sartorello
>>
>
>
>
> --
> Enrico Sartorello
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@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.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: Should a decorator be used here or should I do something else.

2010-01-22 Thread Malcolm Box
If it's different instances of the model that should have age-restrictions
applied then I would be tempted to push this down to the model layer by
creating a new Manager called e.g. age_filtered and then use that in view:

q = Data.age_filtered(age).filter(id=23)

You could even make the default manager the age filter so that if a view
forgets to use the age_filtered() manager then they only get "safe" all ages
content (assuming such a thing exists).

Malcolm

On Thu, Jan 21, 2010 at 5:13 PM, Bill Freeman  wrote:

> A decorator is certainly a clean way to apply consistent checking to a
> bunch of
> views.  But it is primarily useful if the selection of the view
> function by the urlconf
> gives you all you need to know about for what age groups the *CONTENT* is
> appropriate.
>
> If, on the other hand, different rows in the same table (different
> instances of the
> same model) are appropriate for different age groups, then you're stuck
> with
> either doing your object query in the decorator and passing it to the
> view, which
> might be too magic.  (Maybe pass a base queryset to the view for
> further filtering,
> but still pretty magic.)
>
> A shared function that you call from the view to filter a queryset based on
> age
> criteria might feel more explicit.
>
> Bill
>
> On Wed, Jan 20, 2010 at 5:15 PM, Jeffrey Taggarty 
> wrote:
> > Hi Guys, I have a bit of a dilemma in terms of design of a small web
> > application...
> >
> > I have this requirement where content is being served by age group. On
> > first load the user selects their age group and I store that in the
> > cookie. I read that cookie and query content for the pages based on
> > that agegroup cookie. My question is should I use a decorator to check
> > the cookie on every new page requested to make sure they're getting
> > the proper content served based on that agegroup in the cookie? I have
> > about 6 functions in total in my views. I was thinking just writing a
> > decorator to handle that but I am not sure that's the best way to go
> > about this.
> >
> > Thanks
> >
> >
> > Jeff
> >
> > --
> > You received this message because you are subscribed to the Google Groups
> "Django users" group.
> > To post to this group, send email to django-us...@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.
> >
> >
> >
> >
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@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.
>
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: Need your expertise

2010-01-22 Thread Malcolm Box
On Fri, Jan 22, 2010 at 9:03 AM, Jigs  wrote:

> We are currently deciding if Django Framework will suit our needs.



>
> Templates and Python is a must requirement for the project. Reporting
> and Monitoring modules will be created in the future. Please advise if
> we are going in the right direction if ever we are using Django.
>
> Django does all those things.

It's not really possible to tell you whether Django is suitable for your app
- only you know all the requirements and what you want to do.  Django can
probably be used to create any sort of web application - what changes is how
easy it is, and how much you have to do versus getting off-the-shelf.

Your best bet is to read the Django docs to get a feel for what it does, and
then evaluate yourself.

Cheers,

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-us...@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: Remove items from queryset?

2010-01-22 Thread Bill Freeman
On Fri, Jan 22, 2010 at 10:22 AM, Igor  wrote:
> I would not like to rely on fieldname__regex because it's database-
> dependent.
> I've thought about lists as well, but not sure whether it's a good
> idea if it loses the queryset-ness.

If a thing is still a queryset proper, it has to embody SQL that can fetch what
you want.  If you want database independence (good luck) the query must
only use (the commonly correctly implemented subset of) standard SQL.

Once you have examined the data in python, the query has already been
run.  If you look at all of the returned objects in python, they have
all arrived
in memory, and making a list of them is nearly free.

I'm guessing that you want this to remain queryset-like because you want
to apply further filtering to it beyond these exclusions.  If so, are you sure
that you can't reorganize to do these exclusions last?  Or do you need to
include instances (rows) in you calculation of the exclusion based on rows
that will eventually be excluded by the other filters?

Another possibility, if you can express your constraints in standard SQL is
to use the extra() method of querysets to specify additional WHERE clauses
(will be ANDed with other constraints).

Again if you can do it with standard SQL, there is always the custom query.
There is, however, a lot of manual labor involved in generating instances
from the return.  This is expected to get much easier, or so I've heard, in
1.2.  And, of course, you don't need to generate actual instances if you
don't intend to modify and save them, and can pick and choose the fields
you want to return (this, too, has it's details to work out).

Bill

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: Admin calendar popups on datefield suddenly missing

2010-01-22 Thread Bill Freeman
Note that the net tab in firebug is one way to see which references
aren't loading.

On Fri, Jan 22, 2010 at 6:26 AM, David De La Harpe Golden
 wrote:
> Walt wrote:
>> Okay, we're getting somewhere. It can find the JS file(s) just fine
>
> The static files maybe.
>
>> and I see that the calendars are added dynamically. However, I'm
>> have found that it is generating a javascript error when the page
>> loads:
>>
>> Error: gettext is not defined
>
> Now, I'm working from django 1.1.1 not trunk, it's possible django trunk
> has changed how this works, but in 1.1.1:
>
> gettext should be defined in admin's javascript environment: It is
> generated by AdminSite.i18n_javascript() which produces a dynamically
> generated js snippet by calling django.views.i18n.javascript_catalog().
>  This snippet should be made available at a url under the admin and is
> included along with the various static script files in the head of all
> the admin pages for, well i18n.  Even if i18n is disabled, a trivial
> variant of it is generated.
>
>
> Try visiting
> http://tachamber.org/chamber/admin/jsi18n/
>
> (or wherever you put your admin)
>
> You should find a javascript snippet with a header
>
> /* gettext library */
>
> ... unless a django developer can chime in with "it doesn't work that
> anymore".
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-us...@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.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: Remove items from queryset?

2010-01-22 Thread Igor

Wow, thanks for all the replies! :)

I would not like to rely on fieldname__regex because it's database-
dependent.
I've thought about lists as well, but not sure whether it's a good
idea if it loses the queryset-ness.

The idea of pop() and del() is the most appealing... del actually, but
I couldn't get it to work. Same with binary set operations - '&' and
'|' work but '-' doesn't and '-'  would really help... any more ideas
maybe?

Thanks,
Igor

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: Extend model choice in project

2010-01-22 Thread Daniel Roseman
On Jan 22, 2:33 pm, Thomas Guettler  wrote:
> Hi,
>
> in my app I have this:
>
> class FooModel(models.Model):
>     example=models.SmallIntegerField(choices=[(1, u'one'),
>                                               (2, u'two'),
>                                               ...]
>
> I want to extend the choices at project level. Where
> should I put the code?
>
>   Thomas

Perhaps put the choice list in settings.py, and import it from there
in your models.py?
--
DR.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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.



Extend model choice in project

2010-01-22 Thread Thomas Guettler
Hi,

in my app I have this:

class FooModel(models.Model):
example=models.SmallIntegerField(choices=[(1, u'one'),
  (2, u'two'),
  ...]

I want to extend the choices at project level. Where
should I put the code?


  Thomas


-- 
Thomas Guettler, http://www.thomas-guettler.de/
E-Mail: guettli (*) thomas-guettler + de

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: Remove items from queryset?

2010-01-22 Thread Karen Tracey
On Fri, Jan 22, 2010 at 9:15 AM, Igor  wrote:

> Hello,
>
> I need to exclude some items from a QuerySet based on field analysis
> with regular expressions. Which means in my understanding means that I
> need to first evaluate the QuerySet and then go thru it and use python
> to remove some items based on my analysis.
>

Does the regex lookup (
http://docs.djangoproject.com/en/dev/ref/models/querysets/#regex) combined
with exclude() not meet your needs?

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-us...@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: Remove items from queryset?

2010-01-22 Thread Jani Tiainen
On Fri, 2010-01-22 at 06:15 -0800, Igor wrote:
> Hello,
> 
> I need to exclude some items from a QuerySet based on field analysis
> with regular expressions. Which means in my understanding means that I
> need to first evaluate the QuerySet and then go thru it and use python
> to remove some items based on my analysis.
> 
> Now, how can I accomplish that? I was not able to find a way to remove
> items from a QuerySet.
> 
> Thanks in advance

Simplest route:

l = list(qs)

Of course, after that is no more queryset but just a plain old Python
list containing all objects from your queryset.

-- 

Jani Tiainen


-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: Remove items from queryset?

2010-01-22 Thread Shawn Milochik
How about creating a Python list, which you populate from chosen items of your 
queryset? You might even be able to do it with a list comprehension, depending 
on how complex your filtering is. The contents of a queryset are just model 
instances. Nothing magical you can't pull out and manipulate with standard 
Python.

Shawn

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: Remove items from queryset?

2010-01-22 Thread Daniel Roseman
On Jan 22, 2:15 pm, Igor  wrote:
> Hello,
>
> I need to exclude some items from a QuerySet based on field analysis
> with regular expressions. Which means in my understanding means that I
> need to first evaluate the QuerySet and then go thru it and use python
> to remove some items based on my analysis.
>
> Now, how can I accomplish that? I was not able to find a way to remove
> items from a QuerySet.
>
> Thanks in advance
>
> Igor

If it's a simple regex comparison on a field, you may be able to do it
directly in the query:

qs = MyModel.objects.exclude(fieldname__regex=r'^regex')

If you really do need to iterate through and exclude things, a
queryset acts just like a list so you can .pop() items and del() them.
Or better, you can append the items you *do* want to a separate list.
--
DR.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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.



Remove items from queryset?

2010-01-22 Thread Igor
Hello,

I need to exclude some items from a QuerySet based on field analysis
with regular expressions. Which means in my understanding means that I
need to first evaluate the QuerySet and then go thru it and use python
to remove some items based on my analysis.

Now, how can I accomplish that? I was not able to find a way to remove
items from a QuerySet.

Thanks in advance

Igor

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: GET request breadcrumbs

2010-01-22 Thread Andy Mikhailenko
I would suggest using django-navigation or a similar approach, that is
to bind breadcrumbs-related code to views instead of templates. Of
course you would still render the breadcrumbs in a template, but that
would be a single piece of code (I usually place it right in the
project's base.html) which deals with a list of "crumbs". The list is
generated with regard to current URL.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: Best Practice for developing djangoapp in a repository

2010-01-22 Thread Andy Mikhailenko
Why not create a symlink to django-tagging/tagging in the project
directory? I think it's the easiest way.

--
regards,
Andy

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: About unit testing

2010-01-22 Thread Dougal Matthews
If you look at the tests in django-shorturls you can see how they created
models that were only used for the tests:


http://github.com/jacobian/django-shorturls/tree/master/src/shorturls/tests/


---
Dougal Matthews - @d0ugal
http://www.dougalmatthews.com/



2010/1/22 Gabriel Reis 

> Hi,
>
> I would like to know if it is mandatory to create an application and define
> my model in the models.py file or if it is possible to define a model
> locally in my test method (inside my TestCase class) and interact with it
> and saving without creating an application and the models.py. In other
> words, is it possible to force the creation of the table inside the test
> method?
> Example:
>
> class MyTestCase(TestCase):
>
> def test_something(self):
> class MyModel(models.Model):
> foo = CharField(max_length=10)
>
> call_something_to_sync_db()
>
> m = MyModel(foo='something')
> m.save()
>
>
> Thanks for your attention!
>
> Kind regards,
>
> Gabriel
>
> --
> Gabriel de Carvalho Nogueira Reis
> Software Developer
> +44 7907 823942
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@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.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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.



Looking for Django / Python Developers in Edinburgh

2010-01-22 Thread mercurytide
Established in 2001, Mercurytide is an industry expert in web
development, with offices in both Edinburgh and Glasgow.  We only
employ individuals of an expectantly high standard and use Django as
our main platform.

We are looking to recruit for the following positions for our
Edinburgh office:

Django / Python Developers
The role will involve both implementing a site design in XHTML, CSS
and JavaScript, and the corresponding back end development to produce
advanced, database-driven dynamic sites. We have multiple roles to
fill and are looking for good developers at all levels of experience.
If you only know PHP and are eager to convert to Django then we may
still be interested.  The role will involve designing the architecture
of solutions as well as developing well crafted, readable and
maintainable code.  Knowledge of related technologies including SQL
and XML would also be advantageous.

iPhone App Developer
The role will involve developing new iPhone applications from scratch
for new and existing clients so experience of developing commercial
applications is essential.
You should have experience in Objective-C and a knowledge of
interfacing mobile applications to third party systems.  The role will
involve designing the architecture of solutions as well as developing
well crafted, readable and maintainable code.

Web Developer
The role will involve both implementing a site design in XHTML, CSS
and JavaScript, and the corresponding back end development to produce
advanced, database-driven dynamic sites. As our main platform is
Django, experience of object orientated languages is essential. PHP
experience will be considered as a transferable skill, although the
company does not use this technology.  Understanding of standards-
based Web development and producing accessible sites is a key
requirement. The successful candidate will need to become self
sufficient in Python and related technologies including SQL and XML.
The position will involve designing the architecture of solutions as
well as developing well crafted, readable and maintainable code.

This is an outstanding opportunity to join an established but growing
team of web developers working with cutting edge technologies.

To apply for any of these positions please email your CV to
j...@mercurytide.co.uk or give us a call on 0845 652 6506.
www.mercurytide.co.uk

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: About unit testing

2010-01-22 Thread Larrik Jaerico
What are you actually trying to accomplish?

On Jan 22, 6:25 am, Gabriel Reis  wrote:
> Hi,
>
> I would like to know if it is mandatory to create an application and define
> my model in the models.py file or if it is possible to define a model
> locally in my test method (inside my TestCase class) and interact with it
> and saving without creating an application and the models.py. In other
> words, is it possible to force the creation of the table inside the test
> method?
> Example:
>
> class MyTestCase(TestCase):
>
>     def test_something(self):
>         class MyModel(models.Model):
>             foo = CharField(max_length=10)
>
>         call_something_to_sync_db()
>
>         m = MyModel(foo='something')
>         m.save()
>
> Thanks for your attention!
>
> Kind regards,
>
> Gabriel
>
> --
> Gabriel de Carvalho Nogueira Reis
> Software Developer
> +44 7907 823942

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: Import problem on the attempt to use {% url %}

2010-01-22 Thread Felipe
Thanks a lot Karen Tracey.

You've solved my problem.

Felipe.


On 22 jan, 01:13, Karen Tracey  wrote:
> On Thu, Jan 21, 2010 at 9:28 PM, Felipe  wrote:
> > Hello Friends,
>
> > Someone here know what this error mean?
>
> >http://www.catojo.com.br/contact/
>
> > This generally happens when I try to use something like {% url %} tag.
>
> > But I've been ensured that the view 'home.views' exists and it is
> > placed in blog.home.views directory, however, by some unknown issue
> > this error message are appearing my browser.
>
> > Someone have a tip to me fix the problem ?
>
> You've got a url pattern in your configuration that references a module
> named 'home.views', but Python cannot find any module named that. Based on
> the traceback information, /home/storage/b/fe/45/catojo/wsgi_apps is in the
> PYTHONPATH.  Apparently under that you have blog/, then home/, then a
> views.py in there?
>
> But combining what you have in your path plus home.views results in Python
> attempting to find a file named:
>
> /home/storage/b/fe/45/catojo/wsgi_apps/home/views.py
>
> not:
>
> /home/storage/b/fe/45/catojo/wsgi_apps/blog/home/views.py
>
> The blog part has to be either included in the url pattern reference or in a
> PYTHONPATH entry.  As it is, neither has it, so Python cannot find any
> module named home.views when searching through the Python path.
>
> 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-us...@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: Feed not available - Syndication - Django 1.1.1

2010-01-22 Thread Kenny Meyer
Kenny Meyer (knny.m...@gmail.com) wrote:
> El 22/01/10 07:31, Kenny Meyer escribió:
> > I'm trying to generate some feeds for my blog with Django's high-level
> > Syndication Framework. 
> > My problem is, when browsing to the URL defined in the ``link``
> > attribute of the ``syndication.Feed`` model, there's no Feed
> > generated/displayed.
> >   
> The link attribute is just what will show in the feed markup as.. well..
> the feed's link, doesn't
> necessarily have to be the subscription url. You usually want to set it
> to the url for that content in your site. Look at Django's community
> aggregator feed:
> 
> 
> 
>   
> The Django community aggregator
> http://www.djangoproject.com/community/
> ...
> 
> While the link attribute is http://www.djangoproject.com/community/ ,
> the feed's url is actually http://www.djangoproject.com/rss/community/

I brought something out of order... Your example is perfectly logic and
understanding to me. I had a false concept of ``link``.
> > ---
> > PROBLEM
> > ---
> >
> > Now as mention earlier, when browsing to http://localhost:8000/blog/
> > there's no option for subscribing to the feed.
> > I've compared a lot of configurations and I cannot see the problem.
> >   
> 
> Well, isn't that something you'd define yourself? Or what do you mean by
> "option for subscribing to the feed"?

By that I mean, Django creating the link to the Syndication feed
automatically in the '' section of my template, which is wrong.
I now understand that.

So I've created a reference to the feed in my template and it's
working. :) Now I only have to check how to reverse lookup the feed to
not write static code.

Thanks for your help and time, Gonzalo.

Hablamos,
Kenny


signature.asc
Description: Digital signature


Django Admin interface and filter by value

2010-01-22 Thread onorua
I have two models:

class User(models.Model):

LoginName = models.CharField('login', max_length=50)
Email = models.EmailField('e-mail', blank=True)
FirstName = models.CharField(max_length=50)
LastName = models.CharField(max_length=50)
IpAddress = models.IPAddressField(unique=True)
MacAddress = models.CharField(max_length=17)
UserAddress = models.CharField(max_length=250)
Switch = models.ForeignKey('Switch')
Port = models.ForeignKey('Port')


class Switch(models.Model):
SwitchTypes = (
('N', 'Non managed'),
('M', 'Managed'),
('3', '3 Layer'),
)
SwitchSNMP = (
('Y', 'Yes'),
('N', 'No'),
)
Name = models.CharField( max_length=50)
IpAddress = models.IPAddressField('unique=True)
Location = models.CharField(max_length=250)
Manufacture = models.CharField(max_length=50)
Model = models.CharField(max_length=50)
PortsNumber = models.IntegerField()
Type = models.CharField(max_length=1, choices=SwitchTypes)
SNMP_enable = models.CharField( max_length=1, choices=SwitchSNMP)
SNMP_group = models.CharField(max_length=50, blank=True)
def __unicode__(self):
return ('%s %s' % (self.Name, self.IpAddress))

class Port(models.Model):
MediaType = (
('C', 'Copper'),
('F', 'Fiber'),
)

Type = models.CharField(max_length=1, choices=MediaType)
MaxSpeed = models.SmallIntegerField(default = 100)
CurSpeed = models.SmallIntegerField(default=100)
Switch = models.ForeignKey('Switch')
PortNum = models.SmallIntegerField()
Description =  models.CharField(max_length=250, blank=True)

def __unicode__(self):
return ('%s ' % (self.PortNum))


I would like to have following:
1. When I create a new user, I choose switch from the list of
available switches, and when I go to the Port, it will automatically
shows only Ports for this particular switch.
2. When I add a new Switch, and put the port number as 16, they would
be automatically crated with the default values.

Is it possible to do? Could you please point me out on the elegant
solution.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: Admin calendar popups on datefield suddenly missing

2010-01-22 Thread David De La Harpe Golden
Walt wrote:
> Okay, we're getting somewhere. It can find the JS file(s) just fine

The static files maybe.

> and I see that the calendars are added dynamically. However, I'm
> have found that it is generating a javascript error when the page
> loads:
> 
> Error: gettext is not defined

Now, I'm working from django 1.1.1 not trunk, it's possible django trunk
has changed how this works, but in 1.1.1:

gettext should be defined in admin's javascript environment: It is
generated by AdminSite.i18n_javascript() which produces a dynamically
generated js snippet by calling django.views.i18n.javascript_catalog().
 This snippet should be made available at a url under the admin and is
included along with the various static script files in the head of all
the admin pages for, well i18n.  Even if i18n is disabled, a trivial
variant of it is generated.


Try visiting
http://tachamber.org/chamber/admin/jsi18n/

(or wherever you put your admin)

You should find a javascript snippet with a header

/* gettext library */

... unless a django developer can chime in with "it doesn't work that
anymore".

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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.



About unit testing

2010-01-22 Thread Gabriel Reis
Hi,

I would like to know if it is mandatory to create an application and define
my model in the models.py file or if it is possible to define a model
locally in my test method (inside my TestCase class) and interact with it
and saving without creating an application and the models.py. In other
words, is it possible to force the creation of the table inside the test
method?
Example:

class MyTestCase(TestCase):

def test_something(self):
class MyModel(models.Model):
foo = CharField(max_length=10)

call_something_to_sync_db()

m = MyModel(foo='something')
m.save()


Thanks for your attention!

Kind regards,

Gabriel

--
Gabriel de Carvalho Nogueira Reis
Software Developer
+44 7907 823942

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: Feed not available - Syndication - Django 1.1.1

2010-01-22 Thread Gonzalo Delgado
El 22/01/10 07:31, Kenny Meyer escribió:
> I'm trying to generate some feeds for my blog with Django's high-level
> Syndication Framework. 
> My problem is, when browsing to the URL defined in the ``link``
> attribute of the ``syndication.Feed`` model, there's no Feed
> generated/displayed.
>   
The link attribute is just what will show in the feed markup as.. well..
the feed's link, doesn't
necessarily have to be the subscription url. You usually want to set it
to the url for that content in your site. Look at Django's community
aggregator feed:



  
The Django community aggregator
http://www.djangoproject.com/community/
...

While the link attribute is http://www.djangoproject.com/community/ ,
the feed's url is actually http://www.djangoproject.com/rss/community/

> If not clear what I'm trying to say, please read details on the bottom
> of this message.
>
> Here's my code:
>
> apps/blog/feeds.py:
>
> from django.contrib.syndication.feeds import Feed
> from blog.models import Post
>
> class LatestPosts(Feed):
> """Returns a Feed object with the 5 latest blog posts"""
> link = "/blog/"
> title = "Latest Blog Posts"
> description = "Latest blog posts from the Paraguayan Geek."
>
> def items(self):
> return Post.objects.order_by('-date')[:5]
>
> apps/blog/urls.py: [shortened]
>
> feeds = {
> 'latest': LatestPosts,
> }
>
> urlpatterns = patterns(
> '',
> (r'^feeds/(?P.*)/$', 'django.contrib.syndication.views.feed',
>{'feed_dict': feeds},)
> )
>
> ---
> OBSERVATION
> ---
>
> I access the feed with http://localhost:8000/blog/feeds/latest/ and it
> works just fine. Displays the latest articles with title and
> description.
>   

That's the subscription URL you have to use.

> ---
> PROBLEM
> ---
>
> Now as mention earlier, when browsing to http://localhost:8000/blog/
> there's no option for subscribing to the feed.
> I've compared a lot of configurations and I cannot see the problem.
>   

Well, isn't that something you'd define yourself? Or what do you mean by
"option for subscribing to the feed"?


-- 
Gonzalo Delgado 

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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.



Need your expertise

2010-01-22 Thread Jigs
Hi,

We are currently deciding if Django Framework will suit our needs. For
starters, our project is a hotspot-like webapp which will deployed to
multiple clients. Settings/Configuration for each client will be in
one central database. Clients will be supplied with their own servers
(Linux with Django Framework if ever) to provide the hotspot
services.

Templates and Python is a must requirement for the project. Reporting
and Monitoring modules will be created in the future. Please advise if
we are going in the right direction if ever we are using Django.

Thanks,
Jigs

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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.



Feed not available - Syndication - Django 1.1.1

2010-01-22 Thread Kenny Meyer
Hi guys,

I'm trying to generate some feeds for my blog with Django's high-level
Syndication Framework. 
My problem is, when browsing to the URL defined in the ``link``
attribute of the ``syndication.Feed`` model, there's no Feed
generated/displayed.

If not clear what I'm trying to say, please read details on the bottom
of this message.

Here's my code:

apps/blog/feeds.py:

from django.contrib.syndication.feeds import Feed
from blog.models import Post

class LatestPosts(Feed):
"""Returns a Feed object with the 5 latest blog posts"""
link = "/blog/"
title = "Latest Blog Posts"
description = "Latest blog posts from the Paraguayan Geek."

def items(self):
return Post.objects.order_by('-date')[:5]

apps/blog/urls.py: [shortened]

feeds = {
'latest': LatestPosts,
}

urlpatterns = patterns(
'',
(r'^feeds/(?P.*)/$', 'django.contrib.syndication.views.feed',
   {'feed_dict': feeds},)
)

---
OBSERVATION
---

I access the feed with http://localhost:8000/blog/feeds/latest/ and it
works just fine. Displays the latest articles with title and
description.

---
PROBLEM
---

Now as mention earlier, when browsing to http://localhost:8000/blog/
there's no option for subscribing to the feed.
I've compared a lot of configurations and I cannot see the problem.

Please help me out on this one, please.
-- 


signature.asc
Description: Digital signature


Re: MySQL-python 1.2.3 and OS X 10.5: 64- or 32-bit?

2010-01-22 Thread Chhouk Voeun
Please don't send to me, I have a lot of mails. I'm bored


On Fri, Jan 22, 2010 at 5:29 PM, Chhouk Voeun wrote:

> Please don't send to me , I'm not member django-users.
>
>
> On Fri, Jan 22, 2010 at 4:41 PM, Dave E  wrote:
>
>> I've been happily using (32-bit) Django and MySQL in development on an
>> existing machine running OS X 10.4 Tiger, and have set up a similar
>> environment in 10.5 Leopard on a new 64-bit MacBook, with a
>> (separately) working MySQL and Python 2.6.4.
>>
>> Now I want them to communicate, easy_install MySQL-python gave ld
>> warnings that the file is not of the required architecture, so I
>> tested my Python 2.4.6 install (from the Mac OS X disc image)...
>>
>> >>> import sys
>> >>> sys.maxint
>> 2147483647
>>
>> ...my Python install is 32-bit and (I think?) won't install MySQL-
>> python for my 64-bit MySQL. There are lots of hacks out there for
>> MySQL-python on OS X (mostly 1.2.2), but - after hours of reading -
>> I'm pretty sure they won't fix this architecture mismatch. I'm posting
>> here because I can't decide whether to:
>>
>>* remove the 64-bit MySQL install (thorough method?) and install
>> the 32-bit MySQL (disc image);
>>* re-install Python in 64-bit mode from the tarball,
>>  --with-universal archs-64-bit and --enable-universalsdk=
>>  as detailed in Python.org's 2.6 news.
>>
>> So my questions for anyone who has encountered this issue are:
>>
>>   1. Is installing 64-bit Python on OS X 10.5 worth bothering with?
>>   2. If so, (naive, lazy question!) how are the two required
>> arguments above combined?
>>   3. If I just skip along in 32-bit (as on my working setup) what am
>> I missing?
>>
>> I'm after a hassle-free install that's easy to reproduce on other
>> machines (possible student use) so I'd really welcome opinions,
>> please!
>>
>> ---
>> PS if you're on stackoverflow and want some rep, here it is:
>>
>> http://stackoverflow.com/questions/1969222/mysql-python-1-2-3-and-os-x-10-5-64-or-32-bit
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To post to this group, send email to django-us...@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.
>>
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: MySQL-python 1.2.3 and OS X 10.5: 64- or 32-bit?

2010-01-22 Thread Chhouk Voeun
Please don't send to me , I'm not member django-users.

On Fri, Jan 22, 2010 at 4:41 PM, Dave E  wrote:

> I've been happily using (32-bit) Django and MySQL in development on an
> existing machine running OS X 10.4 Tiger, and have set up a similar
> environment in 10.5 Leopard on a new 64-bit MacBook, with a
> (separately) working MySQL and Python 2.6.4.
>
> Now I want them to communicate, easy_install MySQL-python gave ld
> warnings that the file is not of the required architecture, so I
> tested my Python 2.4.6 install (from the Mac OS X disc image)...
>
> >>> import sys
> >>> sys.maxint
> 2147483647
>
> ...my Python install is 32-bit and (I think?) won't install MySQL-
> python for my 64-bit MySQL. There are lots of hacks out there for
> MySQL-python on OS X (mostly 1.2.2), but - after hours of reading -
> I'm pretty sure they won't fix this architecture mismatch. I'm posting
> here because I can't decide whether to:
>
>* remove the 64-bit MySQL install (thorough method?) and install
> the 32-bit MySQL (disc image);
>* re-install Python in 64-bit mode from the tarball,
>  --with-universal archs-64-bit and --enable-universalsdk=
>  as detailed in Python.org's 2.6 news.
>
> So my questions for anyone who has encountered this issue are:
>
>   1. Is installing 64-bit Python on OS X 10.5 worth bothering with?
>   2. If so, (naive, lazy question!) how are the two required
> arguments above combined?
>   3. If I just skip along in 32-bit (as on my working setup) what am
> I missing?
>
> I'm after a hassle-free install that's easy to reproduce on other
> machines (possible student use) so I'd really welcome opinions,
> please!
>
> ---
> PS if you're on stackoverflow and want some rep, here it is:
>
> http://stackoverflow.com/questions/1969222/mysql-python-1-2-3-and-os-x-10-5-64-or-32-bit
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@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.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: ChoiceField

2010-01-22 Thread Daniel Roseman
On Jan 21, 11:45 pm, pinco  wrote:
> The code
>
> {% for choice_value, choice_text in
> myform.fields.choicefieldname.choices %}
>                 choice_value: {{ choice_value }}
>                 choice_text: {{ choice_text }}
>                 {% endfor %}
>
> gives the choices text and values associated to each choice, but
> actually do not render the html form, which is what I'm looking for.

Right, now I'm completely confused. You do have a form, and you want
to output the form field, so why don't you just do that?

{{ myform.choicefieldname }}

--
DR.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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.



MySQL-python 1.2.3 and OS X 10.5: 64- or 32-bit?

2010-01-22 Thread Dave E
I've been happily using (32-bit) Django and MySQL in development on an
existing machine running OS X 10.4 Tiger, and have set up a similar
environment in 10.5 Leopard on a new 64-bit MacBook, with a
(separately) working MySQL and Python 2.6.4.

Now I want them to communicate, easy_install MySQL-python gave ld
warnings that the file is not of the required architecture, so I
tested my Python 2.4.6 install (from the Mac OS X disc image)...

>>> import sys
>>> sys.maxint
2147483647

...my Python install is 32-bit and (I think?) won't install MySQL-
python for my 64-bit MySQL. There are lots of hacks out there for
MySQL-python on OS X (mostly 1.2.2), but - after hours of reading -
I'm pretty sure they won't fix this architecture mismatch. I'm posting
here because I can't decide whether to:

* remove the 64-bit MySQL install (thorough method?) and install
the 32-bit MySQL (disc image);
* re-install Python in 64-bit mode from the tarball,
  --with-universal archs-64-bit and --enable-universalsdk=
  as detailed in Python.org's 2.6 news.

So my questions for anyone who has encountered this issue are:

   1. Is installing 64-bit Python on OS X 10.5 worth bothering with?
   2. If so, (naive, lazy question!) how are the two required
arguments above combined?
   3. If I just skip along in 32-bit (as on my working setup) what am
I missing?

I'm after a hassle-free install that's easy to reproduce on other
machines (possible student use) so I'd really welcome opinions,
please!

---
PS if you're on stackoverflow and want some rep, here it is:
http://stackoverflow.com/questions/1969222/mysql-python-1-2-3-and-os-x-10-5-64-or-32-bit

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: Cannot convert float to Decimal. First convert the float to a string Error

2010-01-22 Thread Cummins Group
It workedThanks for the help..

On Fri, Jan 22, 2010 at 2:05 PM, Cummins Group wrote:

> The field in the model is Floatfield...Now what must be the problem...
>
>
> On Fri, Jan 22, 2010 at 12:07 PM, Karen Tracey  wrote:
>
>> On Fri, Jan 22, 2010 at 1:13 AM, grp25  wrote:
>>
>>> got error:
>>> Cannot convert float to Decimal.  First convert the float to a string
>>>
>>> our code is:
>>> usr.ratings=usr.ratings-0.5
>>> usr.save()
>>>
>>> 'usr.ratings' is a float field.
>>>
>>
>> Are you absolutely sure of that? It rather sounds like usr.ratings is a
>> DecimalField, not a FloatField. Perhaps it is a float at the database level
>> but defined as a DecimalField in the model? In which case the fix is to make
>> it a FloatField in the Django model so that the database and Django
>> representations match.
>>
>> 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-us...@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.
>>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: Cannot convert float to Decimal. First convert the float to a string Error

2010-01-22 Thread Cummins Group
The field in the model is Floatfield...Now what must be the problem...

On Fri, Jan 22, 2010 at 12:07 PM, Karen Tracey  wrote:

> On Fri, Jan 22, 2010 at 1:13 AM, grp25  wrote:
>
>> got error:
>> Cannot convert float to Decimal.  First convert the float to a string
>>
>> our code is:
>> usr.ratings=usr.ratings-0.5
>> usr.save()
>>
>> 'usr.ratings' is a float field.
>>
>
> Are you absolutely sure of that? It rather sounds like usr.ratings is a
> DecimalField, not a FloatField. Perhaps it is a float at the database level
> but defined as a DecimalField in the model? In which case the fix is to make
> it a FloatField in the Django model so that the database and Django
> representations match.
>
> 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-us...@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.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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.