Re: How long do objects live?

2010-08-11 Thread Masklinn
On 2010-08-12, at 03:24 , Andy wrote:
> When I create an object in Django, how long does it live?
> 
I would suggest that you read up on Python and its life cycles, as that's what 
the objects you create in django are.

-- 
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 long do objects live?

2010-08-11 Thread Mike Dewhirst

On 12/08/2010 11:24am, Andy wrote:

When I create an object in Django, how long does it live?

When Django finishes responding to a HTTP request, the Python process
lives on to serve the next request. Does that mean all those objects
that were created would continue to hang around?


No. As soon as all references to an object are gone, the object is 
automatically garbage collected.


I think however that the web server might hang on to processes according 
to keep-alive settings.


Mike




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

2010-08-11 Thread Joseph Spiros
Er, I forgot to add an {% endwith %} at the end. You don't HAVE to use
the with tag at all, but it can make things a bit easier.

On 8/11/10 6:18 PM, Joseph Spiros wrote:
> You'll want to loop through the objects and print the appropriate
> property of the objects that consists of just the name. Here's some
> template code that does that, and also separates with commas and "and",
> using a serial comma (aka Oxford comma).
> 
> (This assumes that your Filmmaker model has a "name" property/field)
> 
> {% with film.filmmakers.all as filmmakers %}{% for filmmaker in
> filmmakers %}{% if filmmakers|length > 2 and not forloop.first %}, {%
> endif %}{% if forloop.last and not forloop.first %} and {% endif %}{{
> filmmaker.name }}{% endfor %}
> 
> Hope that helps!
> 
> On 8/11/10 3:53 PM, Wendy wrote:
>> Hello,
>> I'm just getting started, and I'm returning a many to many object in
>> my template:
>>
>> p>{{ film.filmmakers.all }}
>>
>> So it's displaying the list:
>>
>> [, ]
>>
>> Can anyone tell me how to return just a string of the names?
>> I'm still getting acclimated to python syntax.
>>
>> Actually in a perfect world, it would be great to concatenate the
>> names, and add an 'and' b4 the last one, I imagine this is done
>> frequently?
>>
>> Thanks,
>> Wendy
>>
> 

-- 
Joseph Spiros
iThink Software
joseph.spi...@ithinksw.com
+1 (440) 707-6855

-- 
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: Many to many fields to string

2010-08-11 Thread Joseph Spiros
You'll want to loop through the objects and print the appropriate
property of the objects that consists of just the name. Here's some
template code that does that, and also separates with commas and "and",
using a serial comma (aka Oxford comma).

(This assumes that your Filmmaker model has a "name" property/field)

{% with film.filmmakers.all as filmmakers %}{% for filmmaker in
filmmakers %}{% if filmmakers|length > 2 and not forloop.first %}, {%
endif %}{% if forloop.last and not forloop.first %} and {% endif %}{{
filmmaker.name }}{% endfor %}

Hope that helps!

On 8/11/10 3:53 PM, Wendy wrote:
> Hello,
> I'm just getting started, and I'm returning a many to many object in
> my template:
> 
> p>{{ film.filmmakers.all }}
> 
> So it's displaying the list:
> 
> [, ]
> 
> Can anyone tell me how to return just a string of the names?
> I'm still getting acclimated to python syntax.
> 
> Actually in a perfect world, it would be great to concatenate the
> names, and add an 'and' b4 the last one, I imagine this is done
> frequently?
> 
> Thanks,
> Wendy
> 

-- 
Joseph Spiros
iThink Software
joseph.spi...@ithinksw.com
+1 (440) 707-6855

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



How long do objects live?

2010-08-11 Thread Andy
When I create an object in Django, how long does it live?

When Django finishes responding to a HTTP request, the Python process
lives on to serve the next request. Does that mean all those objects
that were created would continue to hang around?

-- 
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: manually add objects to a QuerySet

2010-08-11 Thread John M
I asked a similar question like, I want to sort a QS on a meta field,
can it be done?  The answer worked, and is the same one you're
getting, use a list.

qs1 = model1.objects.filter(...)
qs2 = model2.objects.filter(...)

lqs1 = list(qs1)
lqs2 = list(qs2)

now you have something that is a python list that won't hit the db.

J


On Aug 7, 9:15 pm, chefsmart  wrote:
> I had asked this on stackoverflow, but I guess I couldn't explain
> myself clearly enough. I'll try to ask again here:
>
> Say I have two objects obj1 and obj2 of the same model (MyModel), now
> I would like to add these objects to a new QuerySet. Can I create a
> QuerySet manually like the following
>
> my_qs = QuerySet(model=MyModel)
>
> and then add obj1 and obj2 to this QuerySet like
>
> my_qs.add(obj1)
> my_qs.add(obj2)
>
> Regards,
> CM.

-- 
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: forms tutorials

2010-08-11 Thread Lachlan Musicman
These are the more up to date docs:

http://docs.djangoproject.com/en/dev/topics/forms/

Also, in IRC yesterday Mattmcc (I think) dropped this doozy:

http://sprawsm.com/uni-form/

Once you have mastered forms, uni-form should make the css a lot
easier - note the django plugin at the bottom of the page

cheers
L.

On Thu, Aug 12, 2010 at 05:23, Nick  wrote:
> The best option would be to break off of the tutorials for a bit and
> try to build something out on your own. The documentation for forms is
> quite extensive.
>
> I recommend getting comfortable with inlines and formsets
>
> http://docs.djangoproject.com/en/1.1/topics/forms/
>
>
> On Aug 11, 1:39 pm, Jagdeep Singh Malhi 
> wrote:
>> Hi...
>>
>> I done the 
>> tutorialshttp://docs.djangoproject.com/en/dev/intro/tutorial04/#intro-tutorial04
>> for create the form using database.
>>
>> Now i want to study more tutorials/examples which is helpful for me to
>> create the forms using database.
>> if anybody know about the links/websites/other sources related Django
>> forms.
>> Please post.
>>
>> Thanks
>>
>> Regards,
>> Jagdeep Singh
>
> --
> 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: Translation

2010-08-11 Thread Lachlan Musicman
On Thu, Aug 12, 2010 at 03:07, kostia  wrote:
>
> Great. It somehow got working.
>
> I have the next code in the template:
> {% blocktrans with form_type|capfirst as task %}{{ task }} project{%
> endblocktrans %}
>
> Rosetta shows me an error in the left window:
> %(task)s project
>
> And when I try to compilemessages, terminal also shows an error:
> [r...@baikal projector]# python manage.py compilemessages
> processing file django.po in /home/kostia/Documents/Django/projector/
> locale/ru/LC_MESSAGES
> /home/kostia/Documents/Django/projector/locale/ru/LC_MESSAGES/
> django.po:400: a format specification for argument 'task' doesn't
> exist in 'msgstr'
> msgfmt: found 1 fatal error
> processing file django.po in /home/kostia/Documents/Django/projector/
> locale/uk/LC_MESSAGES
> /home/kostia/Documents/Django/projector/locale/uk/LC_MESSAGES/
> django.po:397: a format specification for argument 'task' doesn't
> exist in 'msgstr'
> msgfmt: found 1 fatal error
>
> Any suggestion?

Yep. When you see something like %( word-in-here )s  within the po
file, you are reaquired to keep the %()s - it means that the
"word-in-here" is a variable type string - which is the "format
specification" referred to in the error.
The best example of why this is useful is the date field. Say you have
the sentence:

The date today is 2010/08/12.

The date field is most likely a variable, not set in stone, hence the
format specification. The position of the date field in any particular
language may be different - it may come first or last or in the
middle. Finally, date field syntax are usually set by the locale
already and need to be adhered to in case the user changes it on a
computer by computer basis. In Australia, we use dd/mm/, the
American's use mm/dd/ etc.

Anyway, put the %()s around the relevant word in the msgstr field, and
you should be set to go. I'd help but my Russian and Ukranian aren't
what they used to be :)
cheers
L.

-- 
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 and Python 2.7

2010-08-11 Thread Steve Holden
Remember, though, that when Django 1.2 was released the current Python
was 2.6. There's not much the Django developers can do to hold up
progress on Python.

MySQL-Python is a known issue, in that the developer advertises the fact
that he has no Windows machines and therefore relies on third parties to
port new releases of the package (and versions for new releases of
Python) to Windows.

If anyone wants to volunteer to do Windows support for MySQL-Python
there's a good chance I may be able to swing a complimentary MSDN
license via the PSF to give access to the necessary software.

regards
 Steve

On 8/11/2010 7:48 PM, Sithembewena Lloyd Dube wrote:
> Cootetom, there's nothing wrong with using Python 2.6 (which I would
> prefer) except that the current 2.x download on the Python site is that
> of 2.7.
> 
> On Thu, Aug 12, 2010 at 12:24 AM, cootetom  > wrote:
> 
> I use Django 1.2 on Windows 7 using MySQL-Python and Python 2.6.
> What's wrong with using Python 2.6 instead of 2.7?
> 
> 
> 
> On Aug 11, 4:13 pm, Sithembewena Lloyd Dube  > wrote:
> > Hi all,
> >
> > Has anybody used Django 1.2.1. on Windows 7 with MySQL-Python? I
> see that
> > MySQL-Python supports up to Python 2.6 and I am wondering if it
> will play
> > nicely with Python 2.7? I need this information for a new project
> at work.
> >
> > With thanks,
> >
> > --
> > Regards,
> > Sithembewena Lloyd Dubehttp://www.lloyddube.com
> 
> 
> --
> You received this message because you are subscribed to the Google
> Groups "Django users" group.
> To post to this group, send email to django-users@googlegroups.com
> .
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
> 
> 
> 
> 
> -- 
> Regards,
> Sithembewena Lloyd Dube
> http://www.lloyddube.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 email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.


-- 
DjangoCon US 2010 September 7-9 http://djangocon.us/

-- 
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 and Python 2.7

2010-08-11 Thread Sithembewena Lloyd Dube
Cootetom, there's nothing wrong with using Python 2.6 (which I would prefer)
except that the current 2.x download on the Python site is that of 2.7.

On Thu, Aug 12, 2010 at 12:24 AM, cootetom  wrote:

> I use Django 1.2 on Windows 7 using MySQL-Python and Python 2.6.
> What's wrong with using Python 2.6 instead of 2.7?
>
>
>
> On Aug 11, 4:13 pm, Sithembewena Lloyd Dube  wrote:
> > Hi all,
> >
> > Has anybody used Django 1.2.1. on Windows 7 with MySQL-Python? I see that
> > MySQL-Python supports up to Python 2.6 and I am wondering if it will play
> > nicely with Python 2.7? I need this information for a new project at
> work.
> >
> > With thanks,
> >
> > --
> > Regards,
> > Sithembewena Lloyd Dubehttp://www.lloyddube.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 email to
> django-users+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>


-- 
Regards,
Sithembewena Lloyd Dube
http://www.lloyddube.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 email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Many to many fields to string

2010-08-11 Thread Carlos Daniel Ruvalcaba Valenzuela
Use a for loop, there is tags to know if you are at the last item of
the list, so to not add the and:

{% for filmmaker in film.filmmakers.all %}
{{ filmmaker.name }} {% if not forloop.last %} and {% endif %}
{% endfor %}

Assuming you are using django 1.2, but you get the idea.

http://docs.djangoproject.com/en/1.2/ref/templates/builtins/#for

Regards,
Carlos Daniel Ruvalcaba Valenzuela

On Wed, Aug 11, 2010 at 12:53 PM, Wendy  wrote:
> Hello,
> I'm just getting started, and I'm returning a many to many object in
> my template:
>
> p>{{ film.filmmakers.all }}
>
> So it's displaying the list:
>
> [, ]
>
> Can anyone tell me how to return just a string of the names?
> I'm still getting acclimated to python syntax.
>
> Actually in a perfect world, it would be great to concatenate the
> names, and add an 'and' b4 the last one, I imagine this is done
> frequently?
>
> Thanks,
> Wendy
>
> --
> 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.



pyfacebook

2010-08-11 Thread Alessandro Ronchi
Is pyfacebook compatible with django 1.2.1? I didn't find nothing, and
it gives me a 403 error I cannot understand:

Premature end of script headers: fb
[Wed Aug 11 16:25:16 2010] [error] [client 66.220.153.249]
(104)Connection reset by peer: ap_content_length_filter:
apr_bucket_read() failed

any hint?

-- 
Alessandro Ronchi
http://www.soasi.com

Hobby & Giochi
http://hobbygiochi.com
http://www.facebook.com/hobbygiochi

-- 
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: Loop over a form's choices (radio button) and render it

2010-08-11 Thread Bill Freeman
Non-trivial.  I would up writing a template filter to do this.  You
have to use undocumented,
I believe, interfaces.  I called my filter checkboxiterator, so usage
looks something like:

  {% for pseudocheckbox in some_multi_select_field|checkboxiterator %}

It iterates over a set of instances of a non-model class having
attributes you need to render
the checkbox (name, a suitably escaped option_label, option_value,
final_attrs, and a boolean
as to whether optionvlaue is in the bound field's values - that is, is
selected).

It uses another private class that has an __init__ and a render, an
instance of which is
passed to bound_field.as_widget() to capture teh name, data (values)
and attrs.  If there's
an 'id' attr, you also have to dumy up an enhanced version for each checkbox.

About 80 lines of code, if I can count the blank lines for prettyness.

Bill

On Wed, Aug 11, 2010 at 5:21 PM, Andreas Pfrengle  wrote:
> Just to push it up again... any ideas?
>
> --
> 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 and Python 2.7

2010-08-11 Thread cootetom
I use Django 1.2 on Windows 7 using MySQL-Python and Python 2.6.
What's wrong with using Python 2.6 instead of 2.7?



On Aug 11, 4:13 pm, Sithembewena Lloyd Dube  wrote:
> Hi all,
>
> Has anybody used Django 1.2.1. on Windows 7 with MySQL-Python? I see that
> MySQL-Python supports up to Python 2.6 and I am wondering if it will play
> nicely with Python 2.7? I need this information for a new project at work.
>
> With thanks,
>
> --
> Regards,
> Sithembewena Lloyd Dubehttp://www.lloyddube.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 email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



easy_thumbnails, rackspace's python-cloudfiles and PIL problem

2010-08-11 Thread Michel Thadeu Sabchuk
Hi guys!

I'm migrating from sorl thumbnails to the good easy_thumbnails [1] for
image dealing. It let me store the thumbnails on a container on
Rackspace Cloudfiles [2] (similar to Amazon S3).

I try it for jpeg images and it worked perfectly: it get's the file
from my container, crop the image with PIL and send the thumbnail to
my container again.

The problem is when I try to resize png or gif images. The PIL module
expects the "tell" and "seek" methods on the file like object passed
to it. This is documented on the PIL's page and on it's source code.

There is no "tell" method on the cloudfiles.storage_object.Object
class (that connects me to my file on my rackspace cloudfiles
container).

Does anyone had used these packages and had a similar problem?

Best regards,

[1] http://github.com/rackspace/python-cloudfiles
[2] http://github.com/SmileyChris/easy-thumbnails/

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



Many to many fields to string

2010-08-11 Thread Wendy
Hello,
I'm just getting started, and I'm returning a many to many object in
my template:

p>{{ film.filmmakers.all }}

So it's displaying the list:

[, ]

Can anyone tell me how to return just a string of the names?
I'm still getting acclimated to python syntax.

Actually in a perfect world, it would be great to concatenate the
names, and add an 'and' b4 the last one, I imagine this is done
frequently?

Thanks,
Wendy

-- 
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: Loop over a form's choices (radio button) and render it

2010-08-11 Thread Andreas Pfrengle
Just to push it up again... any ideas?

-- 
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: dynamic forms and custom methods

2010-08-11 Thread Nick
Are you trying to create a save function that evaluates all the
weights and returns an error if they are more than 1?

On Aug 10, 3:17 pm, lingrlongr  wrote:
> I 'm trying to create a form dynamically.  This works just fine, but
> there's no way for the form to offer any customized validation, by way
> of the clean() method.
>
> def get_dept_weight_form(store):
>     fields = {}
>     s = Store.objects.get(pk=store.id)
>     for d in store.department_set.all():
>         fields['id_%d' % d.id] = forms.DecimalField(
>             label = d.name,
>             initial = d.weight
>         )
>     return type('WeightForm', (forms.BaseForm,), {'base_fields':
> fields})
>
> Basically, this form spits out a label showing the department name and
> the weight for you to enter in a textbox.  The weights for all
> departments should total 1.0.  Should a clean() method handle this?
>
> I already use an overridden version of save() on the store model, but
> that just prints out a warning to stdout.  Also, I have this
> validation for the admin part by overriding the clean method for my
> declared ModelForm.
>
> Perhaps I should just use the functionality I already created in
> models.py and just raise a ValidationError?
>
> Thx

-- 
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: filter users by group

2010-08-11 Thread Nick
You can subclass the User admin and then unregister the default admin
and register your new subclassy admin (subclassy is a word)

in admin.py:

from django.contrib.auth.admin import UserAdmin
from django.contrib.auth.models import User

class MyNewUserAdmin(UserAdmin):
list_filter = UserAdmin.list_filter + ('groups',)

admin.site.unregister(User)
admin.site.register(User, MyNewUserAdmin)


On Aug 11, 9:42 am, Wim Feijen  wrote:
> Hello,
>
> I am banging my brain against the wall but it doesn't help and all I
> get is brain damage. Maybe you can help me find a solution for the
> following problem?
>
> How can I add a filter to the django admin User interface (/admin/auth/
> user/) so I can filter Users by Group?
>
> What I have thought of, is:
> 1. Alter the template templates/admin/auth/user/change_list.html and
> edit it to add a list of existing groups as links.
> 2. Redirect to ?group_id=1. THIS STEP FAILS!
> 3. Write a custom UserAdmin and overwrite the queryset method to show
> only users of a group, thus:
>
> class UserAdmin(admin.ModelAdmin):
>     model = User
>
>     def queryset(self, request):
>         group_id = request.GET.get('group_id', '')
>         if group_id:
>             return Group.objects.get(id=group_id).user_set.all()
>         else:
>             return super(UserAdmin, self).queryset(request)
>
> try:
>     admin.site.unregister(User)
> except admin.sites.Unregistered:
>     pass
> admin.site.register(User, UserAdmin)
>
> The missing link is step 2. How on earth do I get a request.GET
> parameter through django's normal filtering process/ how can I combine
> it. When I try '/admin/auth/user/?group_id=1', django redirects me to
> '/admin/auth/user/?e=1'
>
> Any help and tips will be very much appreciated, thank you!
>
> If someone's has ever done this, I'd really like to know!
>
> Wim

-- 
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: Image and thumbnal solution

2010-08-11 Thread Franklin Einspruch
I still don't get this. Are you supposed to do something like...

image = models.ImageField()
image.height_field = 'height'
image.width_field = 'width'

And make 'height' and 'width' columns in the table? I really wish the
docs had some sample code here...

- Franklin




On Wed, Aug 11, 2010 at 8:27 AM, Aljoša Mohorović
 wrote:
> On Wed, Aug 11, 2010 at 2:26 PM, zero00  wrote:
>> I get it now thanks
>
> no problem, glad i could help.
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-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.
>
>



-- 
Art, writing, journal: http://einspruch.com
Comics: http://themoonfellonme.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 email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: overwrite the save method

2010-08-11 Thread Nick
You override the save in two places, in the form itself or in the
view. Either one would work, you could combine the two as well.

the form save override would look something like

def save(self):
formatform = super(FormFormat, self).save(commit=False)
if formatform.boolean1 and formatform.boolean2:
formatform.myBoolean = True
formformat.save()

in the view:

form = FormFormat(request.POST)
if form.is_valid():
form_save = form.save(commit=False)
if form_save.boolean1 == True and form_save.boolean2 == True:
form_save.myBoolean = True
form_save.save()
On Aug 11, 2:08 pm, Roald de Vries  wrote:
> On Aug 11, 2010, at 7:25 PM, refreegrata wrote:
>
>
>
> > My code
> > --
> > class Format(models.Model):
> >    name = models.CharField(max_length=5, unique=True)
> >    myBoolean = models.BooleanField(default=False)
>
> > class FormFormat(forms.ModelForm):
> >    boolean1 = forms.BooleanField(required=False)
> >    boolean2 = forms.BooleanField(required=False)
>
> >    class Meta:
> >        model = Format
> >        fields = ['name']
>
> > FormsetFormFormat = forms.models.modelformset_factory(Format,
> > max_num=0,form=FormFormat)
> > --
> > The idea is this:
>
> > if boolean1=True and boolean2=True the field myBoolean must to be True
> > if boolean1=True and boolean2=False the field myBoolean must to be
> > False
> > ...
> > My question is, how i can do this?
> > overwriting the save method?
>
> Possible, but I have a feeling there might be a nicer solution. What  
> do you want to happen if boolean1 is false?
>
> > I don't have idea, because boolean1 and boolean2 are form fields not
> > model fields. Can i pass custom parameters to the save method?
>
> Yes, you can.

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



Problem with dumpdata and loaddata in python format

2010-08-11 Thread Info Cascade

Hi --

I'm expecting
python manage.py dumpdata --format=python
... to dump data, but it does not.
I get "Error: Unknown serialization format: python" instead.
Specifying json or xml does work, however.

Same for loaddata.
"Problem installing fixture 'fixtures/bme_auth': python is not a known 
serialization format."


I thought this was a supported format?

What am I missing?

Liam

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



schema support

2010-08-11 Thread John Fabiani
Hi,
I think support for postgres schema's is coming in 1.3 but I wonder is it 
possible to support schema in 1.2.1?  If it can - could someone provide the 
how? or maybe a link.

Thanks in advance,
Johnf

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



stream (large) files from the back-end via Django to the user?

2010-08-11 Thread Markus
Hi,

it was hard to find the right subject. Let me explain what I want to
do.

I write a web application with Django. I have some forms to upload
content and some forms to download content. Sometimes the content is
just a string (than it will be stored in a database) but sometimes the
content is a (large) file. Than the file will be stored to a
distributed file system running in the background.

Uploading the files is not a problems. First Django stores the file to
a local directory of the server and than it get moved to the
distributed file system. Not really nifty but I couldn't find a
solution to stream the data directly to the distributed file system.

But the really hard part is the download. How do I serve this files
back to the user? Sure, I could do the same as I do for upload: First
download the files from the distributed file system to the local file
system and than serve it to the users. But when has the user finished
the download and I can remove the local copy of the file? Just to
mention one open question.

I hope I could describe my problem in an  understandable way.

What would be a good way to serve internal files to a user? Is it
possible to pipe the files directly from the distributed file system
to the user?

Cheers,
Markus

-- 
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: passing file from command line startup

2010-08-11 Thread Roald de Vries

On Aug 11, 2010, at 8:47 PM, Bradley Hintze wrote:

Hi all,

Is there a way that I can startup my script and pass it a file? For  
example:


~$ python myscript.py mytext.txt

and then access mytext.txt in myscript.py?


Option 1: use stdin

~$ python myscript.py < mytext.txt
>>> import sys
>>> file = sys.stdin

Option 2: read command line arguments

>>> import sys
>>> file = open(sys.argv[1])

Cheers, Roald

--
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: forms tutorials

2010-08-11 Thread Nick
The best option would be to break off of the tutorials for a bit and
try to build something out on your own. The documentation for forms is
quite extensive.

I recommend getting comfortable with inlines and formsets

http://docs.djangoproject.com/en/1.1/topics/forms/


On Aug 11, 1:39 pm, Jagdeep Singh Malhi 
wrote:
> Hi...
>
> I done the 
> tutorialshttp://docs.djangoproject.com/en/dev/intro/tutorial04/#intro-tutorial04
> for create the form using database.
>
> Now i want to study more tutorials/examples which is helpful for me to
> create the forms using database.
> if anybody know about the links/websites/other sources related Django
> forms.
> Please post.
>
> Thanks
>
> Regards,
> Jagdeep Singh

-- 
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: Adding request context to standard login/logout views?

2010-08-11 Thread Roald de Vries

On Aug 11, 2010, at 8:59 PM, Streamweaver wrote:

I use the the standard django login and logout views in the usual way

   url(r'^login/$', 'django.contrib.auth.views.login',
{'template_name': 'accounts/login.xhtml'}, "login-account"),
   url(r'^logout/$', 'django.contrib.auth.views.logout',
{'template_name': 'accounts/logout.xhtml'}, "logout-account")

My problem is that I need to add the request context to those
templates as my media URLs require the MEDIA_URL variable.  Is there a
way to add the request context


You mean http://docs.djangoproject.com/en/dev/ref/settings/ 
#std:setting-TEMPLATE_CONTEXT_PROCESSORS?


Cheers, Roald

--
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: Web site Mail Inbox

2010-08-11 Thread kostia
Great, I installed django-messages. They are working fine.

As in docs said I have a content and sidebar blocks. How can I show on
the user profile page a nice Inbox in the sidebar? Docs does not show
any examples.

If you did this before, share the code, please.

Thank you

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-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: Adding request context to standard login/logout views?

2010-08-11 Thread Streamweaver
Argh!!  Please ignore.  This is not the message you're looking for.

context varibles are passed to generic views by default.

I got my errors confused.

On Aug 11, 2:59 pm, Streamweaver  wrote:
> I use the the standard django login and logout views in the usual way
>
>     url(r'^login/$', 'django.contrib.auth.views.login',
> {'template_name': 'accounts/login.xhtml'}, "login-account"),
>     url(r'^logout/$', 'django.contrib.auth.views.logout',
> {'template_name': 'accounts/logout.xhtml'}, "logout-account")
>
> My problem is that I need to add the request context to those
> templates as my media URLs require the MEDIA_URL variable.  Is there a
> way to add the request context

-- 
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: overwrite the save method

2010-08-11 Thread Roald de Vries

On Aug 11, 2010, at 7:25 PM, refreegrata wrote:

My code
--
class Format(models.Model):
   name = models.CharField(max_length=5, unique=True)
   myBoolean = models.BooleanField(default=False)

class FormFormat(forms.ModelForm):
   boolean1 = forms.BooleanField(required=False)
   boolean2 = forms.BooleanField(required=False)

   class Meta:
   model = Format
   fields = ['name']

FormsetFormFormat = forms.models.modelformset_factory(Format,
max_num=0,form=FormFormat)
--
The idea is this:

if boolean1=True and boolean2=True the field myBoolean must to be True
if boolean1=True and boolean2=False the field myBoolean must to be
False
...
My question is, how i can do this?
overwriting the save method?


Possible, but I have a feeling there might be a nicer solution. What  
do you want to happen if boolean1 is false?



I don't have idea, because boolean1 and boolean2 are form fields not
model fields. Can i pass custom parameters to the save method?


Yes, you can.

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



Adding request context to standard login/logout views?

2010-08-11 Thread Streamweaver
I use the the standard django login and logout views in the usual way

url(r'^login/$', 'django.contrib.auth.views.login',
{'template_name': 'accounts/login.xhtml'}, "login-account"),
url(r'^logout/$', 'django.contrib.auth.views.logout',
{'template_name': 'accounts/logout.xhtml'}, "logout-account")

My problem is that I need to add the request context to those
templates as my media URLs require the MEDIA_URL variable.  Is there a
way to add the request context

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



forms tutorials

2010-08-11 Thread Jagdeep Singh Malhi
Hi...

I done the tutorials
http://docs.djangoproject.com/en/dev/intro/tutorial04/#intro-tutorial04
for create the form using database.

Now i want to study more tutorials/examples which is helpful for me to
create the forms using database.
if anybody know about the links/websites/other sources related Django
forms.
Please post.

Thanks

Regards,
Jagdeep Singh

-- 
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: overwrite the save method

2010-08-11 Thread bagheera

--
class Format(models.Model):
name = models.CharField(max_length=5, unique=True)
myBoolean = models.BooleanField(default=False)

class FormFormat(forms.ModelForm):
boolean1 = forms.BooleanField(required=False)
boolean2 = forms.BooleanField(required=False)

class Meta:
model = Format
fields = ['name']

FormsetFormFormat = forms.models.modelformset_factory(Format,
max_num=0,form=FormFormat)
--
The idea is this:

if boolean1=True and boolean2=True the field myBoolean must to be True
if boolean1=True and boolean2=False the field myBoolean must to be
False
...
My question is, how i can do this?
overwriting the save method?

Well, i'm new one myself, but if i understand docs correctly, You can  
create form from model, then add b1 and b2 fields, and include only them  
for display by using 'fields' meta option.

Later, when form is valid, check b1 and b2, and set myBoolean

http://docs.djangoproject.com/en/1.2/topics/forms/modelforms/#overriding-the-default-field-types-or-widgets


--
Linux user

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



overwrite the save method

2010-08-11 Thread refreegrata
Hello list, i have a newbie question

My code
--
class Format(models.Model):
name = models.CharField(max_length=5, unique=True)
myBoolean = models.BooleanField(default=False)

class FormFormat(forms.ModelForm):
boolean1 = forms.BooleanField(required=False)
boolean2 = forms.BooleanField(required=False)

class Meta:
model = Format
fields = ['name']

FormsetFormFormat = forms.models.modelformset_factory(Format,
max_num=0,form=FormFormat)
--
The idea is this:

if boolean1=True and boolean2=True the field myBoolean must to be True
if boolean1=True and boolean2=False the field myBoolean must to be
False
...
My question is, how i can do this?
overwriting the save method?

I don't have idea, because boolean1 and boolean2 are form fields not
model fields. Can i pass custom parameters to the save method?

Thanks for read

P.D.:sorry for my poor english

-- 
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: [Offtopic] Freelance django dev in Spain

2010-08-11 Thread Subhranath Chunder
I'm a Django developer working on Django since December 2009. If you are
looking for freelance developer on Django, then I might be interested.

Thanks,
Subhranath Chunder.

On Wed, Aug 11, 2010 at 10:07 PM, Matias  wrote:

> Hi,
>
> We are looking for a freelance django dev located here in Spain,
> preferrably in Madrid.
>
> Please, contact me at matiassu...@gmail.com if you want to know more about
> this opportunity.
>
> Sorry for the offtopic.
>
>
>
> --
> 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: Translation

2010-08-11 Thread kostia
Great. It somehow got working.

I have the next code in the template:
{% blocktrans with form_type|capfirst as task %}{{ task }} project{%
endblocktrans %}

Rosetta shows me an error in the left window:
%(task)s project

And when I try to compilemessages, terminal also shows an error:
[r...@baikal projector]# python manage.py compilemessages
processing file django.po in /home/kostia/Documents/Django/projector/
locale/ru/LC_MESSAGES
/home/kostia/Documents/Django/projector/locale/ru/LC_MESSAGES/
django.po:400: a format specification for argument 'task' doesn't
exist in 'msgstr'
msgfmt: found 1 fatal error
processing file django.po in /home/kostia/Documents/Django/projector/
locale/uk/LC_MESSAGES
/home/kostia/Documents/Django/projector/locale/uk/LC_MESSAGES/
django.po:397: a format specification for argument 'task' doesn't
exist in 'msgstr'
msgfmt: found 1 fatal error

Any suggestion?

Thanks God, almost translation is working now.

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



[Offtopic] Freelance django dev in Spain

2010-08-11 Thread Matias

Hi,

We are looking for a freelance django dev located here in Spain, 
preferrably in Madrid.


Please, contact me at matiassu...@gmail.com if you want to know more 
about this opportunity.


Sorry for the offtopic.



--
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: add attributes to a field without widgets

2010-08-11 Thread refreegrata
Opps, I forgot to mention that I work with "Django 1.2.1". Apparently
is a Django bug.
Other persons has the same question "http://groups.google.com/group/
django-users/browse_thread/thread/c4899b0806e67ee7/d938f33a5f100af8?
show_docid=d938f33a5f100af8=1"

I will try to implement the solution you mention.

thanks for answer.

-- 
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 and Python 2.7

2010-08-11 Thread Sithembewena Lloyd Dube
Hi all,

Has anybody used Django 1.2.1. on Windows 7 with MySQL-Python? I see that
MySQL-Python supports up to Python 2.6 and I am wondering if it will play
nicely with Python 2.7? I need this information for a new project at work.

With thanks,

-- 
Regards,
Sithembewena Lloyd Dube
http://www.lloyddube.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 email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: I need a middleware to add language to urls in my templates

2010-08-11 Thread Nuno Maltez
I'm not sure if this provides exactly what you need, and I've never
tested it with satchmo, but I've been using
http://code.google.com/p/django-localeurl/ with success to proved
different urls according to the language transparently.

Maybe this helps,
Nuno

On Wed, Aug 11, 2010 at 3:46 PM, Alessandro Ronchi
 wrote:
> I have a website that uses a get variable to set the django language. After
> that, a user can navigate the site in the choosen language.
> Web spiders, instead, reads all the web pages In standard language, because
> links doesn't have ?lang=en
> So, as a result, all my translated pages aren't on google.
> I know I should have different urls, but I cannot in this project because
> I'm using satchmo, a django e-commerce system, and I can't edit urls to work
> this way.
> So I thought I can create a middleware that incercepts all my  href="http://mydomain;> urls in templates and adds to href a lang=en,
> lang=fr,
> if the request.language is respectively en, fr.
> So all my links should be ok.
> Is it possible?
>
> --
> Alessandro Ronchi
> http://www.soasi.com
>
> Hobby & Giochi
> http://hobbygiochi.com
> http://www.facebook.com/hobbygiochi
>
> --
> 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: add attributes to a field without widgets

2010-08-11 Thread Roald de Vries

Hi refreegrata,

On Aug 11, 2010, at 3:31 PM, refreegrata wrote:

Hello list. I'm a newbie in django and now i am working with
"modelformset_factory".

I have something like this
--
class MyForm(forms.ModelForm):
   myField = forms.BooleanField()

   class Meta:
   model = Format
   fields = ['name']
   widgets = {'name' : forms.TextInput(attrs={ something }),}

FormsetMyForm= forms.models.modelformset_factory(Format, max_num=0,
form=MyForm)
--
With that code, django throw an error "Exception Value: () got
an unexpected keyword argument
'widget'", but i solve the problem deleting the "widget" declaration.

Now my question is: Can i add attributes in other side with Django ? a
Template for example, something like "{% field class="myclass" %}".


Your Django version is probably too old for Meta-widgets. What I do in  
this case is setting the widget attrs on form object creation:


def __init__(self, *args, **kwargs):
super(MyForm, self).__init__(*args, **kwargs)
# If you want an other widget:
# self.fields['name'].widget =  
forms.TextInput(attrs={something...})

self.fields['name'].widget.attrs['something'] = ...


Cheers, Roald



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



I need a middleware to add language to urls in my templates

2010-08-11 Thread Alessandro Ronchi
I have a website that uses a get variable to set the django language. After
that, a user can navigate the site in the choosen language.
Web spiders, instead, reads all the web pages In standard language, because
links doesn't have ?lang=en

So, as a result, all my translated pages aren't on google.

I know I should have different urls, but I cannot in this project because
I'm using satchmo, a django e-commerce system, and I can't edit urls to work
this way.

So I thought I can create a middleware that incercepts all my http://mydomain;> urls in templates and adds to href a lang=en, lang=fr,
if the request.language is respectively en, fr.
So all my links should be ok.

Is it possible?

-- 
Alessandro Ronchi
http://www.soasi.com

Hobby & Giochi
http://hobbygiochi.com
http://www.facebook.com/hobbygiochi

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



filter users by group

2010-08-11 Thread Wim Feijen
Hello,

I am banging my brain against the wall but it doesn't help and all I
get is brain damage. Maybe you can help me find a solution for the
following problem?

How can I add a filter to the django admin User interface (/admin/auth/
user/) so I can filter Users by Group?

What I have thought of, is:
1. Alter the template templates/admin/auth/user/change_list.html and
edit it to add a list of existing groups as links.
2. Redirect to ?group_id=1. THIS STEP FAILS!
3. Write a custom UserAdmin and overwrite the queryset method to show
only users of a group, thus:

class UserAdmin(admin.ModelAdmin):
model = User

def queryset(self, request):
group_id = request.GET.get('group_id', '')
if group_id:
return Group.objects.get(id=group_id).user_set.all()
else:
return super(UserAdmin, self).queryset(request)

try:
admin.site.unregister(User)
except admin.sites.Unregistered:
pass
admin.site.register(User, UserAdmin)


The missing link is step 2. How on earth do I get a request.GET
parameter through django's normal filtering process/ how can I combine
it. When I try '/admin/auth/user/?group_id=1', django redirects me to
'/admin/auth/user/?e=1'

Any help and tips will be very much appreciated, thank you!

If someone's has ever done this, I'd really like to know!

Wim

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



convert textinput in label or text for a modelform and modelformset_factory

2010-08-11 Thread refreegrata
with a model like this:
--
class Format(models.Model):
name1 = models.CharField(max_length=5)
name2 = models.CharField(max_length=5)
--

and a modelform like this:
-
MyForm(forms.ModelForm)
   class Meta:
model = Format
fields = ['nombre']
-

this code will generate 2 "input text", the "input text" name1 and the
"input text" name2. But for an unique modelform from the model
"format" i want an "input text"(name2)  and a "label" or
"text"(name1), because the field "name1" can only be edited in the
first time.  In any other occasion the field "name1" most be displayed
like an info about de field "name2"

I do not know if you understand my question. basically is ¿ how i can
supply info about a row of mi table for a specific form of my formset?


example
normaly my html page is
---
formset

  


  

.
---
but i want something like this
---
formset

  "Alex" 


  "John"

.
---

Thanks for read

P.D.: sorry for mi poor english

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



add attributes to a field without widgets

2010-08-11 Thread refreegrata
Hello list. I'm a newbie in django and now i am working with
"modelformset_factory".

I have something like this
--
class MyForm(forms.ModelForm):
myField = forms.BooleanField()

class Meta:
model = Format
fields = ['name']
widgets = {'name' : forms.TextInput(attrs={ something }),}

FormsetMyForm= forms.models.modelformset_factory(Format, max_num=0,
form=MyForm)
--
With that code, django throw an error "Exception Value: () got
an unexpected keyword argument
'widget'", but i solve the problem deleting the "widget" declaration.

Now my question is: Can i add attributes in other side with Django ? a
Template for example, something like "{% field class="myclass" %}".

thanks for read.

P.D.: sorry for my poor english

-- 
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: problem with a formset from model

2010-08-11 Thread refreegrata
ok, i understand.

On 11 ago, 08:00, Nuno Maltez  wrote:
> This happens to me as well (also with 1.2.1). Seems like a bug with
> _queryset vs queryset on BaseModelFormSet.
>
> Maybe you could submit a ticket tohttp://code.djangoproject.com/query
>
> Nuno
>
> On Tue, Aug 10, 2010 at 9:21 PM, refreegrata  wrote:
> > Hello list. I have a problem. I'm a newbie in Django using his first
> > formset.
>
> > I have this:
> > 
> > class BaseFormFormato_habilitar(BaseModelFormSet):
> >    def __init__(self, *args, **kwargs):
> >        super(BaseFormFormato_habilitar, self).__init__(*args,
> > **kwargs)
> >        self.queryset = Formato.objects.filter(actividad=True)
>
> > FormFormato_habilitar = modelformset_factory(Formato, max_num=0,
> > formset=BaseFormFormato_habilitar)
> > 
>
> > I want a formset with forms filtered for
> > "Formato.objects.filter(actividad=True)", however, the formset always
> > returns all the rows in the table. My alternatively subclass
> > "BaseFormFormato_habilitar" don't works. What am I doing wrong?
> > the problem is solved if i do "FormFormato_habilitar(queryset =
> > Formato.objects.filter(actividad=True))" in a view, but i prefer solve
> > the problem with a subclass in the "forms.py".
>
> > thanks for read, and sorry for my poor english
>
> > P.D.: I use Django 1.2.1
>
> > --
> > You received this message because you are subscribed to the Google Groups 
> > "Django users" group.
> > To post to this group, send email to django-us...@googlegroups.com.
> > To unsubscribe from this group, send email to 
> > django-users+unsubscr...@googlegroups.com.
> > For more options, visit this group 
> > athttp://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: Image and thumbnal solution

2010-08-11 Thread Aljoša Mohorović
On Wed, Aug 11, 2010 at 2:26 PM, zero00  wrote:
> I get it now thanks

no problem, glad i could help.

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

2010-08-11 Thread zero00
I get it now 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.



Re: Image and thumbnal solution

2010-08-11 Thread Aljoša Mohorović
On Wed, Aug 11, 2010 at 2:02 PM, zero00  wrote:
> Im testing various things right now and i narrow the problem to this:
>
>  height_field=150, width_field=150
>
> thumb = models.ImageField(upload_to="images/services/thumbs",
> height_field=150, width_field=150)
>
> those parameters are the thing thats breaking up the code

width_field/height_field should point to another field in model, not
width/height of image.
check for more details:
http://docs.djangoproject.com/en/1.2/ref/models/fields/#django.db.models.ImageField

Aljosa Mohorovic

-- 
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: Image and thumbnal solution

2010-08-11 Thread zero00
Im testing various things right now and i narrow the problem to this:

 height_field=150, width_field=150

thumb = models.ImageField(upload_to="images/services/thumbs",
height_field=150, width_field=150)

those parameters are the thing thats breaking up the code

-- 
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: problem with a formset from model

2010-08-11 Thread Nuno Maltez
This happens to me as well (also with 1.2.1). Seems like a bug with
_queryset vs queryset on BaseModelFormSet.

Maybe you could submit a ticket to http://code.djangoproject.com/query

Nuno

On Tue, Aug 10, 2010 at 9:21 PM, refreegrata  wrote:
> Hello list. I have a problem. I'm a newbie in Django using his first
> formset.
>
> I have this:
> 
> class BaseFormFormato_habilitar(BaseModelFormSet):
>    def __init__(self, *args, **kwargs):
>        super(BaseFormFormato_habilitar, self).__init__(*args,
> **kwargs)
>        self.queryset = Formato.objects.filter(actividad=True)
>
> FormFormato_habilitar = modelformset_factory(Formato, max_num=0,
> formset=BaseFormFormato_habilitar)
> 
>
> I want a formset with forms filtered for
> "Formato.objects.filter(actividad=True)", however, the formset always
> returns all the rows in the table. My alternatively subclass
> "BaseFormFormato_habilitar" don't works. What am I doing wrong?
> the problem is solved if i do "FormFormato_habilitar(queryset =
> Formato.objects.filter(actividad=True))" in a view, but i prefer solve
> the problem with a subclass in the "forms.py".
>
> thanks for read, and sorry for my poor english
>
> P.D.: I use Django 1.2.1
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-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: Image and thumbnal solution

2010-08-11 Thread zero00
that just a typo in the post. the code is fine.

i also know the plugins you said but i want to learn how to build my
own 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: Reporting Library??

2010-08-11 Thread Carlos Daniel Ruvalcaba Valenzuela
There is also trml2pdf [1] which parses a subset of RML (XML format
used in Reportlab Pro) and renders it via reportlab, is relatively
easy to generate the format and has most of the features you want.

There is also template2pdf [2] which uses trml2pdf and integrates it
with django (so you can use templates to generate the report), it is a
nice addon which I'm currently using for a project, however, it is
very new and the documentation is scarce at best, I had to patch it
myself to fix some annoyances [3], but I can recommend this module.

Regards,
Carlos Daniel Ruvalcaba Valenzuela

[1]: http://github.com/roadhead/trml2pdf
[2]: http://code.google.com/p/template2pdf/
[3]: http://github.com/clsdaniel/template2pdf

On Wed, Aug 11, 2010 at 4:25 AM, koenb  wrote:
> On 11 aug, 03:15, ydjango  wrote:
>> I need a reporting library for web based (HTML) reporting with support
>> for standard features
>> 1) header
>> 2) footer
>> 3) pagination
>> 4) Totals/summary
>>
>> Reportlab is too low level for my needs and their pro version license
>> does not work for me.
>>
>> Is there any other good python based reporting library.
>>
>> My only option at this time is JasperReports which is java based which
>> would be an overkill.
>
> If you mean creating pdf documents, you may check out pisa [1], which
> allows you to use html/css to define your reports. It uses reportlab
> to generate them.
>
> Koen
>
> [1] : http://www.xhtml2pdf.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 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: Image and thumbnal solution

2010-08-11 Thread Aljoša Mohorović
> image = models.ImageModel(upload_to"image_path")

is this copy/paste error or did you forget "=" for upload_to?

Aljosa Mohorovic

-- 
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: Image and thumbnal solution

2010-08-11 Thread zero00
Im getting this error:

TypeError at /admin/services/service/add/

getattr(): attribute name must be string

Request Method: POST
Request URL:http://localhost:8000/admin/services/service/add/
Django Version: 1.2.1
Exception Type: TypeError
Exception Value:

getattr(): attribute name must be string

Exception Location: /Library/Python/2.6/site-packages/django/db/
models/fields/files.py in update_dimension_fields, line 372
Python Executable:  /usr/bin/python
Python Version: 2.6.1

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

2010-08-11 Thread koenb
On 11 aug, 03:15, ydjango  wrote:
> I need a reporting library for web based (HTML) reporting with support
> for standard features
> 1) header
> 2) footer
> 3) pagination
> 4) Totals/summary
>
> Reportlab is too low level for my needs and their pro version license
> does not work for me.
>
> Is there any other good python based reporting library.
>
> My only option at this time is JasperReports which is java based which
> would be an overkill.

If you mean creating pdf documents, you may check out pisa [1], which
allows you to use html/css to define your reports. It uses reportlab
to generate them.

Koen

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



Re: Django images, can't load a simple image into html page when I using django!

2010-08-11 Thread Aljoša Mohorović
On Wed, Aug 11, 2010 at 1:14 PM, pj-linden  wrote:
> I have yust started with a django project and have the default settup,
> I have followed the django tutorials and now I am trying to load an
> image into the html page that i have created but for some reason the
> image will not show!
> when i using chrome as the reader of the page I can read in the
> javascript-konsol:
>
> "Resource interpreted as image but transferred with MIME type text/
> html."

did you setup serving of static files for development?
http://docs.djangoproject.com/en/1.2/howto/static-files/#howto-static-files

could you provide more details about image you are trying to display,
where it's located?

Aljosa Mohorovic

-- 
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: 'module' object has no attribute 'instancemethod' error

2010-08-11 Thread Reinout van Rees

On 08/10/2010 09:53 PM, Wim Feijen wrote:

Exception Type: ViewDoesNotExist at /
Exception Value: Tried book in module book.address.views. Error was:
'module' object has no attribute 'instancemethod'


It *looks* like you're using 'instancemethod' in that views.py, but that 
it isn't available in views.py.  Perhaps a missing import?



Tip: "easy_install pyflakes" and call "pyflakes views.py", it'll report 
on missing (or extraneous) imports or variables.


Reinout

--
Reinout van Rees - rein...@vanrees.org - http://reinout.vanrees.org
Programmer at http://www.nelen-schuurmans.nl
"Military engineers build missiles. Civil engineers build targets"

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



Django images, can't load a simple image into html page when I using django!

2010-08-11 Thread pj-linden
Hi!

I have yust started with a django project and have the default settup,
I have followed the django tutorials and now I am trying to load an
image into the html page that i have created but for some reason the
image will not show!
when i using chrome as the reader of the page I can read in the
javascript-konsol:

"Resource interpreted as image but transferred with MIME type text/
html."

what is wrong please help mee!!

//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.



Re: Image and thumbnal solution

2010-08-11 Thread Aljoša Mohorović
On Wed, Aug 11, 2010 at 1:00 PM, zero00  wrote:
> I tried the most simple way:
>
> class Model(models.Model):
>   thumbnail = models.ImageModel(upload_to="thumb_path" height=100,
> width=100)
>   image = models.ImageModel(upload_to"image_path")
>
> but apparently the default save function is not equip to handle
> multiple file uploads.

this shouldn't be a problem, what kind of error do you get?
also, try looking at http://code.google.com/p/django-photologue/  or
http://bitbucket.org/jdriscoll/django-imagekit/

Aljosa Mohorovic

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



Image and thumbnal solution

2010-08-11 Thread zero00
I been trying to do a very simple image/thumbnail solution but I seem
to fail at every try.

I tried the most simple way:

class Model(models.Model):
   thumbnail = models.ImageModel(upload_to="thumb_path" height=100,
width=100)
   image = models.ImageModel(upload_to"image_path")

but apparently the default save function is not equip to handle
multiple file uploads.

I am using the admin interface for all the data uploading to the
website.

Thanks for the help.

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



autoincrementation of default value in admin form

2010-08-11 Thread bagheera
I have PositiveIntegerField in my model, that represents unique, new  
number of newly added element (it's newspaper no.).  It must be editable  
in admin form.
Now i would to assign a default value to the next available integer, so  
person, who will be adding new element, have that field autopopulated.


What is best way to do that?
Can i  assign callable function to 'default ' value, that will query for  
highest used integer?


Mind that it needs to be editable, because first used value is unknown,  
and some values might be skipped.


--
Linux user

--
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: Problem with cache.

2010-08-11 Thread Aljoša Mohorović
On Wed, Aug 11, 2010 at 12:27 PM, Felipe  wrote:
> The number 487.000 for example, that would stay the same value for all
> the time is changing with a certain frequency when django consult it's
> cache in /var/tmp/djangocache and the value showed is 287.000.
>
> The cache is generating strange values that I don't know where they
> come from.

can you post code where you use cache?

Aljosa

-- 
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: Problem with cache.

2010-08-11 Thread Felipe
In a view.

I know that the cache is updated automatically, but the problem is
that the cache is generating numbers that does not exists, and when
the page is consulting the cache to get the values, it show a value
that does not exists in really if you look into the database. It's
really strange.

The number 487.000 for example, that would stay the same value for all
the time is changing with a certain frequency when django consult it's
cache in /var/tmp/djangocache and the value showed is 287.000.

The cache is generating strange values that I don't know where they
come from.

On 10 ago, 14:25, Aljoša Mohorović  wrote:
> On Tue, Aug 10, 2010 at 7:17 PM, Felipe  wrote:
> > So,
>
> > I'm using a filesystem caching and I'm using cache.get and cache.set
> > to set and get the cache.
>
> > But sometimes django shows a different value of the stored value in
> > the database.
>
> cache is not updated automatically, if value in database has changed
> you need to update cache.
> where are you caching (cache.set) this value, in a view or after
> Model.save() is called?
> post part of code where you are using cache.get/set.
>
> Aljosa

-- 
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: Translation

2010-08-11 Thread Kenneth Gonsalves
On Tue, 2010-08-10 at 11:11 -0700, kostia wrote:
> I guess some guru can look at the code above and find an error. If I
> will be so lucky) 

I cannot see a locale folder in your site - how do you expect
translation to work without that?
-- 
regards
Kenneth Gonsalves

-- 
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: do QuerySet joins still suck?

2010-08-11 Thread akaariai

On Aug 11, 9:44 am, Sam Walters  wrote:
> I dont think they do.
>
> The only time i use raw sql + joins is for performance... eg:
>
> When you have a model and for each instance of that model it has a
> reverse foreignkey relationship where you would have to call:
> _set.all()
> in a for loop thus making heaps of sql queries.
>
> There are 3rd party addons for 
> that:http://code.google.com/p/django-selectreverse/
> Does a good job of avoiding the n+1 problem for most situations.

If there are more than one related object in the related set, this is
better approach to fetching the related objects than joins. Even more
so if you are fetching multiple related sets. But if you are fetching
just one related object from the related set (for example translation
in finnish from the translations_set), then a join (or left join)
would be better. There is currently no way I know of to do left joins
with additional filters in the join clause. In my opinion this is one
of the two ORM features really needed. The other is composite primary
keys and foreign keys.

- Anssi

>
> Hope this helps
>
> cheers
>
> sam.
>
> On Wed, Aug 11, 2010 at 4:36 PM, Daniel Roseman  wrote:
> > On Aug 11, 2:28 am, Phlip  wrote:
> >> >  orders = Order.objects.filter(
> >> >    pk=42,
> >> >    order_items__product='whiteboards'
> >> >    )
>
> >> > Is this not what you want?
>
> >> We made a feeb attempt at that and gave up. Thanks! I will try it next.
>
> >> The next question, if it works, will be how to values_list() a field
> >> from a child record; it might follow that notation.
>
> >> Could I trouble you for its home page? Googling for [django queryset
> >> join] gives zillions of newbs trying simple queries...
>
> >http://docs.djangoproject.com/en/1.2/topics/db/queries/#lookups-that-...
>
> > --
> > 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 
> > athttp://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: Translation

2010-08-11 Thread Kenneth Gonsalves
On Tue, 2010-08-10 at 10:27 -0700, kostia wrote:
> Of couse I included a {% load i18n %} tag and then used {% trans %}
> tags in each file.
> 
> Still no solution 

how about compilemessages and makemessages? did you do that?
-- 
regards
Kenneth Gonsalves

-- 
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: Translation

2010-08-11 Thread Kenneth Gonsalves
On Tue, 2010-08-10 at 09:43 -0700, kostia wrote:
> Docs and djangobook useless in question of translation. Any other
> guide to read is available? 

they are not useless - they are very comprehensive. That said, the i18n
page and l10n page have been split. You need to read both the i18n page
and the l10n page.
-- 
regards
Kenneth Gonsalves

-- 
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: Translation

2010-08-11 Thread Lachlan Musicman
On Wed, Aug 11, 2010 at 02:43, kostia  wrote:
> Docs and djangobook useless in question of translation. Any other
> guide to read is available?

I would recommend you use Firefox, go to Edit->Preferences->Content,
choose the language of choice at the bottom.

You can't just translate the site and expect it to "jump out" at you -
you actually have to make some sort of locale change on your computer
as well. This Firefox method is one way to do it.

Note that the pages cootetom sent you to imply this, but it's not
explicit, nor is sending you to those pages and expecting you to
extrapolate that information very helpful in this case.

Cheers
L.

-- 
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: do QuerySet joins still suck?

2010-08-11 Thread Sam Walters
I dont think they do.

The only time i use raw sql + joins is for performance... eg:

When you have a model and for each instance of that model it has a
reverse foreignkey relationship where you would have to call:
_set.all()
in a for loop thus making heaps of sql queries.

There are 3rd party addons for that:
http://code.google.com/p/django-selectreverse/
Does a good job of avoiding the n+1 problem for most situations.

Hope this helps

cheers

sam.




On Wed, Aug 11, 2010 at 4:36 PM, Daniel Roseman  wrote:
> On Aug 11, 2:28 am, Phlip  wrote:
>> >  orders = Order.objects.filter(
>> >    pk=42,
>> >    order_items__product='whiteboards'
>> >    )
>>
>> > Is this not what you want?
>>
>> We made a feeb attempt at that and gave up. Thanks! I will try it next.
>>
>> The next question, if it works, will be how to values_list() a field
>> from a child record; it might follow that notation.
>>
>> Could I trouble you for its home page? Googling for [django queryset
>> join] gives zillions of newbs trying simple queries...
>
> http://docs.djangoproject.com/en/1.2/topics/db/queries/#lookups-that-span-relationships
>
> --
> 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.
>
>

-- 
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: do QuerySet joins still suck?

2010-08-11 Thread Daniel Roseman
On Aug 11, 2:28 am, Phlip  wrote:
> >  orders = Order.objects.filter(
> >    pk=42,
> >    order_items__product='whiteboards'
> >    )
>
> > Is this not what you want?
>
> We made a feeb attempt at that and gave up. Thanks! I will try it next.
>
> The next question, if it works, will be how to values_list() a field
> from a child record; it might follow that notation.
>
> Could I trouble you for its home page? Googling for [django queryset
> join] gives zillions of newbs trying simple queries...

http://docs.djangoproject.com/en/1.2/topics/db/queries/#lookups-that-span-relationships

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