This commit is contained in:
nikolark committed 2016-04-13 21:20:26 +02:00
1 parent 8a4a9fcb26
commit 2100408b72
3 files changed
+4 -16

No files matched your search

+2 -2
View File
@@ -6,5 +6,5 @@ class BBSAppConfig(AppConfig):
verbose_name = 'Biceps Bar System'
def ready(self):
# all models are loaded, now attach signals
import main.signals
# all models are loaded, could attach signals
pass
+2 -2
View File
@@ -4,7 +4,7 @@ from django import forms
from django.contrib.auth.models import User
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
@@ -62,7 +62,7 @@ class SimpleCreateUserForm(forms.Form):
user.first_name = self.cleaned_data['first_name']
user.last_name = self.cleaned_data['last_name']
profile = user.profile
profile = UserProfile.objects.create(user=user)
profile.image = self._get_facebook_url()
if commit:
-12
View File
@@ -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)