remotes/origin/hotfix/users_in_admin_bonuses_9-02-19
parent
5d792681f5
commit
9641c0deac
16 changed files with 210 additions and 77 deletions
@ -0,0 +1,18 @@ |
|||||||
|
# Generated by Django 2.0.7 on 2019-02-06 17:10 |
||||||
|
|
||||||
|
from django.db import migrations, models |
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration): |
||||||
|
|
||||||
|
dependencies = [ |
||||||
|
('course', '0047_course_old_price'), |
||||||
|
] |
||||||
|
|
||||||
|
operations = [ |
||||||
|
migrations.AlterField( |
||||||
|
model_name='course', |
||||||
|
name='duration', |
||||||
|
field=models.IntegerField(default=0, verbose_name='Продолжительность доступа к курсу'), |
||||||
|
), |
||||||
|
] |
||||||
@ -0,0 +1,18 @@ |
|||||||
|
# Generated by Django 2.0.7 on 2019-02-07 15:51 |
||||||
|
|
||||||
|
from django.db import migrations |
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration): |
||||||
|
|
||||||
|
dependencies = [ |
||||||
|
('course', '0048_auto_20190206_1710'), |
||||||
|
] |
||||||
|
|
||||||
|
operations = [ |
||||||
|
migrations.RenameField( |
||||||
|
model_name='course', |
||||||
|
old_name='duration', |
||||||
|
new_name='access_duration', |
||||||
|
), |
||||||
|
] |
||||||
@ -0,0 +1,8 @@ |
|||||||
|
# TODO: test_course_access_duration |
||||||
|
''' |
||||||
|
сделать поле "продолжительность доступа" у курсов: автор указывает продолжительность, |
||||||
|
после покупки по истечению указанного кол-ва дней у пользователя нет доступа к курсу, |
||||||
|
но он может его купить с 50% скидкой, при покупке курса появляется надпись "осталось Х дней доступа", |
||||||
|
так же за неделю до окончания можно купить курс еще раз с 50% скидкой, при этом доступ продлевается |
||||||
|
на указанное кол-во дней в продолжительности |
||||||
|
''' |
||||||
@ -0,0 +1,18 @@ |
|||||||
|
from datetime import timedelta |
||||||
|
|
||||||
|
from django.core.management.base import BaseCommand |
||||||
|
from django.db.models import F |
||||||
|
|
||||||
|
from apps.payment.models import CoursePayment |
||||||
|
|
||||||
|
|
||||||
|
class Command(BaseCommand): |
||||||
|
help = 'Fill payment.access_expire where it is not filled' |
||||||
|
|
||||||
|
def handle(self, *args, **options): |
||||||
|
|
||||||
|
for payment in CoursePayment.objects.filter(access_expire__isnull=True): |
||||||
|
payment.access_expire = payment.created_at.date() + timedelta(days=payment.course.access_duration) |
||||||
|
payment.save() |
||||||
|
|
||||||
|
|
||||||
@ -0,0 +1,18 @@ |
|||||||
|
# Generated by Django 2.0.7 on 2019-02-06 17:10 |
||||||
|
|
||||||
|
from django.db import migrations, models |
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration): |
||||||
|
|
||||||
|
dependencies = [ |
||||||
|
('payment', '0030_auto_20190114_1649'), |
||||||
|
] |
||||||
|
|
||||||
|
operations = [ |
||||||
|
migrations.AddField( |
||||||
|
model_name='coursepayment', |
||||||
|
name='access_expired', |
||||||
|
field=models.DateField(null=True, verbose_name='Доступ к курсу до даты'), |
||||||
|
), |
||||||
|
] |
||||||
@ -0,0 +1,18 @@ |
|||||||
|
# Generated by Django 2.0.7 on 2019-02-07 12:33 |
||||||
|
|
||||||
|
from django.db import migrations |
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration): |
||||||
|
|
||||||
|
dependencies = [ |
||||||
|
('payment', '0031_coursepayment_access_expired'), |
||||||
|
] |
||||||
|
|
||||||
|
operations = [ |
||||||
|
migrations.RenameField( |
||||||
|
model_name='coursepayment', |
||||||
|
old_name='access_expired', |
||||||
|
new_name='access_expire', |
||||||
|
), |
||||||
|
] |
||||||
Loading…
Reference in new issue