Re: newform-admin: custom validation (multiple fields)

2008-11-24 Thread Alessandro Ronchi
2008/5/1 [EMAIL PROTECTED] <[EMAIL PROTECTED]>:
>
> Thanks Felix. I did use the Form.clean() for my validation accross
> multiple fields. There is an open ticket for the non_field_errors()
> not being called withing the change_form.html template.
> http://code.djangoproject.com/ticket/6809

I need to validate a form in my admin to make some fields sum exactly
as another field (the total). does anyone have a snippet or an
example?

I want to do that:

class SchedaBilancioGenere(models.Model):
n_occupati = models.PositiveIntegerField(blank=True, null=True)
n_occupati_donne = models.PositiveIntegerField(blank=True, null=True)
n_occupati_uomini = models.PositiveIntegerField(blank=True, null=True)

and
n_occupati = n_occupati_donne + n_occupati_uomini

is it possible ?

-- 
Alessandro Ronchi
Skype: aronchi
http://www.alessandroronchi.net

SOASI Soc.Coop. - www.soasi.com
Sviluppo Software e Sistemi Open Source
Sede: Via Poggiali 2/bis, 47100 Forlì (FC)
Tel.: +39 0543 798985 - Fax: +39 0543 579928

Rispetta l'ambiente: se non ti è necessario, non stampare questa mail

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



multi field validation

2008-11-25 Thread Alessandro Ronchi
It's not possible to validate a model in admin checking multiple forms
conditions?

is there any example or code snippet ?

-- 
Alessandro Ronchi
Skype: aronchi
http://www.alessandroronchi.net

SOASI Soc.Coop. - www.soasi.com
Sviluppo Software e Sistemi Open Source
Sede: Via Poggiali 2/bis, 47100 Forlì (FC)
Tel.: +39 0543 798985 - Fax: +39 0543 579928

Rispetta l'ambiente: se non ti è necessario, non stampare questa mail

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



Re: multi field validation

2008-11-25 Thread Alessandro Ronchi
2008/11/25 Jeff FW <[EMAIL PROTECTED]>:
>
> Alessandro,
>
> I'm not exactly sure what you're asking, but I think you want to know
> how to check multiple fields (possibly against each other) when
> submitting a form in the admin.  Let me know if I'm off-base here.
>
> Take a look at:
> http://docs.djangoproject.com/en/dev/ref/contrib/admin/#adding-custom-validation-to-the-admin
>
> You can do multi-field validation by adding a clean() method that will
> run after every clean_FIELDNAME() method, and can do any checking you
> need, and raise a ValidationError if it fails.

It's perfect.
I've used that and this:
http://www.pointy-stick.com/blog/2008/10/15/django-tip-poor-mans-model-validation/

to combine the model and form validation. So I can do all type of
multi field validations.

it should be simpler if someday will be added the possibility to
refers to fields directly (self.fieldname), instead of
self.cleaned_data.get(fieldname)
but it's near to perfection, so thanks!



-- 
Alessandro Ronchi
Skype: aronchi
http://www.alessandroronchi.net

SOASI Soc.Coop. - www.soasi.com
Sviluppo Software e Sistemi Open Source
Sede: Via Poggiali 2/bis, 47100 Forlì (FC)
Tel.: +39 0543 798985 - Fax: +39 0543 579928

Rispetta l'ambiente: se non ti è necessario, non stampare questa mail

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



filter field choices after selecting another field with javascript in django admin

2008-11-25 Thread Alessandro Ronchi
It should be very useful to filter a select field in django admin when
selecting another field.

Somethin like:
fieldA = foreignKey(Country)
fieldB = foreignKey(State)

when user selects fieldA it should be shown only its states and not
all countries' states.

Is it possible? Someone wrote some similar tasks or snippets?


-- 
Alessandro Ronchi
Skype: aronchi
http://www.alessandroronchi.net

SOASI Soc.Coop. - www.soasi.com
Sviluppo Software e Sistemi Open Source
Sede: Via Poggiali 2/bis, 47100 Forlì (FC)
Tel.: +39 0543 798985 - Fax: +39 0543 579928

Rispetta l'ambiente: se non ti è necessario, non stampare questa mail

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



django i18n for google

2008-12-16 Thread Alessandro Ronchi
When google spiders our i18n translated django websites, does it try
and indicize all languages? is it possible to force the language by a
GET var (for example &language_code=en) ?


-- 
Alessandro Ronchi
Skype: aronchi
http://www.alessandroronchi.net

SOASI Soc.Coop. - www.soasi.com
Sviluppo Software e Sistemi Open Source
Sede: Via Poggiali 2/bis, 47100 Forlì (FC)
Tel.: +39 0543 798985 - Fax: +39 0543 579928

Rispetta l'ambiente: se non ti è necessario, non stampare questa mail

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



Re: django i18n for google

2008-12-27 Thread Alessandro Ronchi
Il 16 dicembre 2008 19.20, Alessandro Ronchi
 ha scritto:
> When google spiders our i18n translated django websites, does it try
> and indicize all languages? is it possible to force the language by a
> GET var (for example &language_code=en) ?

I think it's a critical problem.

We spend time to make our i18n websites but google bot don't see other
languages except default.  Is there a way to select language with a
get url? Any other solution?


-- 
Alessandro Ronchi
Skype: aronchi
http://www.alessandroronchi.net

SOASI Soc.Coop. - www.soasi.com
Sviluppo Software e Sistemi Open Source
Sede: Via Poggiali 2/bis, 47100 Forlì (FC)
Tel.: +39 0543 798985 - Fax: +39 0543 579928

Rispetta l'ambiente: se non ti è necessario, non stampare questa mail

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



Re: django i18n for google

2008-12-28 Thread Alessandro Ronchi
2008/12/27 Antoni Aloy :

> You could create a url that links to your localized site so Google
> would be able to crawl it, but I suppose that your site depens on
> changing the language via POST, isn't it?
>
> I that case, you could write yourselve the code and allow changing the
> code using GET.

Django itselfs permits selecting the i18n language via POST. I think
it should be useful to add also a GET var to set the language, and a
localization middleware catches it.
Django gets user language from the browser accept-language or user
browser cookie, but it should be useful to force it with a
&language=en

This little mod could improve google crawling, because one can only
make sitemaps with urls and that get value added to  default urls for
every translations (and it should be easy to add a shortcut to add
urls in different language translations in sitemap views).



-- 
Alessandro Ronchi
Skype: aronchi
http://www.alessandroronchi.net

SOASI Soc.Coop. - www.soasi.com
Sviluppo Software e Sistemi Open Source
Sede: Via Poggiali 2/bis, 47100 Forlì (FC)
Tel.: +39 0543 798985 - Fax: +39 0543 579928

Rispetta l'ambiente: se non ti è necessario, non stampare questa mail

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



{{shop_url}}

2009-01-12 Thread Alessandro Ronchi
Is there a template tag with show_url like {{shop_name}} ?

-- 
Alessandro Ronchi
Skype: aronchi
http://www.alessandroronchi.net

SOASI Soc.Coop. - www.soasi.com
Sviluppo Software e Sistemi Open Source
Sede: Via Poggiali 2/bis, 47100 Forlì (FC)
Tel.: +39 0543 798985 - Fax: +39 0543 579928

Rispetta l'ambiente: se non ti è necessario, non stampare questa mail

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



Re: Core = True replacemente

2008-09-12 Thread Alessandro Ronchi
2008/9/12 Karen Tracey <[EMAIL PROTECTED]>:

>
> You don't need to replace it, just delete it.  (In old admin it was used to
> decide when an intline-edited object should be deleted.  New admin has an
> explicit 'delete' checkbox for this, so core is no longer necessary.)

Simply beautiful!
-- 
Alessandro Ronchi
Skype: aronchi
http://www.alessandroronchi.net

SOASI Soc.Coop. - www.soasi.com
Sviluppo Software e Sistemi Open Source
Sede: Via Poggiali 2/bis, 47100 Forlì (FC)
Tel.: +39 0543 798985 - Fax: +39 0543 579928

Rispetta l'ambiente: se non ti è necessario, non stampare questa mail

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



Re: form get with special characters

2008-09-21 Thread Alessandro Ronchi
2008/9/21 Malcolm Tredinnick <[EMAIL PROTECTED]>:
>
>
> On Sun, 2008-09-21 at 12:44 +0200, Alessandro wrote:
>> I have a search form.
>> When a user inserts a string like "Forlì", django returns a blank page.
>> I need to convert ì to a url encoded string, but I don't know how to do.
>
> You haven't explained where the problem is occurring. Is the correct
> data getting to your view function and then you aren't sending back the
> right information? If so, look at django.utils.http. I can't see how
> that would be resulting in a completely blank page, however. Also "a
> blank page" could be more accurate: is no data at all being sent back?
> Or is the user receiving an HTML page, but there's not visible data?

It seems now It works, because
http://www.animalisenzacasa.org/ricerca/?s=forlì
is converted to:
http://www.animalisenzacasa.org/ricerca/?s=forl%C3%AC

I don't know what's changed, because this morning the result was an
empty page (with source code white, and a correct http header).

-- 
Alessandro Ronchi
Skype: aronchi
http://www.alessandroronchi.net

SOASI Soc.Coop. - www.soasi.com
Sviluppo Software e Sistemi Open Source
Sede: Via Poggiali 2/bis, 47100 Forlì (FC)
Tel.: +39 0543 798985 - Fax: +39 0543 579928

Rispetta l'ambiente: se non ti è necessario, non stampare questa mail

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



Re: filter queryset in admin

2008-09-22 Thread Alessandro Ronchi
2008/9/22 Martin Ostrovsky <[EMAIL PROTECTED]>:
>
> Assuming you're using Django v1.0 ... you could override the queryset
> method in your class that defines the admin properties for your class.
> For example:

Thanks.
The solution (tested) is to add this function to the admin class:


def queryset(self, request):
   qs = super(SchedaOptions,self).queryset(request)
   utente = request.user
   if utente.is_superuser:
   return qs
   else:
   return qs.filter(referente=utente)

maybe it can be useful to add a line on django book, it's a common need.
-- 
Alessandro Ronchi
Skype: aronchi
http://www.alessandroronchi.net

SOASI Soc.Coop. - www.soasi.com
Sviluppo Software e Sistemi Open Source
Sede: Via Poggiali 2/bis, 47100 Forlì (FC)
Tel.: +39 0543 798985 - Fax: +39 0543 579928

Rispetta l'ambiente: se non ti è necessario, non stampare questa mail

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



Re: Ordering results by m2m relations without multiply results

2008-09-27 Thread Alessandro Ronchi
2008/9/27 Malcolm Tredinnick <[EMAIL PROTECTED]>:

> Not really, except for writing a raw SQL query. The raw SQL for this
> type of query is very complicated and it's such an edge case (it's
> trying to do if-then logic in SQL when you write it out) and not always
> even possible, so Django doesn't even try. If you order on a
> multi-valued field and have more than one related value, you'll get
> multiple rows.
>
> You might want to prefer to do the ordering in Python or as a second
> pass. Or you could try to write the raw SQL, but it could be fairly
> messy.

Ok.
Is it possible to pass the queryset to the generic view after ordering
with python, or I have to rewrite also the generic view?



-- 
Alessandro Ronchi
Skype: aronchi
http://www.alessandroronchi.net

SOASI Soc.Coop. - www.soasi.com
Sviluppo Software e Sistemi Open Source
Sede: Via Poggiali 2/bis, 47100 Forlì (FC)
Tel.: +39 0543 798985 - Fax: +39 0543 579928

Rispetta l'ambiente: se non ti è necessario, non stampare questa mail

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



Re: Restrict users to their own data

2008-09-27 Thread Alessandro Ronchi
2008/9/26 Orne <[EMAIL PROTECTED]>:
>
> This example doesn't work for me:
> Error: 'super' object has no attribute 'filter'

I use this code (it works with django 1.0):
def queryset(self, request):
   # Limit the queryset to some subset based on the value of user.
   qs = super(SchedaOptions,self).queryset(request)
   utente = request.user
   if utente.is_superuser:
   return qs
   else:
   return qs.filter(referente=utente).filter(stato_scheda__exact = '0')


I think the error of the example above was the lack of
.queryset(request) call on super()
-- 
Alessandro Ronchi
Skype: aronchi
http://www.alessandroronchi.net

SOASI Soc.Coop. - www.soasi.com
Sviluppo Software e Sistemi Open Source
Sede: Via Poggiali 2/bis, 47100 Forlì (FC)
Tel.: +39 0543 798985 - Fax: +39 0543 579928

Rispetta l'ambiente: se non ti è necessario, non stampare questa mail

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



Re: How to stop internal django server

2008-09-28 Thread Alessandro Ronchi
2008/9/28 Hingarajiya,Ravi <[EMAIL PROTECTED]>:
> Hi All,
>
> I am very new in Django Framework.
>
> I want to know how to stop internal server without ctrl+c.
>
> For start command : python manage.py runserver
> What is stop command ?
>
> Ravi Hingarajiya

It's a process, so you can stop it like any other linux process:
killall python
ps aux | grep python  and then kill #numproc
ctrl + c

and so on

-- 
Alessandro Ronchi
Skype: aronchi
http://www.alessandroronchi.net

SOASI Soc.Coop. - www.soasi.com
Sviluppo Software e Sistemi Open Source
Sede: Via Poggiali 2/bis, 47100 Forlì (FC)
Tel.: +39 0543 798985 - Fax: +39 0543 579928

Rispetta l'ambiente: se non ti è necessario, non stampare questa mail

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



Re: Admin internationalization

2008-09-30 Thread Alessandro Ronchi
2008/9/30 Malcolm Tredinnick <[EMAIL PROTECTED]>:
>
>
> On Mon, 2008-09-29 at 22:46 -0700, krylatij wrote:
>> I have Django site in 2 languages - Moldavian(default) and Russian
>> But django-admin is not localized for Moldavian, that's way i want to
>> use Russian in admin.
>> So my settings.py will look like this:
>>
>> LANGUAGE_CODE = 'md'
>>
>> LANGUAGES = (
>> ('md', (u'Moldavian')),
>> ('ru', (u'English')),
>> )
>>
>> But django looks for translation for "md" in admin  - can't find it
>> and uses English
>> Does exists simple way to tell Django - allways to use Russian for
>> admin.
>
> No. Django's designed to work in only one locale at a time, not to have
> fallbacks like that. Fallbacks don't really make sense for websites that
> are properly translated (mixing multiple languages just because the
> translation isn't complete would be very confusing to the users).
>
> The "real" solution here is to give us a Moldovan translation for Django
> itself. :-)

You can copy the russian translation files overwriting english


-- 
Alessandro Ronchi
Skype: aronchi
http://www.alessandroronchi.net

SOASI Soc.Coop. - www.soasi.com
Sviluppo Software e Sistemi Open Source
Sede: Via Poggiali 2/bis, 47100 Forlì (FC)
Tel.: +39 0543 798985 - Fax: +39 0543 579928

Rispetta l'ambiente: se non ti è necessario, non stampare questa mail

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



Re: django performance with cache on dreamhost.

2008-10-03 Thread Alessandro Ronchi
2008/10/3 Erik Allik <[EMAIL PROTECTED]>:
>
> Have you profiled your application? How many SQL queries is it doing
> during a request processing cycle?
>
> You could write a web app in pure asm code and still get 1 req/sec if
> you did something really stupid in your code so it's not generally
> about Django.

I couldn't profile this app on dreamhost because I cannot

import hotshot, hotshot.stats

like in
http://www.djangosnippets.org/snippets/605/

any other methods?
-- 
Alessandro Ronchi
Skype: aronchi
http://www.alessandroronchi.net

SOASI Soc.Coop. - www.soasi.com
Sviluppo Software e Sistemi Open Source
Sede: Via Poggiali 2/bis, 47100 Forlì (FC)
Tel.: +39 0543 798985 - Fax: +39 0543 579928

Rispetta l'ambiente: se non ti è necessario, non stampare questa mail

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



Re: select_related and intermediary tables

2008-10-06 Thread Alessandro Ronchi
2008/10/3 Robert <[EMAIL PROTECTED]>:
>
> I've been banging my head against this problem for several days now,
> and have decided to ask for help.  I've read the Django DB API and
> searched this mailing list.
>
> Assuming the following models:
>
> http://dpaste.com/82218/
>
> What I would like to do is access the 'study_level' field.
>
> When my view is called, I will know the Agency name, and I'd like to
> show a list of documents that correspond to that agency.
>
> Generic views allow me to quite easily do this, but what I can't seem
> to do is access the information in agency_docs.  When I print out each
> document, I'd like to put the 'study_level' information beside each.
>
> I though that 'select_related' would be my answer, because as far as I
> can tell, I need to do a classic JOIN.
>
> However, I've tried:
>>>> a = Agency.objects.get(name='Agency1')
>>>> d = a.documents.select_related().all()
>>>> d[0].agency_docs.study_level
> but I get the 'has no attribute 'agency_docs' error.  I believe I've
> tried every conceivable combination, I've stuck _set onto the ends of
> things, I'm completely frustrated.
>
> Any help would be greatly appreciated.

select_related() is another thing, and it's useful to avoid multiple
queries when you have to access to related_fields.

You must give us the model you have set to understand.

if it's like:

class Agency:
   name = TextField

class Document:
   agency = ForeignKey(Agency, related_name="docs")
   study_level = IntegerField

you can access to agency_docs with
a = Agency.objects.select_related().get(name='Agency1')
docs[0] = a.docs
print doc.study_level

if you don't set the related_name, you must use document_set:

a = Agency.objects.select_related().get(name='Agency1')
docs = a.document_set
print docs[0].study_level



-- 
Alessandro Ronchi
Skype: aronchi
http://www.alessandroronchi.net

SOASI Soc.Coop. - www.soasi.com
Sviluppo Software e Sistemi Open Source
Sede: Via Poggiali 2/bis, 47100 Forlì (FC)
Tel.: +39 0543 798985 - Fax: +39 0543 579928

Rispetta l'ambiente: se non ti è necessario, non stampare questa mail

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



Re: select_related and intermediary tables

2008-10-06 Thread Alessandro Ronchi
2008/10/3 Robert <[EMAIL PROTECTED]>:
>
> I've been banging my head against this problem for several days now,
> and have decided to ask for help.  I've read the Django DB API and
> searched this mailing list.
>
> Assuming the following models:
>
> http://dpaste.com/82218/
>
> What I would like to do is access the 'study_level' field.
>
> When my view is called, I will know the Agency name, and I'd like to
> show a list of documents that correspond to that agency.
>
> Generic views allow me to quite easily do this, but what I can't seem
> to do is access the information in agency_docs.  When I print out each
> document, I'd like to put the 'study_level' information beside each.
>
> I though that 'select_related' would be my answer, because as far as I
> can tell, I need to do a classic JOIN.
>
> However, I've tried:
>>>> a = Agency.objects.get(name='Agency1')
>>>> d = a.documents.select_related().all()
>>>> d[0].agency_docs.study_level
> but I get the 'has no attribute 'agency_docs' error.  I believe I've
> tried every conceivable combination, I've stuck _set onto the ends of
> things, I'm completely frustrated.

select_related() is another thing, and it's useful to avoid multiple
queries when you have to access to related_fields.

You must give us the model you have set to understand.

if it's like:

class Agency:
   name = TextField

class Document:
   agency = ForeignKey(Agency, related_name="docs")
   study_level = IntegerField

you can access to agency_docs with
a = Agency.objects.select_related().get(name='Agency1')
docs[0] = a.docs
print doc.study_level

if you don't set the related_name, you must use document_set:

a = Agency.objects.select_related().get(name='Agency1')
docs = a.document_set
print docs[0].study_level



-- 
Alessandro Ronchi
Skype: aronchi
http://www.alessandroronchi.net

SOASI Soc.Coop. - www.soasi.com
Sviluppo Software e Sistemi Open Source
Sede: Via Poggiali 2/bis, 47100 Forlì (FC)
Tel.: +39 0543 798985 - Fax: +39 0543 579928

Rispetta l'ambiente: se non ti è necessario, non stampare questa mail

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



Re: djangosnippets.org list navigation

2008-10-10 Thread Alessandro Ronchi
2008/10/10 Gerard Petersen <[EMAIL PROTECTED]>:
>
> You can simply add this to your keywords in google (and thus use google):
>
> site:www.djangosnippets.org
>
> End result:
>
> http://www.google.nl/search?q=site%3Awww.djangosnippets.org+state

Maybe if djangosnippets.org adds the google search the project can
also receive some money for the ad search, and the user is not forcet
to go out from the website to search the content of the snippets.

It can be a way to support the good project.

-- 
Alessandro Ronchi
Skype: aronchi
http://www.alessandroronchi.net

SOASI Soc.Coop. - www.soasi.com
Sviluppo Software e Sistemi Open Source
Sede: Via Poggiali 2/bis, 47100 Forlì (FC)
Tel.: +39 0543 798985 - Fax: +39 0543 579928

Rispetta l'ambiente: se non ti è necessario, non stampare questa mail

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



Re: related_name in filter search

2008-10-13 Thread Alessandro Ronchi
2008/10/11 Karen Tracey <[EMAIL PROTECTED]>:

> You've got a typo in there somewhere, because there is no 'notizie' in the
> query you posted, you've got 'schede' like above.  So I'm not sure exactly
> what you tried nor exactly what error you got.  Cut and paste of code and
> error messages is best to avoid confusion.  Also, posting complete models
> instead of just snippets (put them out on dpaste.com and point to them if
> they are non-trivial and thus will display poorly in email) may be better in
> this case.  From what you posted so far I don't see why what (I'm guessing)
> your query was isn't working.

This is my models.py:
http://dpaste.com/84075/

This is my urls.py:
http://dpaste.com/84077/
(che commented line is the one that gives the error)
# 
ultima_edizione=Edizione.objects.distinct().filter(notizie__isnull=False).order_by('-id')


This is the error i Get:

http://dpaste.com/84076/

Thanks in advance!

-- 
Alessandro Ronchi
Skype: aronchi
http://www.alessandroronchi.net

Rispetta l'ambiente: se non ti è necessario, non stampare questa mail

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



Re: password_reset

2008-10-14 Thread Alessandro Ronchi
i must add it also doesn't print the newpassword in the email it sends.

If you have a working password_reset template, please share with the
community :)

2008/10/14 Alessandro <[EMAIL PROTECTED]>:
> I want to let users reset their password, so I've used the password_reset 
> view.
> I don't want to show my admin site to users, so I've overwritten the template
> (r'^accounts/password_reset[/]*$',
> 'django.contrib.auth.views.password_reset' ,{'template_name':
> 'account/password_reset_form.html'}),
>
> In that way I have two errors:
> 1) the template doesn't load the translation. but I've changed only
> the first line to {% extends "index.html" %} , to use my index
> template
> 2) Errors are not shown as it happens if I leave  {% extends
> "admin/base_site" %}
>
> Is there any easy way to solve it?
>
> --
> Alessandro Ronchi
> Skype: aronchi
> http://www.alessandroronchi.net
>
> Rispetta l'ambiente: se non ti è necessario, non stampare questa mail
>



-- 
Alessandro Ronchi
Skype: aronchi
http://www.alessandroronchi.net

SOASI Soc.Coop. - www.soasi.com
Sviluppo Software e Sistemi Open Source
Sede: Via Poggiali 2/bis, 47100 Forlì (FC)
Tel.: +39 0543 798985 - Fax: +39 0543 579928

Rispetta l'ambiente: se non ti è necessario, non stampare questa mail

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



Duplicating sitemap dictionary with a get variable

2009-01-14 Thread Alessandro Ronchi
I have a sitemap dictionary.
I want to add in my sitemap.xml an url for every url of my sitemap with a
?lang=en ending. Is it possible?

So, if my sitemap contains:
http://www.detectorpoint.com/
http://www.detectorpoint.com/about/

I want my sitemap to contain:
http://www.detectorpoint.com/
http://www.detectorpoint.com/?lang=en
http://www.detectorpoint.com/about/
http://www.detectorpoint.com/about/?lang=en

I have hundreds of pages, so I cannot do that by hand...

-- 
Alessandro Ronchi
Skype: aronchi
http://www.alessandroronchi.net

SOASI Soc.Coop. - www.soasi.com
Sviluppo Software e Sistemi Open Source
Sede: Via Poggiali 2/bis, 47100 Forlì (FC)
Tel.: +39 0543 798985 - Fax: +39 0543 579928

Rispetta l'ambiente: se non ti è necessario, non stampare questa mail

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



ValidationError: [u'ManagementForm data is missing or has been tampered with']

2009-01-20 Thread Alessandro Ronchi
I have this model:
http://dpaste.com/111206/

and this admin.py:
http://dpaste.com/111207/

but when I try to edit an existing "Impresa" i get a ValidationError:
ManagementForm data is missing or has been tampered with

what's the problem?

-- 
Alessandro Ronchi
Skype: aronchi
http://www.alessandroronchi.net

SOASI Soc.Coop. - www.soasi.com
Sviluppo Software e Sistemi Open Source
Sede: Via Poggiali 2/bis, 47100 Forlì (FC)
Tel.: +39 0543 798985 - Fax: +39 0543 579928

Rispetta l'ambiente: se non ti è necessario, non stampare questa mail

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



TypeError: Related Field has invalid lookup: icontains

2009-01-21 Thread Alessandro Ronchi

When one tries to make a search in admin with a model table he gets this error:

TypeError: Related Field has invalid lookup: icontains

is there anyway to solve it and make it returns nothings instead of 500 error?

-- 
Alessandro Ronchi
Skype: aronchi
http://www.alessandroronchi.net

SOASI Soc.Coop. - www.soasi.com
Sviluppo Software e Sistemi Open Source
Sede: Via Poggiali 2/bis, 47100 Forlì (FC)
Tel.: +39 0543 798985 - Fax: +39 0543 579928

Rispetta l'ambiente: se non ti è necessario, non stampare questa mail

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



Re: TypeError: Related Field has invalid lookup: icontains

2009-01-21 Thread Alessandro Ronchi

2009/1/21 Karen Tracey :
> On Wed, Jan 21, 2009 at 10:21 AM, Alessandro Ronchi
>  wrote:
>>
>> When one tries to make a search in admin with a model table he gets this
>> error:
>>
>> TypeError: Related Field has invalid lookup: icontains
>>
>> is there anyway to solve it and make it returns nothings instead of 500
>> error?
>
> Some details of the model and admin defs in use here would help someone help
> you.
>
> Karen

A part of my models.py:
http://dpaste.com/111580/

and my admin:
http://dpaste.com/111581/

Thanks in advance!


-- 
Alessandro Ronchi
Skype: aronchi
http://www.alessandroronchi.net

SOASI Soc.Coop. - www.soasi.com
Sviluppo Software e Sistemi Open Source
Sede: Via Poggiali 2/bis, 47100 Forlì (FC)
Tel.: +39 0543 798985 - Fax: +39 0543 579928

Rispetta l'ambiente: se non ti è necessario, non stampare questa mail

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



Re: TypeError: Related Field has invalid lookup: icontains

2009-01-22 Thread Alessandro Ronchi

2009/1/21 Karen Tracey :

> Egads, they're huge.  Any way you could cut that down to a small failing
> example?  Or at least mention which model you are trying the search on?
> Also a traceback instead of just the last error message would probably help,
> as it might give some clue where to start looking.

It falls on SchedaBilancioGenere model. I cannot replicate on a smaller model.

They're huge, but all the fields are not important: it seems if falls
on a related field.

This is the trackback:
http://dpaste.com/111757/

-- 
Alessandro Ronchi
Skype: aronchi
http://www.alessandroronchi.net

SOASI Soc.Coop. - www.soasi.com
Sviluppo Software e Sistemi Open Source
Sede: Via Poggiali 2/bis, 47100 Forlì (FC)
Tel.: +39 0543 798985 - Fax: +39 0543 579928

Rispetta l'ambiente: se non ti è necessario, non stampare questa mail

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



Re: TypeError: Related Field has invalid lookup: icontains

2009-01-22 Thread Alessandro Ronchi

2009/1/22 Karen Tracey :

> Ah, you have in your search_fields for SchedaBilancioGenereOptions
> 'impresa', which is a ForeignKey.  You need to specify what field within the
> related model you want to search, so 'impresa__fieldname'.  (If there are
> multiple fields you need to list each explicitly, using the standard
> double-underscore syntax.)

You was right!

Thanks a lot!

-- 
Alessandro Ronchi
Skype: aronchi
http://www.alessandroronchi.net

SOASI Soc.Coop. - www.soasi.com
Sviluppo Software e Sistemi Open Source
Sede: Via Poggiali 2/bis, 47100 Forlì (FC)
Tel.: +39 0543 798985 - Fax: +39 0543 579928

Rispetta l'ambiente: se non ti è necessario, non stampare questa mail

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



Using dinamically created tables

2009-01-23 Thread Alessandro Ronchi
I need to start a project with thousand of tuples every day for N solar
plants.
*I think I need multiple databse tables for a single model,* because I can
divide every plant's tuples.
So I need something to create a (#1 table) GenericPlantModel and (#n tables)
GenericPlantData and when I create a new GenericPlantModel Instance I need
to create a new GenericPlantData_1 table instead using the same GenericPlant
one (with millions of tuples).

Is it possible?
What's the limit of the number of tuples I can handle without problems in
MySQL or PostgreSQL (and witch one is the best, for this heavy work)?

-- 
Alessandro Ronchi
Skype: aronchi
http://www.alessandroronchi.net

SOASI Soc.Coop. - www.soasi.com
Sviluppo Software e Sistemi Open Source
Sede: Via Poggiali 2/bis, 47100 Forlì (FC)
Tel.: +39 0543 798985 - Fax: +39 0543 579928

Rispetta l'ambiente: se non ti è necessario, non stampare questa mail

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



Re: Using dinamically created tables

2009-01-23 Thread Alessandro Ronchi
2009/1/23 Ned Batchelder 

>  You don't need to create new tables like this.  These database systems are
> very good at handling large amounts of data.  Add a field plant to your
> model, make sure it is indexed, and use it to query for the data you want.
> The entire system from the database up through the ORM and the rest of
> Django has been built to do a good job with this model.  Trying to create
> new tables as you propose is going against the grain at every level.
>

Where can I find something about the limits of mysql or postgresql?
If I have 50 plants and ~8000 tuple for every plant every day, and a
dimension of 30 fields (double), i have 400kb for every plant /day.
In a year I will reach 8GB of data.
I will have 2 tables for a total of 60 fields, + indexes and other django
fields.

Is that reasonable to be handled in a single table?




-- 
Alessandro Ronchi
Skype: aronchi
http://www.alessandroronchi.net

SOASI Soc.Coop. - www.soasi.com
Sviluppo Software e Sistemi Open Source
Sede: Via Poggiali 2/bis, 47100 Forlì (FC)
Tel.: +39 0543 798985 - Fax: +39 0543 579928

Rispetta l'ambiente: se non ti è necessario, non stampare questa mail

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



Re: Using dinamically created tables

2009-01-24 Thread Alessandro Ronchi

One simple solution for my problem is table partitioning. Both MySQL
and PosgreSQL can handle that.
On PGSQL I can create a master table for my model and one partition
for every value of a master key. It should be great.

Do you think it's possible to handle a child table creation (also with
a PGSQL command without ORM) on a save of a model? The query and
inserts should be transparent, and so I could use django for
everything.




-- 
Alessandro Ronchi
Skype: aronchi
http://www.alessandroronchi.net

SOASI Soc.Coop. - www.soasi.com
Sviluppo Software e Sistemi Open Source
Sede: Via Poggiali 2/bis, 47100 Forlì (FC)
Tel.: +39 0543 798985 - Fax: +39 0543 579928

Rispetta l'ambiente: se non ti è necessario, non stampare questa mail

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



Someone using django trunk for production?

2009-01-31 Thread Alessandro Ronchi

I need to use aggregation features of django 1.1 (i need AVG, SUM).

My production site uses 1.0.2.

Can I upgrade to trunk without worrying?

-- 
Alessandro Ronchi
Skype: aronchi
http://www.alessandroronchi.net

SOASI Soc.Coop. - www.soasi.com
Sviluppo Software e Sistemi Open Source
Sede: Via Poggiali 2/bis, 47100 Forlì (FC)
Tel.: +39 0543 798985 - Fax: +39 0543 579928

Rispetta l'ambiente: se non ti è necessario, non stampare questa mail

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



Group By and aggregation

2009-02-10 Thread Alessandro Ronchi
I have to get the max value of a model grouped by a field.

The RAW SQL query is this:

SELECT max(energy_tot) FROM fotovoltaico_modules,fotovoltaico_module_scheme
WHERE fotovoltaico_module_scheme.plant_id = 3 AND
fotovoltaico_modules.scheme_id = fotovoltaico_module_scheme.id
GROUP BY fotovoltaico_modules.scheme_id;

I haven't found any way to make the aggregation work with the group by.

This is my model:
http://dpaste.com/118868/


I've tried also:
qs = Modules.objects.filter(scheme__plant=3).order_by("-time")
qs.query.group_by = ["fotovoltaico_modules.scheme_id"]

but it loose the order by and the results are not the same I want.

Thanks in advance!


-- 
Alessandro Ronchi
Skype: aronchi
http://www.alessandroronchi.net

SOASI Soc.Coop. - www.soasi.com
Sviluppo Software e Sistemi Open Source
Sede: Via Poggiali 2/bis, 47100 Forlì (FC)
Tel.: +39 0543 798985 - Fax: +39 0543 579928

Rispetta l'ambiente: se non ti è necessario, non stampare questa mail

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



problem with PIL and Python2.5

2009-02-19 Thread Alessandro Ronchi

I get an error when I try to upload a jpeg file.

I've tried to compile PIL from scratch, and
python setup.py build_ext -i

 says:
--- JPEG support ok
--- ZLIB (PNG/ZIP) support ok
--- FREETYPE2 support ok

but when I try selftest:
http://dpaste.com/122689/

I've tried everything.

I'm running on a debian 4.

Thanks in advance!

-- 
Alessandro Ronchi
Skype: aronchi
http://www.alessandroronchi.net

SOASI Soc.Coop. - www.soasi.com
Sviluppo Software e Sistemi Open Source
Sede: Via Poggiali 2/bis, 47100 Forlì (FC)
Tel.: +39 0543 798985 - Fax: +39 0543 579928

Rispetta l'ambiente: se non ti è necessario, non stampare questa mail

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



grouping save() queries into a single query

2009-02-20 Thread Alessandro Ronchi

is it possible to group different model save() to avoid the
multiplication of db connections and queries?

I need to make a lot of save() of different new models and it should
be very useful to find a way to group them and commit together.

Is there any way to make persistant connections? I'm using mod_python.

-- 
Alessandro Ronchi
Skype: aronchi
http://www.alessandroronchi.net

SOASI Soc.Coop. - www.soasi.com
Sviluppo Software e Sistemi Open Source
Sede: Via Poggiali 2/bis, 47100 Forlì (FC)
Tel.: +39 0543 798985 - Fax: +39 0543 579928

Rispetta l'ambiente: se non ti è necessario, non stampare questa mail

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



PostgreSQL case sensitive icontains

2009-02-20 Thread Alessandro Ronchi

with postgreSQL I get case sensitive filters also with icontains.
Is there nothing I can do to solve this problem?

-- 
Alessandro Ronchi
Skype: aronchi
http://www.alessandroronchi.net

SOASI Soc.Coop. - www.soasi.com
Sviluppo Software e Sistemi Open Source
Sede: Via Poggiali 2/bis, 47100 Forlì (FC)
Tel.: +39 0543 798985 - Fax: +39 0543 579928

Rispetta l'ambiente: se non ti è necessario, non stampare questa mail

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



how to hide a field in admin

2009-03-03 Thread Alessandro Ronchi

I have a field I want to be show on web pages form for a model but not
in the admin section. Is it possible?

If I use editable = False it will be hidden for both.

-- 
Alessandro Ronchi
Skype: aronchi
http://www.alessandroronchi.net

SOASI Soc.Coop. - www.soasi.com
Sviluppo Software e Sistemi Open Source
Sede: Via Poggiali 2/bis, 47100 Forlì (FC)
Tel.: +39 0543 798985 - Fax: +39 0543 579928

Rispetta l'ambiente: se non ti è necessario, non stampare questa mail

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



Map events in space on a django app

2009-03-19 Thread Alessandro Ronchi
I need to make a website that permits users to put warnings of dangerous
points in a city map.

Users should drag a signal on a street map and put text of the warning, and
then send them to the server.

The site should presents them in a navigable map, like it does
http://djangopeople.net/

is there any snippet or sample code to do the same?

-- 
Alessandro Ronchi
Skype: aronchi
http://www.alessandroronchi.net

SOASI Soc.Coop. - www.soasi.com
Sviluppo Software e Sistemi Open Source
Sede: Via Poggiali 2/bis, 47100 Forlì (FC)
Tel.: +39 0543 798985 - Fax: +39 0543 579928

Rispetta l'ambiente: se non ti è necessario, non stampare questa mail

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



exclude=field only for non superuser staff

2009-03-23 Thread Alessandro Ronchi

I need to set a field as escluded in admin.py only for non-superuser
staff people.
is it possible?
how can I do that?

-- 
Alessandro Ronchi
Skype: aronchi
http://www.alessandroronchi.net

SOASI Soc.Coop. - www.soasi.com
Sviluppo Software e Sistemi Open Source
Sede: Via Poggiali 2/bis, 47100 Forlì (FC)
Tel.: +39 0543 798985 - Fax: +39 0543 579928

Rispetta l'ambiente: se non ti è necessario, non stampare questa mail

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



Reverse tag of safe

2009-03-24 Thread Alessandro Ronchi
I need to translate html entities on utf-8 characters, like à to à
is there any template tag filter which can do that?

-- 
Alessandro Ronchi
Skype: aronchi
http://www.alessandroronchi.net

SOASI Soc.Coop. - www.soasi.com
Sviluppo Software e Sistemi Open Source
Sede: Via Poggiali 2/bis, 47100 Forlì (FC)
Tel.: +39 0543 798985 - Fax: +39 0543 579928

Rispetta l'ambiente: se non ti è necessario, non stampare questa mail

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



Integrity error in get_or_create

2009-06-21 Thread Alessandro Ronchi
I have a very strange problem.

With this function:

def get_current(self):

facebook = get_facebook_client()
user, created = self.get_or_create(id=int(facebook.uid))
if created:
# we could do some custom actions for new users here...
pass
return user


called by
user = User.objects.get_current()

I get an integrity error: duplicate key.

how it's possible? if is there already a user with that key it should return
that without cause an integrity error, true?
-- 
Alessandro Ronchi
Skype: aronchi

SOASI Soc.Coop. - www.soasi.com
Sviluppo Software e Sistemi Open Source
Sede: Via Poggiali 2/bis, 47100 Forlì (FC)
Tel.: +39 0543 798985 - Fax: +39 0543 579928

Rispetta l'ambiente: se non ti è necessario, non stampare questa mail

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



Re: Integrity error in get_or_create

2009-06-21 Thread Alessandro Ronchi
2009/6/21 Alessandro Ronchi 

> I have a very strange problem.
>
> With this function:
>
> def get_current(self):
>
> facebook = get_facebook_client()
> user, created = self.get_or_create(id=int(facebook.uid))
> if created:
> # we could do some custom actions for new users here...
> pass
> return user
>
>
> called by
> user = User.objects.get_current()
>
> I get an integrity error: duplicate key.
>
> how it's possible? if is there already a user with that key it should
> return that without cause an integrity error, true?


it's particulary strange because I've this problem with a user id and not
with another
IntegrityError: (1062, "Duplicate entry '2147483647' for key 1")

2147483647 doesn't work, 527319900 works

This problem is blocking me and I've done all the test I thought to be
useful..

If I try this:
User.objects.get(id=2147483647) it returns the object, but If I write:

try:
   user = User.objects.get(id=int(facebook.uid))
except:
   user = User(id=int(facebook.uid))
   user.save()

it gets into the except and tries to open another User with the same id!


-- 
Alessandro Ronchi
Skype: aronchi

SOASI Soc.Coop. - www.soasi.com
Sviluppo Software e Sistemi Open Source
Sede: Via Poggiali 2/bis, 47100 Forlì (FC)
Tel.: +39 0543 798985 - Fax: +39 0543 579928

Rispetta l'ambiente: se non ti è necessario, non stampare questa mail

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



Re: Integrity error in get_or_create

2009-06-22 Thread Alessandro Ronchi
2009/6/21 Alessandro Ronchi 

>
> it gets into the except and tries to open another User with the same id!
>


It seemed to be a very big int for uid that caused a truncation when saving
into database.
-- 
Alessandro Ronchi
Skype: aronchi

SOASI Soc.Coop. - www.soasi.com
Sviluppo Software e Sistemi Open Source
Sede: Via Poggiali 2/bis, 47100 Forlì (FC)
Tel.: +39 0543 798985 - Fax: +39 0543 579928

Rispetta l'ambiente: se non ti è necessario, non stampare questa mail

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



Django Search Form in Admin

2009-07-01 Thread Alessandro Ronchi

Given a simple model, I need to write a search form in admin (not the
text search inside admin model list).

It's the same as a form.as_table() but inside admin.

Is it possible?

Any working example?

I also need to insert a button with a link to export the result
queryset to Excel or PDF. (a simple link pointing to a view sending
the search form filled as POST).

Must I write a new app outside the admin?

-- 
Alessandro Ronchi

SOASI
Sviluppo Software e Sistemi Open Source
http://www.soasi.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
-~--~~~~--~~--~--~---



Django RSS Feeds with adsense

2009-07-08 Thread Alessandro Ronchi
I need to put an HTML code in my feeds, but if I put the adsense code in my
feed description it's escaped for XML. Is there a way to add the code
without having it escaped?

This is my code:

<!--
google_ad_client = "pub-6556115776553690";
/* 234x60, creato 08/07/09 */
google_ad_slot = "4803082542";
google_ad_width = 234;
google_ad_height = 60;
//-->

http://pagead2.googlesyndication.com/pagead/show_ads.js"</a>;>




Thanks in advance
-- 
Alessandro Ronchi

SOASI
Sviluppo Software e Sistemi Open Source
http://www.soasi.com

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



Re: Django RSS Feeds with adsense

2009-07-08 Thread Alessandro Ronchi
2009/7/8 Mike Ramirez 

> Wrap the script code with 
>
> See: http://www.w3schools.com/xmL/xml_cdata.asp
>
> Mike
>
>
It's parsed too:

<![CDATA[



-- 
Alessandro Ronchi

SOASI
Sviluppo Software e Sistemi Open Source
http://www.soasi.com

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



Re: Django RSS Feeds with adsense

2009-08-02 Thread Alessandro Ronchi

2009/7/9 Juanjux (Google) :
>
> I don't know the answer to your specific question but you could make a
> feedburner RSS from it. Then you can insert adsense for feeds on it
> with just a click on adsense settings (it's all integrated.)

I'm using feedburner but with another account. I cannot move the feed
because I've a lot of members who have subscribed the feed by email.

So my only chance is to add the adsense code to django feeds, but I
don't know how because it pass the code to a safe filter and that
disable my script.

-- 
Alessandro Ronchi

SOASI
Sviluppo Software e Sistemi Open Source
http://www.soasi.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
-~--~~~~--~~--~--~---



Threaded comments on django 1.1

2009-08-07 Thread Alessandro Ronchi
I must add threaded comments to my django 1.1 app.
Is there anything already done I can use?

Any advise?

-- 
Alessandro Ronchi

SOASI
Sviluppo Software e Sistemi Open Source
http://www.soasi.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
-~--~~~~--~~--~--~---



Django comments honeypot hide

2009-08-10 Thread Alessandro Ronchi
I need to hide the django-comments honeypot in my comment form, but It's
visible to the user.

Is there a way to do that in an easy way?

-- 
Alessandro Ronchi

SOASI
Sviluppo Software e Sistemi Open Source
http://www.soasi.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
-~--~~~~--~~--~--~---



Extending Django-cms Menu

2009-08-11 Thread Alessandro Ronchi
I have a django-cms app with this menu:
- Apples
 -> Red Apples
 -> Green Apples
- Oranges
  -> Big oranges
- Lemons
  - New Lemon types

I must add another link (a blog category) to Apples and Oranges first level
menu, to achieve this result:

- Apples
 -> Red Apples
 -> Green Apples
 -> Blog (apples)
- Oranges
  -> Big oranges
  -> Blog (Oranges)
- Lemons
  - New Lemon types

I've tried to extend the category of my blog putting this code:
http://dpaste.com/78219/

this utils:
http://dpaste.com/78220/

and added this setting:

CMS_NAVIGATION_EXTENDERS = (('blog.utils.get_nodes', gettext('Blog')),)

But it doesn't work.

Any ideas?

Any other working example?

Is there a django-cms dedicated mailing list?


-- 
Alessandro Ronchi

SOASI
Sviluppo Software e Sistemi Open Source
http://www.soasi.com

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



Re: Extending Django-cms Menu

2009-08-11 Thread Alessandro Ronchi
2009/8/11 Alessandro Ronchi 

> I have a django-cms app with this menu:


I've partially solved my problem.
but it doesn't get get_title from the model.

It's very strange, because I've followed the documentation example on
http://github.com/digi604/django-cms-2.0/blob/18d184375fdf2e94a5c5a26bbe57a2b980a6addd/cms/docs/navigation.md



-- 
Alessandro Ronchi

SOASI
Sviluppo Software e Sistemi Open Source
http://www.soasi.com

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



Re: Using models inside settings.py

2009-08-21 Thread Alessandro Ronchi

2009/8/21 Alessandro Ronchi :
>
> one thing like that :
> from PROJECT_ROOT.local_settings import *
>
> Thanks in advance

I correct myself:

I need PROJECT_NAME to import, not the project root.

I can then import it with

exec "from " + settings.PROJECT_NAME +".local_cms_settings import *"

is there another way to get the project name without hardcoding it to settings?


-- 
Alessandro Ronchi

SOASI
Sviluppo Software e Sistemi Open Source
http://www.soasi.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
-~--~~~~--~~--~--~---



Using models inside settings.py

2009-08-21 Thread Alessandro Ronchi

I need to write a setting in my settings.py that uses my model, but
it's not possible to load models inside settings.py

So I need to import a custom local_settings.py to be loaded by my app.

It should be simple:
from myapp.settings import *

but I want to remove "myapp" to that import, because I don't know how
my app will be called.

with
PROJECT_ROOT = os.path.dirname(os.path.realpath(__file__))

I can know how my project is called, but I don't know hot to load a
file from that root with an import. is it possible?

one thing like that :
from PROJECT_ROOT.local_settings import *

Thanks in advance

-- 
Alessandro Ronchi

SOASI
Sviluppo Software e Sistemi Open Source
http://www.soasi.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
-~--~~~~--~~--~--~---



Get project name

2009-08-21 Thread Alessandro Ronchi

Is there any way to get the project name that's running in the code?

Now I use a manual setting: PROJECT_NAME = "ambiente"
but it should be useful to avoid that, because I'm working on an
external app and every new unuseful configuration simplify my life a
lot.

-- 
Alessandro Ronchi

SOASI
Sviluppo Software e Sistemi Open Source
http://www.soasi.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
-~--~~~~--~~--~--~---



fckeditor upload file security

2009-08-24 Thread Alessandro Ronchi

I must use fckeditor file upload but I want it to be possible only for
django staff authenticated users.

I'm using mod_python inside apache, is it possible ?



-- 
Alessandro Ronchi

SOASI
Sviluppo Software e Sistemi Open Source
http://www.soasi.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
-~--~~~~--~~--~--~---



context processors in 404 errors

2009-09-01 Thread Alessandro Ronchi
When I return a 500 error I need to have my context_processor, in which I
store some important vars used in my template. Is it possible?

-- 
Alessandro Ronchi

SOASI
Sviluppo Software e Sistemi Open Source
http://www.soasi.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
-~--~~~~--~~--~--~---



dynamic url pattern

2009-03-26 Thread Alessandro Ronchi
I want to make a regxep in my urls.py that takes the name of the view from
the url.
Something like:


(r'^views/(?P\w+)/', 'myproject.database.reports.' + name),

is it possible? I've a lot of views with the same rule and I want to make
them be available without duplicate names 3 or 4 times.

Thanks in advance!

-- 
Alessandro Ronchi
Skype: aronchi
http://www.alessandroronchi.net

SOASI Soc.Coop. - www.soasi.com
Sviluppo Software e Sistemi Open Source
Sede: Via Poggiali 2/bis, 47100 Forlì (FC)
Tel.: +39 0543 798985 - Fax: +39 0543 579928

Rispetta l'ambiente: se non ti è necessario, non stampare questa mail

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



Django admin js loads also on lists

2009-04-21 Thread Alessandro Ronchi

I'm using fckeditor to edit some fields of my model.
Once in admin.py I added

class Media:
js = ('fckeditor/fckeditor.js',
'fckeditor/custom/impresa_legacoop_fc_it.js')

and in the second I replace the textarea "descrizione" with an fckeditor one.

Now the javascript loads also for the object list in admin, which has
no "descrizione" and generates a warning popup.

is it possible to load a js only on object modification form?

Thanks in advance.

-- 
Alessandro Ronchi
Skype: aronchi
http://www.alessandroronchi.net

SOASI Soc.Coop. - www.soasi.com
Sviluppo Software e Sistemi Open Source
Sede: Via Poggiali 2/bis, 47100 Forlì (FC)
Tel.: +39 0543 798985 - Fax: +39 0543 579928

Rispetta l'ambiente: se non ti è necessario, non stampare questa mail

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



AutoField

2009-05-15 Thread Alessandro Ronchi

I want an autofield that shows the content in admin.

If I put an autofield it's hidden, if I put an IntegerField it doesn't
have a new automatic default value.

Is there a solution?

-- 
Alessandro Ronchi
Skype: aronchi
http://www.alessandroronchi.net

SOASI Soc.Coop. - www.soasi.com
Sviluppo Software e Sistemi Open Source
Sede: Via Poggiali 2/bis, 47100 Forlì (FC)
Tel.: +39 0543 798985 - Fax: +39 0543 579928

Rispetta l'ambiente: se non ti è necessario, non stampare questa mail

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



template modules like joomla

2009-09-15 Thread Alessandro Ronchi

I need to give the possibility to the administrator to manage portions
of templates in pages, and let him to change that portions for every
page.
Joomla does this thing with modules: I need something similar. Is it possible?

-- 
Alessandro Ronchi

SOASI
Sviluppo Software e Sistemi Open Source
http://www.soasi.com

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



Re: template modules like joomla

2009-09-15 Thread Alessandro Ronchi

2009/9/15 Randy Barlow :
>
> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA1
>
> Alessandro Ronchi declared:
>> I need to give the possibility to the administrator to manage portions
>> of templates in pages, and let him to change that portions for every
>> page.
>> Joomla does this thing with modules: I need something similar. Is it 
>> possible?
>
> Store your templates in the DB!

Do you have any example / documentation?

-- 
Alessandro Ronchi

SOASI
Sviluppo Software e Sistemi Open Source
http://www.soasi.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
-~--~~~~--~~--~--~---



Flatpage on first page of a website

2009-10-16 Thread Alessandro Ronchi

I need to put a flatpage on /
and make www.example.com
return the flatpage.

Is it possible? What url must I put in flatpage admin?

-- 
Alessandro Ronchi

SOASI
Sviluppo Software e Sistemi Open Source
http://www.soasi.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
-~--~~~~--~~--~--~---



static models methods

2009-10-26 Thread Alessandro Ronchi

I need to create a static method for a model class like this. The line
Settore.objects.all()[0].id gives error  (
psycopg2.InternalError: current transaction is aborted) when creating
the tables at first syncdb. What's the correct way to do that?

~
class Settore(models.Model):
nome = models.CharField(max_length=200, blank=False, null=False)
email = models.EmailField()

class Meta:

verbose_name_plural = 'settori'
ordering = ('nome',)
get_latest_by = "nome"

def __unicode__(self):
return self.nome

@staticmethod
def get_default():
try:
return Settore.objects.all()[0].id
except:
return None
~~~~~
-- 
Alessandro Ronchi

SOASI
Sviluppo Software e Sistemi Open Source
http://www.soasi.com
http://www.linkedin.com/in/ronchialessandro

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



Internal error on dreamhost when debug=False

2009-10-29 Thread Alessandro Ronchi
I don't know why this site:
http://www.portaleaziende-bih.com/

works with debug=True, but If I put debug =False it gives a 500 internal
error.

I'm using mod_passenger on dreamhost. Logs just says
[Thu Oct 29 07:02:38 2009] [error] [client x] Premature end of script
headers: internal_error.html

What can I check to find the problem?

-- 
Alessandro Ronchi

SOASI
Sviluppo Software e Sistemi Open Source
http://www.soasi.com
http://www.linkedin.com/in/ronchialessandro

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



Inlines and foreign key

2009-10-29 Thread Alessandro Ronchi
I've made a Profile model (Socio) for my users and now I need to be able to
edit the users detail in profile model in admin.

THe problem is that I can add an Inline only from User to Profile, because
User doesn't have a foreign key to profile.

It's very odd: I cannot add the inline in the model that holds the foreign
key, but I can do that on the referred model.

Is there any way to put my simple one to one related model (with foreign
key) in my Socio profile model admin page?

With Socio inside User I cannot search inside user profile fields in
admin_list, this is the problem.

 this is my model http://dpaste.com/113759/
and this is my admin:
http://dpaste.com/113758/


thanks in advance, best regards.

-- 
Alessandro Ronchi

SOASI
Sviluppo Software e Sistemi Open Source
http://www.soasi.com
http://www.linkedin.com/in/ronchialessandro

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



Re: Inlines and foreign key

2009-10-31 Thread Alessandro Ronchi
On Fri, Oct 30, 2009 at 12:03 AM, Matt Schinckel
wrote:

>
>
> My solution was to have a custom PersonAdminForm, which allows for
> setting of the username and password (and validates these, creating a
> new user if one was not previously attached).  This form is then
> attached to the PersonAdmin class.
>
>
Another simple solutions may be to have a link to edit the foreign key model
in another page (maybe a popup), instead of only choice existing one or add
them. Is it possible?



-- 
Alessandro Ronchi

SOASI
Sviluppo Software e Sistemi Open Source
http://www.soasi.com
http://www.linkedin.com/in/ronchialessandro

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



unique_for_date

2009-11-04 Thread Alessandro Ronchi

unique_for_date checks only the date in a datetime field or also for the time?

-- 
Alessandro Ronchi

SOASI
Sviluppo Software e Sistemi Open Source
http://www.soasi.com
http://www.linkedin.com/in/ronchialessandro

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



Django on Dreamhost internal server error

2009-11-16 Thread Alessandro Ronchi
If I put Debug = False in my django settings.py I receive an internal
server error with no explanation.

I'm using mod_passenger.

What can cause the problem? Is there any way I can debug the error or
get more information? Dreamhost cannot answer me, maybe someone got
similar esperience.


-- 
Alessandro Ronchi

SOASI
Sviluppo Software e Sistemi Open Source
http://www.soasi.com
http://www.linkedin.com/in/ronchialessandro

--

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




mod_wsgi django optimization

2009-11-18 Thread Alessandro Ronchi
I'm running several django applications on different vhosts on a virtual
server.
In that virtual server  I have enough ram and cpu and I want to get the
fastest configuration for mod_wsgi.

I don't have much cuncurrent users on the same virtual host, but I have a
lot of files for every page so I should try to optimize page loading

Now I'm using
processes=2 maximum-requests=500 threads=25

with no particular apache optimization.

Do you have any advice?

-- 
Alessandro Ronchi

SOASI
Sviluppo Software e Sistemi Open Source
http://www.soasi.com
http://www.linkedin.com/in/ronchialessandro

--

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: mod_wsgi django optimization

2009-11-18 Thread Alessandro Ronchi
On Wed, Nov 18, 2009 at 10:29 PM, Graham Dumpleton <
graham.dumple...@gmail.com> wrote:

>
> Yes, don't be so concerned in the first instance of trying to squeeze
> the most out of mod_wsgi configuration. You will get much more
> dramatic gains by improving your database queries/performance and page/
> data caching techniques.
>
> Placing a nginx front end proxy in front of Apache/mod_wsgi to handle
> static files also has benefits beyond just static file sharing.
>
> So, what have you done in those areas to improve performance?
>
> In other words, you should perhaps be asking about how to improve your
> Django application performance rather than worrying about the hosting
> system, as the hosting system is nearly always not going to be the
> bottle neck in all of this.


I'm using memcached and it's quite optimized I think.
Good advice the ngix, but If it's possible I don't want to add another
webserver. So, I want to get the most out of apache, where I can.


-- 
Alessandro Ronchi

SOASI
Sviluppo Software e Sistemi Open Source
http://www.soasi.com
http://www.linkedin.com/in/ronchialessandro

--

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




Internal server error 500 with mod_wsgi

2009-11-18 Thread Alessandro Ronchi
With mod_wsgi I only get error logged into apache and not on the interactive
trackback in the browser, also If i set DEBUG=True in my settings.

Is there any way to handle the django trackback as usual?

-- 
Alessandro Ronchi

SOASI
Sviluppo Software e Sistemi Open Source
http://www.soasi.com
http://www.linkedin.com/in/ronchialessandro

--

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




Re: Internal server error 500 with mod_wsgi

2009-11-18 Thread Alessandro Ronchi
On Thu, Nov 19, 2009 at 12:48 AM, Alessandro Ronchi <
alessandro.ron...@soasi.com> wrote:

> With mod_wsgi I only get error logged into apache and not on the
> interactive trackback in the browser, also If i set DEBUG=True in my
> settings.
>
> Is there any way to handle the django trackback as usual?
>

mod_wsgi also doesn't send me the email of errors. I really need them. Is it
possible to make python send me an email of every internal error also with
mod_wsgi?

-- 
Alessandro Ronchi

SOASI
Sviluppo Software e Sistemi Open Source
http://www.soasi.com
http://www.linkedin.com/in/ronchialessandro

--

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




Re: Internal server error 500 with mod_wsgi

2009-11-18 Thread Alessandro Ronchi
On Thu, Nov 19, 2009 at 1:08 AM, Graham Dumpleton <
graham.dumple...@gmail.com> wrote:

>
>
> On Nov 19, 10:48 am, Alessandro Ronchi 
> wrote:
> > With mod_wsgi I only get error logged into apache and not on the
> interactive
> > trackback in the browser, also If i set DEBUG=True in my settings.
> >
> > Is there any way to handle the django trackback as usual?
>
> Is the error definitely from Django and if so from what part of
> Django?
>
> Perhaps post example of traceback.
>
> Have you looked at 'DEBUG_PROPAGATE_EXCEPTIONS' setting.
>
>
> http://docs.djangoproject.com/en/dev/ref/settings/#debug-propagate-exceptions
>
> Also check over comments against:
>
> http://docs.djangoproject.com/en/dev/ref/settings/#debug
>
> and when tracebacks may be suppressed.
>


http://dpaste.com/122205/
is my log file.

I don't used DEBUG_PROPAGATE_EXCEPTIONS
but as far as I understand it defaults to False, so Django should handle the
error with usual trackback, also with mod_wsgi?

this is my vhost.conf (i'm using plesk):
http://dpaste.com/122208/

and this is my wsgi app:
http://dpaste.com/122209/

-- 
Alessandro Ronchi

SOASI
Sviluppo Software e Sistemi Open Source
http://www.soasi.com
http://www.linkedin.com/in/ronchialessandro

--

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




Re: Internal server error 500 with mod_wsgi

2009-11-18 Thread Alessandro Ronchi
On Thu, Nov 19, 2009 at 2:02 AM, Karen Tracey  wrote:

> On Wed, Nov 18, 2009 at 7:29 PM, Alessandro Ronchi <
> alessandro.ron...@soasi.com> wrote:
>
>>
>>
>> http://dpaste.com/122205/
>> is my log file.
>>
>>
> Traceback shows it is dying during the load of middleware.  You would not
> get a pretty debug page for this even with DEBUG=True and running the
> development server: you'd get a bare traceback, which is what you see in the
> Apache log.  This is code that is not covered by the
> exception-catching-turn-it-into-a-pretty-page try/except block.  Ultimately
> it says (stripping out the referrer and leading timestamp, etc):
>
>File "/var/www/vhosts/
> hobbygiochi.com/django/satchmo_src/satchmo/apps/livesettings/functions.py",
> line 67, in get_config
>  raise SettingNotSet('%s config group does not exist' % group),
> SettingNotSet: 
>


I get the same problem also with an Assert False (a typical debug symbol
I've used with mod_python).

http://dpaste.com/16/

no browser and no email, only logs.

-- 
Alessandro Ronchi

SOASI
Sviluppo Software e Sistemi Open Source
http://www.soasi.com
http://www.linkedin.com/in/ronchialessandro

--

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




Re: Internal server error 500 with mod_wsgi

2009-11-19 Thread Alessandro Ronchi
>
>
> Really, you can get both pretty debug pages and emails with mod_wsgi as
> well as you can with the development server or mod_python.  I've seen both.
> The problem with both exception traces you have shown is that the exception
> is occurring too early in the processing -- neither of these exceptions you
> have posted would ever result in a debug page or an error email, regardless
> of deployment setup.
>
>
You're right.
I dont' understand why the trackback refers to another project django
source. the pythonpath is correct in django.wsgi and empty in shell.

Is there something wrong?

-- 
Alessandro Ronchi

SOASI
Sviluppo Software e Sistemi Open Source
http://www.soasi.com
http://www.linkedin.com/in/ronchialessandro

--

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




Re: Internal server error 500 with mod_wsgi

2009-11-19 Thread Alessandro Ronchi
On Thu, Nov 19, 2009 at 5:28 PM, Alessandro Ronchi <
alessandro.ron...@soasi.com> wrote:

>
>> Really, you can get both pretty debug pages and emails with mod_wsgi as
>> well as you can with the development server or mod_python.  I've seen both.
>> The problem with both exception traces you have shown is that the exception
>> is occurring too early in the processing -- neither of these exceptions you
>> have posted would ever result in a debug page or an error email, regardless
>> of deployment setup.
>>
>>
> You're right.
> I dont' understand why the trackback refers to another project django
> source. the pythonpath is correct in django.wsgi and empty in shell.
>
> Is there something wrong?
>

as you can see here:
http://dpaste.com/122437/

my python path is correct, but the trackback points to another django
directory.




-- 
Alessandro Ronchi

SOASI
Sviluppo Software e Sistemi Open Source
http://www.soasi.com
http://www.linkedin.com/in/ronchialessandro

--

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




Re: Internal server error 500 with mod_wsgi

2009-11-21 Thread Alessandro Ronchi
On Thu, Nov 19, 2009 at 7:26 PM, Karen Tracey  wrote:

>
>
> So I guess you are looking to pull django and satchmo out of
> /var/www/vhosts/hobbygiochi.com/django/, not /var/www/vhosts/
> detectorpoint.com/django/.  I'd guess the detectorpoint.com paths are
> already in sys.path when your wsgi script runs, and they aren't being
> over-ridden because you append to the existing path instead of putting the
> paths you are adding in front.
>
>
I thought the same thing, but this is my python path as django error
trackback:

['/var/www/vhosts/hobbygiochi.com/django/projects/', '/var/www/vhosts/
hobbygiochi.com/django/django_src/', '/var/www/vhosts/
hobbygiochi.com/django/satchmo_src/', '/var/www/vhosts/
hobbygiochi.com/django/libraries/',
'/usr/lib/python2.4/site-packages/setuptools-0.6c9-py2.4.egg',
'/usr/lib/python2.4/site-packages/MySQL_python-1.2.2-py2.4-linux-i686.egg',
'/usr/lib/python2.4/site-packages/pycrypto-2.0.1-py2.4-linux-i686.egg',
'/usr/lib/python24.zip', '/usr/lib/python2.4',
'/usr/lib/python2.4/plat-linux2', '/usr/lib/python2.4/lib-tk',
'/usr/lib/python2.4/lib-dynload', '/usr/lib/python2.4/site-packages',
'/usr/lib/python2.4/site-packages/Numeric',
'/usr/lib/python2.4/site-packages/PIL',
'/usr/lib/python2.4/site-packages/gtk-2.0']

is it possible that different apache vhosts share the same pythonpath also
if configuration is different?
how can I check that?

-- 
Alessandro Ronchi

SOASI
Sviluppo Software e Sistemi Open Source
http://www.soasi.com
http://www.linkedin.com/in/ronchialessandro

--

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




Django tag cloud

2009-11-21 Thread Alessandro Ronchi
I have a model with with a variable number of objects.

I want to make a tag cloud with font-size to be a proportion of
objects.count() (wich goes from 1 to 150 ).

Obviously I can't use that number in font-size (150pt is too big) and
I have to make a proportion (150 -> 20pt, 1 -> 5pt, 50 ~>10pt and so
on).

How can I accomplish that?

-- 
Alessandro Ronchi

SOASI
Sviluppo Software e Sistemi Open Source
http://www.soasi.com
http://www.linkedin.com/in/ronchialessandro

--

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




Translate models

2009-11-25 Thread Alessandro Ronchi
I need to make my model translatable into different languages.
Is there any simple way to handle that in a transparent manner?
I've fround transmeta project on google, anyone is using that?

-- 
Alessandro Ronchi

SOASI
Sviluppo Software e Sistemi Open Source
http://www.soasi.com
http://www.linkedin.com/in/ronchialessandro

--

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 tag cloud

2009-11-26 Thread Alessandro Ronchi
On Sat, Nov 21, 2009 at 4:09 PM, Carlos Ricardo Santos <
carlosricardosan...@gmail.com> wrote:

> I used this approach, was explained on "Learning website development with
> Django book", give a look there:
> *
> *
> *
> *
> *style.css *file:
> *
> *
> .tag-cloud-0 { font-size: 100%; }
> .tag-cloud-1 { font-size: 120%; }
> .tag-cloud-2 { font-size: 140%; }
> .tag-cloud-3 { font-size: 160%; }
> .tag-cloud-4 { font-size: 180%; }
>  .tag-cloud-5 { font-size: 200%; }
>
> And generated the tag number dynamically counting the objects that has that
> tag.
>
>
But in that way I must add some code to the model, wjere I can write exactly
the font-size.
I need something similar to widthratio but with a minimum value (or maybe
there is a way to make the littler sets not to 0 font-size).



-- 
Alessandro Ronchi

SOASI
Sviluppo Software e Sistemi Open Source
http://www.soasi.com
http://www.linkedin.com/in/ronchialessandro

--

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 tag cloud

2009-12-02 Thread Alessandro Ronchi
On Thu, Nov 26, 2009 at 10:22 PM, Nick Arnett  wrote:

> What you need is called data normalization - fitting data to a desired scale
> - in statistics and analysis.
>
> Here's a general page about normalization:
>
> http://www.qsarworld.com/qsar-statistics-normalization.php
>
> I'd imagine that there's a Python library or module that will do this for
> you, but it's not hard to write your own.

I've done a simple custom template tag to have my cloud working :)

-- 
Alessandro Ronchi

http://www.soasi.com
SOASI - Sviluppo Software e Sistemi Open Source

http://hobbygiochi.com
Hobby & Giochi, l'e-commerce del divertimento

--

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.




Paginated objects in django sitemap

2009-12-05 Thread Alessandro Ronchi
I have some objects that needs to be paginated . I want to get all my pages
on my sitemap.
Is there any smart way to make items(self) returns all the pages for that
objects and not only the get_absoute_url without page= get variable?

-- 
Alessandro Ronchi

http://www.soasi.com
SOASI - Sviluppo Software e Sistemi Open Source

http://hobbygiochi.com
Hobby & Giochi, l'e-commerce del divertimento

--

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.




basic http authentication

2009-12-12 Thread Alessandro Ronchi
I need to make a view with a basic html authentication (because I need to
use that url in a program that parse the result).

I need to authenticate against the check of a permission.

What's the best way to do that?

-- 
Alessandro Ronchi

http://www.soasi.com
SOASI - Sviluppo Software e Sistemi Open Source

http://hobbygiochi.com
Hobby & Giochi, l'e-commerce del divertimento

--

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.




ckfinder with django

2009-12-21 Thread Alessandro Ronchi
Has someone managed to use ckfinder with django ? I want only staff
users of my apps to be able to upload files, is it possible?

-- 
Alessandro Ronchi

http://www.soasi.com
SOASI - Sviluppo Software e Sistemi Open Source

http://hobbygiochi.com
Hobby & Giochi, l'e-commerce del divertimento

--

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.




Generate brochure pdf

2010-04-20 Thread Alessandro Ronchi
I need to create some brochures on the fly (with texts and images with
different position from my templates) in pdf with django.
What's the best solution?
Reportlab?

I don't have any license problem (I can buy the software if it suites
my needs),  and I must generate quality pdf (for use in typography)
with a some images (raster and bitmap) in my web application.

I want to use django as web framework.

Any use case? Or documentation I can read?

Thanks in advance, best regards.
-- 
Alessandro Ronchi

http://www.soasi.com
SOASI - Sviluppo Software e Sistemi Open Source

-- 
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: Generate brochure pdf

2010-04-21 Thread Alessandro Ronchi
2010/4/20 cootetom :
> django and and pisa are great for creating PDF's because you can
> combine django's templating engine with pisa's HTML to PDF conversion.
> Pisa uses the reportlab tool kit. http://pypi.python.org/pypi/pisa/

I think I can't use PISA because I need the pdf to be precise as
pixels, and HTML is not the best solution for that.



-- 
Alessandro Ronchi

http://www.soasi.com
SOASI - Sviluppo Software e Sistemi Open Source

Hobby & Giochi, l'e-commerce del divertimento
http://hobbygiochi.com
http://www.facebook.com/pages/Forli/Hobby-Giochi/185311523755

-- 
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: Generate brochure pdf

2010-04-21 Thread Alessandro Ronchi
I need to give the user some jpg previews of the results. What's the
lightest way to do that? I think reportlab or tex/latex  are my only
choices.

I made my university thesis on latex, and I remember some problems
with encoding (solved, finally, with utf8) and graphics to include.

I really don't need to make books, but simple 2-4 pages with a lot of graphics.
A sort of www.stiqr.com but for printing.

I've found someone is using Cairo Library (http://cairographics.org)
but I think it's too low level and maybe I can have some problems with
texts.

by the way, do you know any wysiwyg javascript (jquery or prototype)
like the one in stiqr.com I can re-use?

I need something to let users position objects in my brochure, and get
positions and other editor informations to create pdfs.



-- 
Alessandro Ronchi

http://www.soasi.com
SOASI - Sviluppo Software e Sistemi Open Source

Hobby & Giochi, l'e-commerce del divertimento
http://hobbygiochi.com
http://www.facebook.com/pages/Forli/Hobby-Giochi/185311523755

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



Template tag to understand if a request if from a spider

2010-04-27 Thread Alessandro Ronchi
Is it possible to check in a django template if a request is from a spider/
bot or not?


-- 
Alessandro Ronchi

http://www.soasi.com
SOASI - Sviluppo Software e Sistemi Open Source

Hobby & Giochi, l'e-commerce del divertimento
http://hobbygiochi.com
http://www.facebook.com/pages/Forli/Hobby-Giochi/185311523755

-- 
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 custom sidebar to admin site

2010-04-29 Thread Alessandro Ronchi
I need to add some custom links to sidebar in admin section.
What's the cleaner way to make that?

I can only override the index.html template?

-- 
Alessandro Ronchi

http://www.soasi.com
SOASI - Sviluppo Software e Sistemi Open Source

Hobby & Giochi, l'e-commerce del divertimento
http://hobbygiochi.com
http://www.facebook.com/pages/Forli/Hobby-Giochi/185311523755

-- 
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 an email to users after saving is_active=True

2010-05-08 Thread Alessandro Ronchi
2010/5/4 zinckiwi 

> On May 4, 9:49 am, Sander  wrote:
> > I don't want to check if if_active = True
> > I wan't to check if if_active is changed to True
>
> If you use the pre_save signal, you can get the object as it currently
> exists (based in the signalled instance's pk) and compare the existing
> object's `is_active` with the signalled instance's `is_active`. Of
> course, then you run into the problem of the email being sent even if
> the save itself fails, so you might then want to figure out a way of
> persisting a flag from pre_save (which determines whether an email
> should be sent) to post_save (which does the sending). Might be over-
> engineering it, though.
>


I solved with this code:
http://dpaste.com/192120/
and

pre_save.connect(account_moderated_email, sender=Profile)

-- 
Alessandro Ronchi

http://www.soasi.com
SOASI - Sviluppo Software e Sistemi Open Source

Hobby & Giochi, l'e-commerce del divertimento
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.



Localeurl and django-multilingual

2010-05-08 Thread Alessandro Ronchi
I need to have links with language code prefix, and different contents.

I've achieved that with both localeurl and django-multilingual, and I can
get the tranlated version if i choice the correct url:
for example http://mydomain.com/it/c/auto-intere/1/ and
http://mydomain.com/pl/c/auto-intere/1/

but if I open http://mydomain.com/pl/c/auto-intere/1/
all the next link will redirect back to /it/

So, I need to fix the user choice and set it to the user request language.

Is it possible?
How?

-- 
Alessandro Ronchi

http://www.soasi.com
SOASI - Sviluppo Software e Sistemi Open Source

Hobby & Giochi, l'e-commerce del divertimento
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: Localeurl and django-multilingual

2010-05-10 Thread Alessandro Ronchi
2010/5/10 Nuno Maltez 

> How are you creating the url for the links? Are you using the {% url
> %} tag and reverse() functions? It should work, we have sites with
> localeurl and django-multilingual running fine in production.
>
>
I solved with your solution. Thanks.



-- 
Alessandro Ronchi

http://www.soasi.com
SOASI - Sviluppo Software e Sistemi Open Source

Hobby & Giochi, l'e-commerce del divertimento
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.



μ must be μ

2010-07-12 Thread Alessandro Ronchi
I want django to return  μ  instead of the html enscaped form μ in my
views, because I need it to return a reportlab template wich doesn't handle
the escaped version.
I already have an unicode template and unicode output, so I only those
characters not to convert to their HTML version.

Is it possible?
How?

Thanks in advance,
-- 
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: μ must be μ

2010-07-13 Thread Alessandro Ronchi
2010/7/12 Martin Melin 

> 2010/7/12 Alessandro Ronchi :
> > I want django to return  μ  instead of the html enscaped form μ in my
> > views, because I need it to return a reportlab template wich doesn't
> handle
> > the escaped version.
> > I already have an unicode template and unicode output, so I only those
> > characters not to convert to their HTML version.
>
> Isn't this simply the matter of running it through the template tag
> "safe"? {{ your_output_string|safe }} should output the unicode data
> verbatim.
>

I'm already using safe. Maybe the problem is that the standard pdf character
μ is missing... I will try some tests.
Thanks in advance.

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



ManyToMany to languages

2010-07-30 Thread Alessandro Ronchi
I need to put a manytomany that points to a list of languages.
I need to create another language model or I can use a django languages one?

-- 
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: Admin Inline inside another admin inline

2010-08-04 Thread Alessandro Ronchi
2010/7/3 Sean Brant 

>
> Im not even sure if this is best way to display things, I would like
> one main product edit screen that lets you attach "product types"
> which have "sizes" to a "product", it seems jumping between a bunch of
> screens is not good ux. Wondering if I need to create a custom view
> for this? Thanks for any help.
>

It's not possible to make nested inline.
I'm trying to do the same thing, with this solution:
http://packages.python.org/django-easymode/tree/index.html?highlight=inline#admin-support-for-model-trees-with-more-than-2-levels-of-related-items

But it doesn't work.
-- 
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.



Jquery-ui in admin: c is undefined

2010-08-05 Thread Alessandro Ronchi
If I load jquery-ui (a custom full download) in my admin I get this script
error:
c is undefined

If I load 2 times jquery with

~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
class Media:
js = (
settings.MEDIA_URL + 'admin/jquery-ui/js/jquery-1.4.2.min.js',
settings.MEDIA_URL +
'admin/jquery-ui/js/jquery-ui-1.8.2.custom.min.js',

)
~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
It works.
There is no diff between my settings.MEDIA_URL +
'admin/jquery-ui/js/jquery-1.4.2.min.js', and
django/contrib/admin/media/js/jquery-min.js
but the first come after jquery.init.js

// Puts the included jQuery into our own namespace
var django = {
"jQuery": jQuery.noConflict(true)
};

Is there a way to avoid attaching two times the same jquery library in
admin?

Thanks in advance,

-- 
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: Jquery-ui in admin: c is undefined

2010-08-05 Thread Alessandro Ronchi
2010/8/5 David De La Harpe Golden :

>
> In theory you could probably "re-conflict" it, i.e. grab the
> django.jQuery and put it back into the global scope as
>  Query (and maybe $ - jquery-ui uses jQuery) ...but I wouldn't
> recommend it, just look at the admin jquery as an implementation detail
> and supply your own for your own uses.


It's not possible to tell jquery-ui to use the  django.query namespace?


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



Deploying application media files

2010-08-06 Thread Alessandro Ronchi
I have always used a symbolic link to deploy with apache all my django
libraries media files.
But now I need a more solid way to deploy those files, without
concerning about symlinks I need to make after libraries install.

What solution do you use? Apache aliases?
As far as I know, it's not possible to serve static files from inside
an egg file. It would be very nice to pack a library (like, for
example, filebrowser), and have python unpack it on cache and serve
also javascript and image files.

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.



Re: Deploying application media files

2010-08-06 Thread Alessandro Ronchi
2010/8/6 Reinout van Rees :

> Yes, it is :-)  Django-staticfiles is an application that can do it for you.
...
> Note: at djangocon.eu in Berlin, there were voices to make this
> django-staticfiles solution standard in django 1.3.

I'll try that. I think it's the perfect solution, and I hope it will
become standard in next django.

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



extends templates with the same name

2010-08-06 Thread Alessandro Ronchi
It's useful to have some templates with the same name of another one,
like you can do with YOURPROJECT/templates/admin/base_site.html that
override the base site django default.
but If I want to add a word in the title of my base_site.html I need
to copy the entire content of the base_site.html I am overriding, and
I cannot extend it to avoid that with am {% extend
"admin/templates/base_site.html" %}
or an {% extend super %}

I wrote a custom base_site.html with some common code for all my projects.
Now I need an app to add a single template_tag in a block. Is it
possible without copying ALL the previous base_site?
I cannot change the name of the parent template, or admin will not use
it when I don't install that app.

I moved
YOURPROJECT/templates/admin/base_site.html
to
YOURPROJECT/templates/admin/_base_site.html

and created an empty
YOURPROJECT/templates/admin/base_site.html
with only
{% extends "_base_site.html" %}

but it's not clean.

Is there any other cleaner way to do that?

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



  1   2   >