diff --git a/kfet/autocomplete.py b/kfet/autocomplete.py index 1b4e836c..8179f32e 100644 --- a/kfet/autocomplete.py +++ b/kfet/autocomplete.py @@ -121,12 +121,12 @@ def account_search(request): for word in words: query = Account.objects.filter( - Q(cofprofile__user__username__icontains=word) | - Q(cofprofile__user__first_name__icontains=word) | - Q(cofprofile__user__last_name__icontains=word) + Q(profile__user__username__icontains=word) | + Q(profile__user__first_name__icontains=word) | + Q(profile__user__last_name__icontains=word) ).distinct() - query = [(account.trigramme, account.cofprofile.user.get_full_name()) + query = [(account.trigramme, account.profile.user.get_full_name()) for account in query] data['accounts'] = query diff --git a/kfet/forms.py b/kfet/forms.py index 038a9b8f..2127030f 100644 --- a/kfet/forms.py +++ b/kfet/forms.py @@ -393,7 +393,7 @@ class KFetConfigForm(ConfigForm): label='Destinataire de la majoration', initial=None, required=False, help_text='Laissez vide pour désactiver la majoration.', queryset=(Account.objects - .select_related('cofprofile', 'cofprofile__user') + .select_related('profile', 'profile__user') .all()), ) kfet_overdraft_duration = forms.DurationField( diff --git a/kfet/management/commands/createopes.py b/kfet/management/commands/createopes.py index 5a7699ae..b77fee6e 100644 --- a/kfet/management/commands/createopes.py +++ b/kfet/management/commands/createopes.py @@ -51,7 +51,7 @@ class Command(BaseCommand): liq_account = Account.objects.get(trigramme='LIQ') try: con_account = Account.objects.get( - cofprofile__user__first_name='Assurancetourix' + profile__user__first_name='Assurancetourix' ) except Account.DoesNotExist: con_account = random.choice(accounts) @@ -134,7 +134,7 @@ class Command(BaseCommand): on_acc=account, checkout=checkout, at=at, - is_cof=account.cofprofile.is_cof, + is_cof=account.profile.is_cof, amount=amount, )) at_list.append(at) diff --git a/kfet/models.py b/kfet/models.py index 8567fb42..167e9c28 100644 --- a/kfet/models.py +++ b/kfet/models.py @@ -313,7 +313,7 @@ class AccountNegativeManager(models.Manager): def get_queryset(self): return ( super().get_queryset() - .select_related('account__cofprofile__user') + .select_related('account__profile__user') ) diff --git a/kfet/tests/test_config.py b/kfet/tests/test_config.py index e0c323b7..7fa9e994 100644 --- a/kfet/tests/test_config.py +++ b/kfet/tests/test_config.py @@ -40,7 +40,7 @@ class ConfigTest(TestCase): """Test field of model instance type.""" user = User.objects.create(username='foo_user') account = Account.objects.create(trigramme='FOO', - cofprofile=user.profile) + profile=user.profile) # IUT kfet_config.set(addcost_for=account) # check diff --git a/kfet/tests/test_statistic.py b/kfet/tests/test_statistic.py index 48164162..97e24677 100644 --- a/kfet/tests/test_statistic.py +++ b/kfet/tests/test_statistic.py @@ -20,14 +20,14 @@ class TestStats(TestCase): user = User.objects.create(username="Foobar") user.set_password("foobar") user.save() - Account.objects.create(trigramme="FOO", cofprofile=user.profile) + Account.objects.create(trigramme="FOO", profile=user.profile) perm = Permission.objects.get(codename="is_team") user.user_permissions.add(perm) user2 = User.objects.create(username="Barfoo") user2.set_password("barfoo") user2.save() - Account.objects.create(trigramme="BAR", cofprofile=user2.profile) + Account.objects.create(trigramme="BAR", profile=user2.profile) article = Article.objects.create( name="article", diff --git a/kfet/tests/utils.py b/kfet/tests/utils.py index 30eb05ad..aedfce40 100644 --- a/kfet/tests/utils.py +++ b/kfet/tests/utils.py @@ -28,7 +28,7 @@ def _create_user_and_account(user_attrs, account_attrs, perms=None): user.set_password(user_pwd) user.save() - account_attrs['cofprofile'] = user.profile + account_attrs['profile'] = user.profile kfet_pwd = account_attrs.pop('password', 'kfetpwd_{}'.format(user_pwd)) account = Account.objects.create(**account_attrs)