[mezzanine-users] Filter content in \mezzanine\page\admin.py

2015-07-21 Thread Rafael Cabral
Hi,

i'm trying to filter content on \mezzanine\page\admin.py, my method 
queryset is executed,
but the items removed from de query continue showing on the list view


class PageAdmin(DisplayableAdmin):

Admin class for the ``Page`` model and all subclasses of
``Page``. Handles redirections between admin interfaces for the
``Page`` model and its subclasses.


fieldsets = page_fieldsets

def queryset(self, request):
qs = super(PageAdmin, self).queryset(request)
from django.db.models import Q
query = qs.filter(~Q(content_model = 'hotsite'))
return query

.
.
.
.

-- 
You received this message because you are subscribed to the Google Groups 
Mezzanine Users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to mezzanine-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [mezzanine-users] Re: Support for multiple currencies?

2015-07-21 Thread Stephen McDonald
You're right the way we use setlocale isn't good - in the least, it gets
used to determine the decimal precision of price fields, which can't change
over time.

Maybe we can look at refactoring that as well as adding first-class support
for django-currencies, are you interested in working on that?

On Tue, Jul 21, 2015 at 10:53 PM, vikraw vik...@gmail.com wrote:

 I struggled with it for a while but finally have it working with some
 tweaks (replacing cartridge currency filter with custom) using the
 django-currencies app.
 cartridge has 'currency' filter defined in
 'shop/templatetags/shop_tags.py'-  this filter takes a single argument
 i.e. the value/amount
 django-currencies also has 'currency' filter in
 'currency/templatetags/currency.py' - this filter takes 2 arguments i.e.
 value, currency code  - I ReNamed this to custom-currency
 replaced currency filter with custom-currency filter in all the templates
 - 'a nasty fix but works'

 But I wonder in Cartridge - If locale is set every time currency filter is
 encountered in template;  'cartridge currency' filter code calls
 set_locale() which calls setlocale() which sets the currency locale set in
 settings.py.
 According to django documentation - setlocale is an expensive operation -
 It is generally a bad idea to call setlocale() in some library routine,
 since as a side effect it affects the entire program. Saving and restoring
 it is almost as bad: it is expensive and affects other threads that happen
 to run before the settings have been restored.

 My understanding is that locale should be set once on the server
 assuming a default currency; Then for the end-user the currency (exhange
 rate, symbol, format) should be changed in the template using some session
 variable according to user's currency choice

 Maybe stephen can comment on this.



 On Thursday, May 21, 2015 at 11:55:37 PM UTC+5:30, Ano Nymous wrote:

 Dear all,

 In cartridge, how can I set prices for different currencies?
 E.g. I have a product that has a price in CHF, EUR and USD.
 Users should be able to switch between them, independent of the
 currently selected language.

 Is this possible?

 Thanks,
 Claude

  --
 You received this message because you are subscribed to the Google Groups
 Mezzanine Users group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to mezzanine-users+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/d/optout.




-- 
Stephen McDonald
http://jupo.org

-- 
You received this message because you are subscribed to the Google Groups 
Mezzanine Users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to mezzanine-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[mezzanine-users] Re: Mezzanine 4.0 and multi-language selector not working

2015-07-21 Thread Stephen McDonald
Solution 
here: https://github.com/stephenmcd/mezzanine/issues/1354#issuecomment-123514090

On Saturday, 11 July 2015 08:55:37 UTC+10, David Qixiang Chen wrote:


 Hi I'm building a multi-lingual site in English and zh-TW (traditional 
 chinese) . 
 I configured it according to the docs, and the admin interface does show 
 the fields for both languages. 

 But I can't get the language selector to work. 
 While the default selector shows the languages listed, selecting them 
 still always result in English. 

 My settings: 

 LANGUAGE_CODE = en


 # Supported languages
 LANGUAGES = (
 ('en', _('English')),

 ('zh-tw',_('Traditional Chinese')),
 )




 USE_I18N = True
 USE_L10N = True


 --- 

 If I change my settings to: 

 LANGUAGE_CODE = zh-tw


 # Supported languages
 LANGUAGES = (
 ('zh-tw',_('Traditional Chinese')),
 )


 The Chinese pages will show properly, although the admin page interface 
 becomes Chinese as well. 

 I feel like I'm missing something obvious, please assist. 

 Thanks




-- 
You received this message because you are subscribed to the Google Groups 
Mezzanine Users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to mezzanine-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[mezzanine-users] Re: Support for multiple currencies?

2015-07-21 Thread vikraw
I struggled with it for a while but finally have it working with some 
tweaks (replacing cartridge currency filter with custom) using the 
django-currencies app. 
cartridge has 'currency' filter defined in 'shop/templatetags/shop_tags.py' 
   -  this filter takes a single argument i.e. the value/amount 
django-currencies also has 'currency' filter in 
'currency/templatetags/currency.py' - this filter takes 2 arguments i.e. 
value, currency code  - I ReNamed this to custom-currency
replaced currency filter with custom-currency filter in all the templates - 
'a nasty fix but works'

But I wonder in Cartridge - If locale is set every time currency filter is 
encountered in template;  'cartridge currency' filter code calls 
set_locale() which calls setlocale() which sets the currency locale set in 
settings.py. 
According to django documentation - setlocale is an expensive operation - 
It is generally a bad idea to call setlocale() in some library routine, 
since as a side effect it affects the entire program. Saving and restoring 
it is almost as bad: it is expensive and affects other threads that happen 
to run before the settings have been restored.

My understanding is that locale should be set once on the server assuming 
a default currency; Then for the end-user the currency (exhange rate, 
symbol, format) should be changed in the template using some session 
variable according to user's currency choice

Maybe stephen can comment on this.


On Thursday, May 21, 2015 at 11:55:37 PM UTC+5:30, Ano Nymous wrote:

 Dear all,

 In cartridge, how can I set prices for different currencies?
 E.g. I have a product that has a price in CHF, EUR and USD.
 Users should be able to switch between them, independent of the
 currently selected language.

 Is this possible?

 Thanks,
 Claude


-- 
You received this message because you are subscribed to the Google Groups 
Mezzanine Users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to mezzanine-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.