Расширение профиля пользователя в Django. Админ создание пользователей

Добрый вечер,

В настоящее время я создаю сайт с Django, и я расширил пользователя с помощью профиля пользователя. У меня есть небольшая проблема, хотя. Вот моя ситуация:

I extended the user profile in order to add custom fields. I added the model to the User Admin Model, so when I am adding a user, I can fill in directly the fields to create the profile. Now, if I don't add ANYTHING in these new custom user fields, in the user add page, Django Admin won't throw me an error saying these fields are null (and they aren't suppose to be) I want it to throw me an error in this User Add Admin page, so that the admins will HAVE to fill in a profile when adding a new user. ALL the users will be added in the Admin Panel.

Это возможно? Большое спасибо!

in admin.py

<code>from django.contrib import admin
from django.contrib.auth.admin import UserAdmin as DjangoUserAdmin
from django.contrib.auth.models import User
from accounts.models import UserProfile


class UserProfileInline(admin.TabularInline):
    model = UserProfile


class UserAdmin(DjangoUserAdmin):
    inlines = [ UserProfileInline,]


admin.site.unregister(User)
admin.site.register(User, UserAdmin)
</code>

In model.py

<code>class UserProfile(models.Model):
    user = models.OneToOneField(User)
    employee_number = models.PositiveIntegerField(unique=True)

    def __unicode__(self):
        return 'Number'
</code>

Ответы на вопрос(1)

Ваш ответ на вопрос