Skip to content

Commit

Permalink
feat(dev): user's requests (#291)
Browse files Browse the repository at this point in the history
  • Loading branch information
eugena committed Jul 10, 2023
1 parent 4975492 commit 839a00b
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 4 deletions.
4 changes: 2 additions & 2 deletions acesta/user/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -279,8 +279,8 @@ class SupportAdmin(admin.ModelAdmin):
def support_user(self, obj):
return f"{obj.user.last_name} {obj.user.first_name} ({obj.user.region})"

def has_delete_permission(self, request, obj=None):
return False
# def has_delete_permission(self, request, obj=None):
# return False

formfield_overrides = {
models.TextField: {
Expand Down
19 changes: 19 additions & 0 deletions acesta/user/migrations/0015_alter_request_name.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Generated by Django 3.2.16 on 2023-07-10 04:24

import acesta.user.validators
from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('user', '0014_alter_request__id_alter_request_channel'),
]

operations = [
migrations.AlterField(
model_name='request',
name='name',
field=models.CharField(max_length=35, validators=[acesta.user.validators.validate_russian], verbose_name='Имя'),
),
]
2 changes: 1 addition & 1 deletion acesta/user/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ class Request(TimeStampedModel):
Request Model
"""

name = models.CharField("Имя", max_length=35)
name = models.CharField("Имя", max_length=35, validators=[validate_russian])
user = models.ForeignKey(
User,
verbose_name="Пользователь",
Expand Down
2 changes: 1 addition & 1 deletion acesta/user/validators.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@


def validate_russian(value):
def match(text, alphabet=set("абвгдеёжзийклмнопрстуфхцчшщъыьэюя ")):
def match(text, alphabet=set("абвгдеёжзийклмнопрстуфхцчшщъыьэюя -")):
return not alphabet.isdisjoint(text.lower())

if not match(value):
Expand Down

0 comments on commit 839a00b

Please sign in to comment.