Hi guys,
  I hit a problem when add ManyToManyField via EXTRA_MODEL_FIELDS.
I wanna add relation between DiscountCode and User Model like this:

from django.contrib.auth.models import User
EXTRA_MODEL_FIELDS = (
    (
        "cartridge.shop.models.DiscountCode.rel_users",
        "ManyToManyField",
        (User,),
        {"blank": True, "null": True,'verbose_name':"valid 
users",'related_name':'discountcodes'},
    ),
                      )
                      
I got this:
D:\workspace43\weichun>python manage.py runserver
Traceback (most recent call last):
  File "manage.py", line 11, in <module>
    from settings import PROJECT_ROOT, PROJECT_DIRNAME
  File "D:\workspace43\weichun\settings.py", line 362, in <module>
    from local_settings import *
  File "D:\workspace43\weichun\local_settings.py", line 53, in <module>
    from django.contrib.auth.models import User
  File "D:\Python27\lib\site-packages\django\contrib\auth\models.py", line 
8, in <module>
    from django.db import models
  File "D:\Python27\lib\site-packages\django\db\__init__.py", line 11, in 
<module>
    if settings.DATABASES and DEFAULT_DB_ALIAS not in settings.DATABASES:
  File "D:\Python27\lib\site-packages\django\conf\__init__.py", line 52, in 
__getattr__
    self._setup(name)
  File "D:\Python27\lib\site-packages\django\conf\__init__.py", line 45, in 
_setup
    % (desc, ENVIRONMENT_VARIABLE))
django.core.exceptions.ImproperlyConfigured: Requested setting DATABASES, 
but settings are not configured. You must either define the environment 
variable DJANGO_SETTINGS_MODULE or call settings.confi
gure() before accessing settings.

So how to fix this? Does EXTRA_MODEL_FIELDS support adding ManyToManyField?

Thanks.
Wesley

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