parent
9a872ea173
commit
a74c7e131f
12 changed files with 721 additions and 730 deletions
File diff suppressed because it is too large
Load Diff
@ -0,0 +1 @@ |
|||||||
|
default_app_config = 'ratings.apps.RatingsConfig' |
||||||
@ -0,0 +1,23 @@ |
|||||||
|
from django.core.management import BaseCommand |
||||||
|
from specializations.models import Specialization |
||||||
|
from ratings.models import SpecializationRating |
||||||
|
from users.models import User |
||||||
|
|
||||||
|
|
||||||
|
class Command(BaseCommand): |
||||||
|
def handle(self, *args, **options): |
||||||
|
SpecializationRating.objects.all().delete() |
||||||
|
contractors = User.contractor_objects.order_by('-contractor_rating') |
||||||
|
specializations = Specialization.objects.all() |
||||||
|
for spec in specializations: |
||||||
|
i = 0 |
||||||
|
for contractor in contractors: |
||||||
|
if spec in contractor.contractor_specializations.all(): |
||||||
|
i += 1 |
||||||
|
spec_rating = SpecializationRating() |
||||||
|
spec_rating.position = i |
||||||
|
spec_rating.user = contractor |
||||||
|
spec_rating.specialization = spec |
||||||
|
spec_rating.save() |
||||||
|
|
||||||
|
print('The End') |
||||||
@ -0,0 +1,9 @@ |
|||||||
|
<div class="dashedCol4"> |
||||||
|
<p class="specUser">Специализации:</p> |
||||||
|
{% for spec in specializations %} |
||||||
|
<div class="insetSpec"> |
||||||
|
<span>{{ spec.specialization.name }}</span> |
||||||
|
<span>{{ spec.position }}-й</span> |
||||||
|
</div> |
||||||
|
{% endfor %} |
||||||
|
</div> |
||||||
@ -1,21 +0,0 @@ |
|||||||
<div class="dashedCol4"> |
|
||||||
<p class="specUser">Специализации:</p> |
|
||||||
{% for spec in specializations %} |
|
||||||
<div class="insetSpec"> |
|
||||||
<span>{{ spec }}</span> |
|
||||||
<span>2-й</span> |
|
||||||
</div> |
|
||||||
{% endfor %} |
|
||||||
</div> |
|
||||||
{# <div class="dashedCol4 dashedCol44 dashedColColor">#} |
|
||||||
{# <p class="specUser">#} |
|
||||||
{# Специализации:#} |
|
||||||
{# </p>#} |
|
||||||
{# <div class="insetSpec">#} |
|
||||||
{# <span>Интерьеры</span>#} |
|
||||||
{# </div>#} |
|
||||||
{# #} |
|
||||||
{# <div class="insetSpec">#} |
|
||||||
{# <span>Визуализация/3D</span>#} |
|
||||||
{# </div>#} |
|
||||||
{# </div>#} |
|
||||||
Loading…
Reference in new issue