That’s exactly it. It was kind of obvious for me when I created 
translatable settings that this one should be translatable too. But it was 
less and less as time passed. But we never really discussed about it.

Given how this field and modeltranslation are working, I don't think 
anything will break by letting this setting translatable. However, I don't 
find it useful anymore to keep it that way. It can only make sense if staff 
users are able to provide different prices for different languages. So that 
each language has its own price, own formating, and own currency symbol.

We should either implement the latter or remove the former to avoid 
confusions.


Le lundi 13 juillet 2015 08:19:11 UTC+2, Stephen McDonald a écrit :
>
> Loosely in my head it shouldn't be, since it's something that needs to be 
> coordinated with system administration tasks (installing locale on the 
> server etc).
>
> I'm guessing Mathias made it editable in order to make it translatable, 
> which in theory would allow for multiple currencies - I vaguely recall a 
> conversation around this as well but I don't think we explored it too much. 
>
> Thinking more about it, it probably won't work - the MoneyField (which all 
> monetary values in the DB use) uses the locale to determine the precision 
> of its underlying DecimalField - I'm pretty sure that setup would break in 
> conjunction with modeltranslation.
>
> On Mon, Jul 13, 2015 at 3:11 PM, Danny <[email protected] <javascript:>> 
> wrote:
>
>> Thanks Stephen.
>>
>> Wasn't the SHOP_CURRENCY_LOCALE made editable for a reason? Personally I 
>> don't mind either way, but in the 0.9.5. tag it's not editable, but on 
>> master it was, so I'm assuming that was changed for a reason.
>>
>> Maybe see 
>>
>> https://github.com/stephenmcd/cartridge/commit/79c611bd318ec095073c3b9a729b2bfa7fb4405b#diff-d3220a9516c6f9328cd3c424de02a7ef
>> for the change?
>>
>> Mathias, you made this change, want to comment?
>>
>>
>> Seeya. Danny.
>>
>> On 13 July 2015 at 15:35, Stephen McDonald <[email protected] <javascript:>> 
>> wrote:
>>
>>> Fixed here: 
>>> https://github.com/stephenmcd/cartridge/commit/c6aa87003d41ee203f5070f6601c81b844047e94
>>>
>>> On Mon, Jul 13, 2015 at 2:56 PM, Stephen McDonald <[email protected] 
>>> <javascript:>> wrote:
>>>
>>>> I can confirm this bug - the demo site doesn't hit it as it defines 
>>>> the SHOP_CURRENCY_LOCALE setting in its settings module.
>>>>
>>>> On Sat, Jul 11, 2015 at 11:49 AM, Danny <[email protected] <javascript:>
>>>> > wrote:
>>>>
>>>>> Hi all,
>>>>>
>>>>> I was wondering if anyone could help me!
>>>>>
>>>>> I've tried the new Mezzanine 4.0 release with cartridge master (which 
>>>>> Stephen said should work) and am getting AppRegistryNotReady exception 
>>>>> from 
>>>>> shop.models.Priced():
>>>>>
>>>>> BACKTRACE:
>>>>> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>>>>> /home/danny/.virtualenvs/mez4/local/lib/python2.7/site-packages/mezzanine/utils/conf.py:51:
>>>>>  
>>>>> UserWarning: You haven't defined the ALLOWED_HOSTS settings, which Django 
>>>>> requires. Will fall back to the domains configured as sites.
>>>>>   warn("You haven't defined the ALLOWED_HOSTS settings, which "
>>>>> /home/danny/.virtualenvs/mez4/local/lib/python2.7/site-packages/mezzanine/generic/fields.py:6:
>>>>>  
>>>>> RemovedInDjango19Warning: django.contrib.contenttypes.generic is 
>>>>> deprecated 
>>>>> and will be removed in Django 1.9. Its contents have been moved to the 
>>>>> fields, forms, and admin submodules of django.contrib.contenttypes.
>>>>>   from django.contrib.contenttypes.generic import GenericRelation
>>>>>
>>>>> Traceback (most recent call last):
>>>>>   File "manage.py", line 14, in <module>
>>>>>     execute_from_command_line(sys.argv)
>>>>>   File 
>>>>> "/home/danny/.virtualenvs/mez4/local/lib/python2.7/site-packages/django/core/management/__init__.py",
>>>>>  
>>>>> line 338, in execute_from_command_line
>>>>>     utility.execute()
>>>>>   File 
>>>>> "/home/danny/.virtualenvs/mez4/local/lib/python2.7/site-packages/django/core/management/__init__.py",
>>>>>  
>>>>> line 312, in execute
>>>>>     django.setup()
>>>>>   File 
>>>>> "/home/danny/.virtualenvs/mez4/local/lib/python2.7/site-packages/django/__init__.py",
>>>>>  
>>>>> line 18, in setup
>>>>>     apps.populate(settings.INSTALLED_APPS)
>>>>>   File 
>>>>> "/home/danny/.virtualenvs/mez4/local/lib/python2.7/site-packages/django/apps/registry.py",
>>>>>  
>>>>> line 108, in populate
>>>>>     app_config.import_models(all_models)
>>>>>   File 
>>>>> "/home/danny/.virtualenvs/mez4/local/lib/python2.7/site-packages/django/apps/config.py",
>>>>>  
>>>>> line 198, in import_models
>>>>>     self.models_module = import_module(models_module_name)
>>>>>   File "/usr/lib/python2.7/importlib/__init__.py", line 37, in 
>>>>> import_module
>>>>>     __import__(name)
>>>>>   File 
>>>>> "/home/danny/.virtualenvs/mez4/src/cartridge/cartridge/shop/models.py", 
>>>>> line 35, in <module>
>>>>>     class Priced(models.Model):
>>>>>   File 
>>>>> "/home/danny/.virtualenvs/mez4/src/cartridge/cartridge/shop/models.py", 
>>>>> line 41, in Priced
>>>>>     unit_price = fields.MoneyField(_("Unit price"))
>>>>>   File 
>>>>> "/home/danny/.virtualenvs/mez4/src/cartridge/cartridge/shop/fields.py", 
>>>>> line 46, in __init__
>>>>>     set_locale()
>>>>>   File 
>>>>> "/home/danny/.virtualenvs/mez4/src/cartridge/cartridge/shop/utils.py", 
>>>>> line 
>>>>> 103, in set_locale
>>>>>     currency_locale = str(settings.SHOP_CURRENCY_LOCALE)
>>>>>   File 
>>>>> "/home/danny/.virtualenvs/mez4/local/lib/python2.7/site-packages/mezzanine/conf/__init__.py",
>>>>>  
>>>>> line 236, in __getattr__
>>>>>     editable_cache = self._get_editable(request=self._current_request)
>>>>>   File 
>>>>> "/home/danny/.virtualenvs/mez4/local/lib/python2.7/site-packages/mezzanine/conf/__init__.py",
>>>>>  
>>>>> line 152, in _get_editable
>>>>>     editable_settings = self._editable_caches[request] = self._load()
>>>>>   File 
>>>>> "/home/danny/.virtualenvs/mez4/local/lib/python2.7/site-packages/mezzanine/conf/__init__.py",
>>>>>  
>>>>> line 191, in _load
>>>>>     for setting_obj in Setting.objects.all():
>>>>>   File 
>>>>> "/home/danny/.virtualenvs/mez4/local/lib/python2.7/site-packages/django/db/models/manager.py",
>>>>>  
>>>>> line 228, in all
>>>>>     return self.get_queryset()
>>>>>   File 
>>>>> "/home/danny/.virtualenvs/mez4/local/lib/python2.7/site-packages/mezzanine/core/managers.py",
>>>>>  
>>>>> line 349, in get_queryset
>>>>>     return super(DjangoCSM, self).get_queryset().filter(**lookup)
>>>>>   File 
>>>>> "/home/danny/.virtualenvs/mez4/local/lib/python2.7/site-packages/django/db/models/query.py",
>>>>>  
>>>>> line 679, in filter
>>>>>     return self._filter_or_exclude(False, *args, **kwargs)
>>>>>   File 
>>>>> "/home/danny/.virtualenvs/mez4/local/lib/python2.7/site-packages/django/db/models/query.py",
>>>>>  
>>>>> line 697, in _filter_or_exclude
>>>>>     clone.query.add_q(Q(*args, **kwargs))
>>>>>   File 
>>>>> "/home/danny/.virtualenvs/mez4/local/lib/python2.7/site-packages/django/db/models/sql/query.py",
>>>>>  
>>>>> line 1309, in add_q
>>>>>     clause, require_inner = self._add_q(where_part, self.used_aliases)
>>>>>   File 
>>>>> "/home/danny/.virtualenvs/mez4/local/lib/python2.7/site-packages/django/db/models/sql/query.py",
>>>>>  
>>>>> line 1337, in _add_q
>>>>>     allow_joins=allow_joins, split_subq=split_subq,
>>>>>   File 
>>>>> "/home/danny/.virtualenvs/mez4/local/lib/python2.7/site-packages/django/db/models/sql/query.py",
>>>>>  
>>>>> line 1149, in build_filter
>>>>>     lookups, parts, reffed_expression = self.solve_lookup_type(arg)
>>>>>   File 
>>>>> "/home/danny/.virtualenvs/mez4/local/lib/python2.7/site-packages/django/db/models/sql/query.py",
>>>>>  
>>>>> line 1035, in solve_lookup_type
>>>>>     _, field, _, lookup_parts = self.names_to_path(lookup_splitted, 
>>>>> self.get_meta())
>>>>>   File 
>>>>> "/home/danny/.virtualenvs/mez4/local/lib/python2.7/site-packages/django/db/models/sql/query.py",
>>>>>  
>>>>> line 1372, in names_to_path
>>>>>     if field.is_relation and not field.related_model:
>>>>>   File 
>>>>> "/home/danny/.virtualenvs/mez4/local/lib/python2.7/site-packages/django/utils/functional.py",
>>>>>  
>>>>> line 60, in __get__
>>>>>     res = instance.__dict__[self.name] = self.func(instance)
>>>>>   File 
>>>>> "/home/danny/.virtualenvs/mez4/local/lib/python2.7/site-packages/django/db/models/fields/related.py",
>>>>>  
>>>>> line 110, in related_model
>>>>>     apps.check_models_ready()
>>>>>   File 
>>>>> "/home/danny/.virtualenvs/mez4/local/lib/python2.7/site-packages/django/apps/registry.py",
>>>>>  
>>>>> line 131, in check_models_ready
>>>>>     raise AppRegistryNotReady("Models aren't loaded yet.")
>>>>> django.core.exceptions.AppRegistryNotReady: Models aren't loaded yet.
>>>>> ~~~~~~~~~~~~~~~~~~~~~~~~~
>>>>>
>>>>> What I did to set up:
>>>>>
>>>>> mkvirtualenv mez4
>>>>> pip install mezzanine
>>>>> pip install -e git+
>>>>> https://github.com/stephenmcd/cartridge.git@master#egg=cartridge
>>>>> mezzanine-project mez4  (NB not with cartridge template, as it hasn't 
>>>>> been updated yet)
>>>>>
>>>>> Edits to mez4/settings.py:
>>>>>
>>>>> INSTALLED_APPS = {
>>>>>    ...
>>>>>    "django.contrib.staticfiles",
>>>>>    "cartridge.shop",
>>>>>    "mezzanine.boot",
>>>>>    ...
>>>>> }
>>>>>
>>>>> MIDDLEWARE_CLASSES = {
>>>>>    ...
>>>>>    "django.middleware.clickjacking.XFrameOptionsMiddleware",
>>>>>    "cartridge.shop.middleware.ShopMiddleware",
>>>>>    "mezzanine.core.request.CurrentRequestMiddleware",
>>>>>    ...
>>>>> }
>>>>>
>>>>> And finally:
>>>>> python manage.py createdb
>>>>>
>>>>> which gives the above backtrace. (in fact, any manage.py command gives 
>>>>> the same backtrace).
>>>>>
>>>>> Thanks for any help...
>>>>>
>>>>> Seeya. Danny.
>>>>>
>>>>> -- 
>>>>> 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 [email protected] <javascript:>.
>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>
>>>>
>>>>
>>>>
>>>> -- 
>>>> Stephen McDonald
>>>> http://jupo.org
>>>>  
>>>
>>>
>>>
>>> -- 
>>> 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 [email protected] <javascript:>.
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>
>>
>>
>>
>>
>>  -- 
>> 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 [email protected] <javascript:>.
>> 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 [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to