diff --git a/api/api_methods.py b/api/api_methods.py
index 23e381b..9718758 100755
--- a/api/api_methods.py
+++ b/api/api_methods.py
@@ -457,87 +457,6 @@ class ApiSecurity:
class ApiOrder:
- @staticmethod
- @api_method("order.getForm",
- doc="Получение формы создания заказа в виде полей, которые нужно показать пользователю",
- params=[],
- returns="JSON
объект, содержащий данные формы. Структура пока не определена")
- def get_form():
- return api_make_response({
- "fields": [
- # name = models.CharField(max_length=200, verbose_name="Название заказа")
- {
- "name": "name",
- "label": "Название заказа",
- "widget": "text",
- "attrs": {
- "max_len": 200
- },
- "required": True
- },
-
- # square = models.DecimalField(max_digits=7, decimal_places=2, blank=False, verbose_name="Площадь в м²")
- {
- "name": "square",
- "label": "Площадь в м²",
- "widget": "decimal",
- "attrs": {
- "max_digits": 7,
- "decimal_places": 2
- },
- "required": True
- },
-
- # work_time = models.CharField(max_length=100, blank=True, verbose_name="Рабочее время")
- {
- "name": "work_time",
- "label": "Рабочее время",
- "widget": "text",
- "attrs": {
- "max_len": 100
- },
- "required": False
- },
-
- # type_of_renovation = models.CharField(max_length=10, choices=TYPE_OF_RENOVATION_CHOICES,
- # default=CHOICE_UNDEFINED, blank=True, verbose_name="Тип ремонта")
- {
- "name": "type_of_renovation",
- "label": "Тип ремонта",
- "widget": "choice",
- "attrs": {
- "default": None,
- "choices": "Order.TYPE_OF_RENOVATION_CHOICES"
- },
- "required": False
- },
-
- # type_of_room = models.CharField(max_length=10, choices=TYPE_OF_ROOM_CHOICES,
- # blank=True, default=CHOICE_UNDEFINED, verbose_name="Тип квартиры")
- {
- "name": "type_of_room",
- "label": "Тип квартиры",
- "widget": "radio",
- "attrs": {
- "default": None,
- "choices": "Order.TYPE_OF_ROOM_CHOICES"
- },
- "required": False
- },
-
- # флажок
- {
- "name": "is_with_warranty",
- "label": "С гарантией",
- "widget": "checkbox",
- "attrs": {
- "default": True
- },
- "required": False
- },
- ]
- })
-
@staticmethod
@api_method("order.create",
doc="Создание заказа",
@@ -830,16 +749,19 @@ class ApiPortfolio:
ApiParamInt(name="date", required=False,
description="Дата в формате UNIX time, потом будет нормальный объект даты,"
"если не передать то будет вставлена текущая дата"),
- ApiParamFloat(name="price", description="Цена заказа, актуальная на момент выполнения")
+ ApiParamFloat(name="price", description="Цена заказа, актуальная на момент выполнения"),
+ ApiParamFloat(name='square', value_max=99999.99, value_min=1.0,
+ description='Площадь в м²'),
], returns="id
созданного объекта")
- async def create(access_token, title, date, price):
+ async def create(access_token, title, date, price, square):
# проверка на роль, нужна сразу
if access_token.user.role != Account.ROLE_EXECUTOR:
raise Exception(API_ERROR_NOT_ALLOWED, "you must have executor role")
try:
- p = await Portfolio.objects.acreate(account=access_token.user, title=title, actual_price=price,
- actual_date=(dt.fromtimestamp(date) if date is not None else None))
+ p = await Portfolio.objects.acreate(account=access_token.user, actual_price=price, square=square,
+ actual_date=(dt.fromtimestamp(date) if date is not None else None),
+ title=title,)
return api_make_response({"portfolio_id": p.id})
except Exception:
traceback.print_exc()
@@ -879,7 +801,9 @@ class ApiPortfolio:
"id": item.id,
"title": item.title,
"actual_date": int(time.mktime(item.actual_date.timetuple())),
- "actual_price": item.actual_price,
+ "publish_date": int(time.mktime(item.publish_date.timetuple())),
+ "actual_price": float(item.actual_price),
+ "square": float(item.square),
"photos": [random.randint(4, 28) for _ in range(random.randint(1, 5))]
} async for item in res]
diff --git a/api/api_params.py b/api/api_params.py
index 214b50d..3b0f2d2 100755
--- a/api/api_params.py
+++ b/api/api_params.py
@@ -193,7 +193,7 @@ class ApiParamEnum(ApiParam):
class ApiParamBoolean(ApiParam):
def __init__(self, **kwargs):
- super().__init__( **kwargs)
+ super().__init__(**kwargs)
def validate(self, value):
if value is None:
diff --git a/api/models.py b/api/models.py
index 351017a..63b2a36 100755
--- a/api/models.py
+++ b/api/models.py
@@ -412,7 +412,9 @@ class Portfolio(models.Model):
title = models.CharField(max_length=200, verbose_name="Название")
actual_date = models.DateField(verbose_name="Дата выполнения", default=datetime.now)
+ publish_date = models.DateField(verbose_name="Дата публикации", default=datetime.now, editable=False)
actual_price = models.DecimalField(max_digits=12, decimal_places=2, blank=False, verbose_name="Цена")
+ square = models.DecimalField(max_digits=7, decimal_places=2, blank=False, verbose_name="Площадь в м²")
def __str__(self):
return f"{self.id}: \"{self.title}\""
diff --git a/static/test/Untitled.ogg b/static/test/Untitled.ogg
deleted file mode 100644
index 08cb189..0000000
Binary files a/static/test/Untitled.ogg and /dev/null differ
diff --git a/static/test/index.html b/static/test/index.html
deleted file mode 100644
index b2a5c4b..0000000
--- a/static/test/index.html
+++ /dev/null
@@ -1,41 +0,0 @@
-
-
-