изменено портфолио, удалена тестовая папка с саратовом
This commit is contained in:
parent
d58e4cc256
commit
e3aae67375
@ -457,87 +457,6 @@ class ApiSecurity:
|
||||
|
||||
|
||||
class ApiOrder:
|
||||
@staticmethod
|
||||
@api_method("order.getForm",
|
||||
doc="Получение формы создания заказа в виде полей, которые нужно показать пользователю",
|
||||
params=[],
|
||||
returns="<code>JSON</code> объект, содержащий данные формы. Структура пока не определена")
|
||||
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="<code>id</code> созданного объекта")
|
||||
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]
|
||||
|
||||
|
@ -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:
|
||||
|
@ -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}\""
|
||||
|
Binary file not shown.
@ -1,41 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<style>
|
||||
@keyframes blinking {
|
||||
0% {
|
||||
background-color: #ff3d50;
|
||||
}
|
||||
50% {
|
||||
background-color: #55d66b;
|
||||
}
|
||||
75% {
|
||||
background-color: #d0b91d;
|
||||
}
|
||||
100% {
|
||||
background-color: #222291;
|
||||
}
|
||||
}
|
||||
|
||||
body {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
animation: blinking 1s infinite;
|
||||
}
|
||||
|
||||
a {
|
||||
color: aliceblue;
|
||||
font-size: 100px;
|
||||
font-size: 100px;
|
||||
text-decoration: none;
|
||||
}
|
||||
</style>
|
||||
<meta charset="UTF-8">
|
||||
<title> title </title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<a href="saratov.html"> не все кто перешол по сылке смагли вернутса взад </a>
|
||||
|
||||
</body>
|
||||
</html>
|
Binary file not shown.
Before Width: | Height: | Size: 44 KiB |
@ -1,21 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title> SARATOV </title>
|
||||
</head>
|
||||
<style>
|
||||
html {
|
||||
background-color: black;
|
||||
justify-content: center;
|
||||
}
|
||||
img {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
</style>
|
||||
<body>
|
||||
<iframe src="Untitled.ogg" type="audio/ogg" allow="autoplay" id="audio" style="display:none"></iframe>
|
||||
<img src="saratov.gif">
|
||||
</body>
|
||||
</html>
|
Reference in New Issue
Block a user