django-1.5

Django south circular dependency

久未见 提交于 2019-12-05 02:57:34
I have an app (let's call it MyApp) in a Django 1.5 project. MyApp defines a custom user model (MyUser). The project uses another app (AnotherApp) which references MyUser. MyApp references fields in AnotherApp. Everything has been working fine on my development laptop. I'm attempting to deploy my project on a server, and when I come to the migrate step, MyApp fails due to a dependency to AnotherApp, and AnotherApp fails on a dependency to MyApp (I have tried migrating the apps independently). Both are failing on their respective first migrations (0001) Running migrations for myapp: - Migrating

Django ModelForm not saving data to database

时光怂恿深爱的人放手 提交于 2019-12-05 00:51:42
问题 A Django beginner here having a lot of trouble getting forms working. Yes I've worked through the tutorial and browsed the web a lot - what I have is mix of what I'm finding here and at other sites. I'm using Python 2.7 and Django 1.5. (although the official documentation is extensive it tends to assume you know most of it already - not good as a beginners reference or even an advanced tutorial) I am trying to create a form for "extended" user details - eg. company name, street address, etc

Subclassing AbstractUser in Django for two types of users

你说的曾经没有我的故事 提交于 2019-12-04 21:23:32
I'm developing a school database system in Django 1.5, and was planning on having a number of different user types (Student, Staff, Parent) which subclass AbstractUser (actually, another abstract subclass of AbstractUser). I was just attempting to add an externally developed app to my system, which uses User in a ForeignKey for some of its models, however, this fails as my user type is not a 'User' instance. I can't set the apps models to use AbstractUser as one can't use abstract classes for Foreign Keys. I was then considering adding to my settings.py AUTH_USER_MODEL = 'myapp.MyUser' and

Access from django admin list_display, a value from a One-To-One table

独自空忆成欢 提交于 2019-12-04 19:16:22
问题 Given a one-to-one extension a model, such as the Django User model: class UserProfile(models.Model): user = models.OneToOneField(User, related_name='profile', unique=True) avatar = models.ImageField(_('Avatar')) foo = models.CharField(max_length=100, verbose_name="xxx") How can I display that in the admin? class UserAdmin(admin.ModelAdmin): list_display = ('email', 'profile__foo' <--NOT WORKING ) A near match question is Django Admin: How to display value of fields with list_display from two

AUTH_USER_MODEL refers to model .. that has not been installed and created AbstractUser models not able to login

大憨熊 提交于 2019-12-03 22:13:41
AUTH_USER_MODEL error solved in EDIT3. Passwords still will not save on user creation via form. I'm using Django 1.5 playing around with the new user override/extension features, and I am not able to register new users via my registration form - only via the Admin. When registering via the registration form, I get the following error: Manager isn't available; User has been swapped for 'poker.PokerUser' models.py: class PokerUser(AbstractUser): poker_relate = models.ForeignKey(settings.AUTH_USER_MODEL, null=True, blank=True) token = models.EmailField() USER_CHOICES = ( ('1', 'Staker'), ('2',

Django ModelForm not saving data to database

倖福魔咒の 提交于 2019-12-03 16:49:29
A Django beginner here having a lot of trouble getting forms working. Yes I've worked through the tutorial and browsed the web a lot - what I have is mix of what I'm finding here and at other sites. I'm using Python 2.7 and Django 1.5. (although the official documentation is extensive it tends to assume you know most of it already - not good as a beginners reference or even an advanced tutorial) I am trying to create a form for "extended" user details - eg. company name, street address, etc but the form data is not being saved to the database. Initially I tried to create a model extending the

Access from django admin list_display, a value from a One-To-One table

有些话、适合烂在心里 提交于 2019-12-03 13:02:45
Given a one-to-one extension a model, such as the Django User model: class UserProfile(models.Model): user = models.OneToOneField(User, related_name='profile', unique=True) avatar = models.ImageField(_('Avatar')) foo = models.CharField(max_length=100, verbose_name="xxx") How can I display that in the admin? class UserAdmin(admin.ModelAdmin): list_display = ('email', 'profile__foo' <--NOT WORKING ) A near match question is Django Admin: How to display value of fields with list_display from two models which are in oneToOne relation? The general method would be: class UseAdmin(admin.ModelAdmin):

Django 1.5b1: executing django-admin.py causes “No module named settings” error

不打扰是莪最后的温柔 提交于 2019-12-03 10:37:05
I've recently installed Django-1.5b1. My system configuration: OSX 10.8 Python 2.7.1 Virtualenv 1.7.2 When I call django-admin.py command I get the following error (devel)ninja Django-1.5b1: django-admin.py Usage: django-admin.py subcommand [options] [args] Options: -v VERBOSITY, --verbosity=VERBOSITY Verbosity level; 0=minimal output, 1=normal output, 2=verbose output, 3=very verbose output --settings=SETTINGS The Python path to a settings module, e.g. "myproject.settings.main". If this isn't provided, the DJANGO_SETTINGS_MODULE environment variable will be used. --pythonpath=PYTHONPATH A

Appropriate way to handle deprecated `adminmedia` templatetag and {% admin_media_prefix %}

北城余情 提交于 2019-12-03 08:28:13
问题 From django 1.5 onwards, https://docs.djangoproject.com/en/1.5/releases/1.5/#miscellaneous The template tags library adminmedia, which only contained the deprecated template tag {% admin_media_prefix %}, was removed. Attempting to load it with {% load adminmedia %} will fail. If your templates still contain that line you must remove it. So what is the appropriate way to replace code found in legacy libraries and my legacy projects which still uses {% load adminmedia %} and loads css like:-

AbstractUser Django full example

落花浮王杯 提交于 2019-12-03 07:34:51
问题 I am new to Django and I have been trying this for weeks, but could not find a way to solve this problem. I want to store additional information like user mobile number, bank name, bank account. And want to store the mobile number while user registers and wants user to login with either (mobile number and password) or (email and password). This is my UserProfile model from django.db import models from django.contrib.auth.models import User from django.contrib.auth.models import AbstractUser #