Cheat
This commit is contained in:
1 parent
8a4a9fcb26
commit
2100408b72
3 files changed
+4
-16
No files matched your search
+2
-2
@@ -6,5 +6,5 @@ class BBSAppConfig(AppConfig):
|
|||||||
verbose_name = 'Biceps Bar System'
|
verbose_name = 'Biceps Bar System'
|
||||||
|
|
||||||
def ready(self):
|
def ready(self):
|
||||||
# all models are loaded, now attach signals
|
# all models are loaded, could attach signals
|
||||||
import main.signals
|
pass
|
||||||
+2
-2
@@ -4,7 +4,7 @@ from django import forms
|
|||||||
from django.contrib.auth.models import User
|
from django.contrib.auth.models import User
|
||||||
from django.utils.translation import ugettext_lazy as _
|
from django.utils.translation import ugettext_lazy as _
|
||||||
|
|
||||||
from main.models import Order, Transaction, InventoryTransaction, Product
|
from main.models import Order, Transaction, InventoryTransaction, Product, UserProfile
|
||||||
from main.utils import format_username
|
from main.utils import format_username
|
||||||
|
|
||||||
|
|
||||||
@@ -62,7 +62,7 @@ class SimpleCreateUserForm(forms.Form):
|
|||||||
user.first_name = self.cleaned_data['first_name']
|
user.first_name = self.cleaned_data['first_name']
|
||||||
user.last_name = self.cleaned_data['last_name']
|
user.last_name = self.cleaned_data['last_name']
|
||||||
|
|
||||||
profile = user.profile
|
profile = UserProfile.objects.create(user=user)
|
||||||
profile.image = self._get_facebook_url()
|
profile.image = self._get_facebook_url()
|
||||||
|
|
||||||
if commit:
|
if commit:
|
||||||
|
|||||||
@@ -1,12 +0,0 @@
|
|||||||
from django.contrib.auth import get_user_model
|
|
||||||
from django.db.models.signals import post_save
|
|
||||||
from django.dispatch import receiver
|
|
||||||
|
|
||||||
from main.models import UserProfile
|
|
||||||
|
|
||||||
|
|
||||||
@receiver(post_save, sender=get_user_model())
|
|
||||||
def create_user_profile(sender, instance, created, **kwargs):
|
|
||||||
# Create a new UserProfile object when we create a new User.
|
|
||||||
if created:
|
|
||||||
UserProfile.objects.create(user=instance)
|
|
||||||
Reference in new issue
Block a user