fix
This commit is contained in:
parent
02b50952d6
commit
4c2c5a3ceb
385
main.ipynb
385
main.ipynb
File diff suppressed because it is too large
Load Diff
13
main.py
13
main.py
@ -2331,7 +2331,7 @@ async def post_painting(
|
||||
"grade": safe_strip(grade),
|
||||
"city": safe_strip(city) or current_user.get('living_place'),
|
||||
"size": safe_strip(size),
|
||||
"status": "Опубликована",
|
||||
"status": "В каталоге",
|
||||
"material": safe_strip(material),
|
||||
"genre": safe_strip(genre),
|
||||
"price": safe_strip(price),
|
||||
@ -2760,13 +2760,13 @@ async def post_exhibition(
|
||||
}
|
||||
|
||||
res = await exhibition_collection.insert_one(doc)
|
||||
|
||||
exhibition_id = res.inserted_id
|
||||
background_tasks.add_task(
|
||||
poster_exhibition,
|
||||
bson_clear({**doc, '_id': res.inserted_id})
|
||||
bson_clear({**doc, '_id': exhibition_id})
|
||||
)
|
||||
|
||||
return {'ok': True}
|
||||
return {'_id': str(exhibition_id)}
|
||||
except Exception as e:
|
||||
logging.error(str(e))
|
||||
raise HTTPException(status_code=500, detail=str(e))
|
||||
@ -2835,7 +2835,7 @@ async def put_exhibition(
|
||||
{'$set': update_doc}
|
||||
)
|
||||
|
||||
return {'ok': True}
|
||||
return {'_id': exhibition_id}
|
||||
except Exception as e:
|
||||
logging.error(str(e))
|
||||
raise HTTPException(status_code=500, detail=str(e))
|
||||
@ -3558,7 +3558,7 @@ async def profile_partner_exhibitions_catalog(
|
||||
counts_by_username = {d["_id"]: d["count"] for d in post_counts}
|
||||
|
||||
galerists = [{"_id": uname, "count": counts_by_username.get(uname, '')} for uname in usernames]
|
||||
posts = [doc async for doc in posts_collection.find({'status':'Опубликована'}).sort('_id', -1).limit(32)]
|
||||
posts = [doc async for doc in posts_collection.find().sort('_id', -1).limit(32)]
|
||||
return templates.TemplateResponse(
|
||||
request=request, name="profile/partner/exhibition catalog.html", context={"now": datetime.now(), "user": user, "galerists": galerists, "genres": genres, "living_places": living_places, "exhibition": exhibition, "posts": posts}
|
||||
)
|
||||
@ -3573,7 +3573,6 @@ async def profile_partner_exhibitions(
|
||||
obj_ids = [ObjectId(x) for x in exhibition.get('posts', [])]
|
||||
posts = await posts_collection.find({"_id": {"$in": obj_ids}}).to_list() if obj_ids else []
|
||||
d_posts = await delivery_collection.find({'post_id':{'$in':[str(i.get('_id')) for i in posts]}}).to_list()
|
||||
print(d_posts)
|
||||
for doc in posts:
|
||||
for post in d_posts:
|
||||
if str(doc.get('_id')) == post.get('post_id'):
|
||||
|
||||
@ -38,7 +38,8 @@
|
||||
" load_env('env')\n",
|
||||
"except:\n",
|
||||
" load_env('env_example')"
|
||||
]
|
||||
],
|
||||
"display_name": ".venv"
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
@ -48,7 +49,8 @@
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"from db import *"
|
||||
]
|
||||
],
|
||||
"display_name": ".venv"
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
@ -57,8 +59,9 @@
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"await posts_collection.update_many({'status':'publish'},{'$set':{'status':'Опубликована'}})"
|
||||
]
|
||||
"await posts_collection.update_many({'status':'publish'},{'$set':{'status':'В каталоге'}})"
|
||||
],
|
||||
"display_name": ".venv"
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
|
||||
@ -513,7 +513,8 @@ function bindLinkValidation({
|
||||
const res = await fetch('/api/exhibition', { method: 'POST', body: formData });
|
||||
|
||||
if (res.ok) {
|
||||
window.location.href = '/profile/partner/exhibitions';
|
||||
const { _id } = await res.json();
|
||||
window.location.href = `/profile/partner/exhibition/${_id}/catalog#main`;
|
||||
} else {
|
||||
const allFields = document.querySelectorAll('.floating-group');
|
||||
allFields.forEach(g => g.classList.add('error'));
|
||||
|
||||
@ -233,7 +233,7 @@ document.querySelectorAll('.b_k2cle button').forEach(button => {
|
||||
|
||||
if (this.textContent.trim() == this.dataset.status){
|
||||
parent.querySelectorAll('button').forEach(btn => {
|
||||
btn.dataset.status = 'Опубликована';
|
||||
btn.dataset.status = 'В каталоге';
|
||||
if (btn !== this) btn.classList.remove('hidden');
|
||||
});
|
||||
} else {
|
||||
|
||||
@ -69,7 +69,7 @@
|
||||
<header class="c_m876y b_9xtz9">
|
||||
<h3 class="c_hysjg b_8f3uh" id="preview_title">{{post.title}}</h3>
|
||||
</header>
|
||||
{% if post.status=='Опубликована' %}
|
||||
{% if post.status=='В каталоге' %}
|
||||
<div class="l_green"><span>{{post.status}}</span></div>
|
||||
{% else %}
|
||||
<div class="l_purple"><span>{{post.status}}</span></div>
|
||||
@ -97,7 +97,6 @@
|
||||
</div>
|
||||
</section>
|
||||
<script>
|
||||
|
||||
async function sendInvitations(exhibition_id) {
|
||||
const data = new FormData();
|
||||
data.set('exhibition_id', exhibition_id);
|
||||
@ -108,7 +107,7 @@
|
||||
});
|
||||
|
||||
if (res.ok) {
|
||||
showToast({ message: 'Приглашени{% if uniq_count > 1 %}я{% else %}е{% endif %} в очереди на отправку' });
|
||||
showToast({ message: 'Приглашени{% if uniq_count > 1 %}я{% else %}е{% endif %} отправлен{% if uniq_count > 1 %}ы{% else %}о{% endif %}' });
|
||||
}
|
||||
else {
|
||||
showToast({ message: 'Ошибка сохранения', status: "error", duration: 2500 });
|
||||
|
||||
Loading…
Reference in New Issue
Block a user