This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$index = 'menu_cat_list_by_type_ru'; | |
$flag = True; | |
$ids_to_exclude = array(); | |
while ($flag) { | |
// Удаляем документы в индексе, пока они не закончатся | |
$params = [ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<tr> | |
<td class="action-checkbox"> | |
<input | |
type="{{ form.xml.field.widget.input_type }}" | |
name="xml" | |
value="{{ value }}" | |
class="action-select" | |
id="id_xml_{{ forloop.counter0 }}" | |
{% if value in form.xml.data %} checked="checked" {% endif %} | |
> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# models.py | |
class WareHouse(models.Model): | |
address = models.CharField(max_length=255, null=True, unique=True) | |
def __str__(self): | |
return self.address | |
class Product(models.Model): | |
article = models.CharField(max_length=255, null=True, unique=True) | |
productwarehouse = models.ForeignKey(WareHouse, on_delete=models.CASCADE, null=True) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pathlib | |
import os | |
import shutil | |
BASE_DIR = pathlib.Path(__file__).resolve().parent | |
for image360dir in os.listdir(BASE_DIR / '2021-12-10'): | |
for image in os.listdir(BASE_DIR / '2021-12-10' / image360dir / 'yo/imageslarge'): | |
pathlib.Path(BASE_DIR / 'raw' / image360dir).mkdir(parents=True, exist_ok=True) | |
shutil.copy( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.db import connection | |
from pprint import pprint, pformat | |
# Database name | |
referenced_table_schema = connection.settings_dict['NAME'] | |
# Table being referenced by foreign keys of another tables | |
referenced_table_name = "lang" | |
# Field being referenced by another tables | |
referenced_column_name = "id_lang" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
INSERT INTO product_lang (id_product,id_lang,title, description) | |
SELECT | |
p.id, | |
l.id_lang, | |
NULL, | |
concat('description_test','_', l.iso_code) | |
FROM products p | |
LEFT JOIN lang l ON l.id_lang != 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DELETE FROM `feature_value` WHERE id_feature_value NOT IN (SELECT DISTINCT fp.id_feature_value FROM feature_product fp ) AND id_feature NOT IN (112, 111) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE TEMPORARY TABLE `t_temp` | |
as ( | |
SELECT min(id) as id | |
FROM `table` | |
GROUP BY name, surname | |
); | |
DELETE from `table` | |
WHERE `table`.id not in ( | |
SELECT id FROM t_temp |