mirror of
https://github.com/cookiecutter/cookiecutter-django.git
synced 2025-08-19 03:14:52 +03:00
🐛 fix cookiecutter not generating proper template bug
This commit is contained in:
parent
0ad833eedb
commit
bb60df15fb
|
@ -25,7 +25,7 @@ def _update_or_create_site_with_sequence(site_model, connection, domain, name):
|
||||||
# greater than the maximum value.
|
# greater than the maximum value.
|
||||||
max_id = site_model.objects.order_by('-id').first().id
|
max_id = site_model.objects.order_by('-id').first().id
|
||||||
with connection.cursor() as cursor:
|
with connection.cursor() as cursor:
|
||||||
{% if cookiecutter.database_engine == 'postgresql' -%}
|
{%- if cookiecutter.database_engine == 'postgresql' %}
|
||||||
cursor.execute("SELECT last_value from django_site_id_seq")
|
cursor.execute("SELECT last_value from django_site_id_seq")
|
||||||
(current_id,) = cursor.fetchone()
|
(current_id,) = cursor.fetchone()
|
||||||
if current_id <= max_id:
|
if current_id <= max_id:
|
||||||
|
@ -33,7 +33,7 @@ def _update_or_create_site_with_sequence(site_model, connection, domain, name):
|
||||||
"alter sequence django_site_id_seq restart with %s",
|
"alter sequence django_site_id_seq restart with %s",
|
||||||
[max_id + 1],
|
[max_id + 1],
|
||||||
)
|
)
|
||||||
{% elif cookiecutter.database_engine == 'mysql' -%}
|
{%- elif cookiecutter.database_engine == 'mysql' %}
|
||||||
cursor.execute("SELECT MAX(id) FROM django_site")
|
cursor.execute("SELECT MAX(id) FROM django_site")
|
||||||
(current_id,) = cursor.fetchone()
|
(current_id,) = cursor.fetchone()
|
||||||
if current_id <= max_id:
|
if current_id <= max_id:
|
||||||
|
@ -41,7 +41,7 @@ def _update_or_create_site_with_sequence(site_model, connection, domain, name):
|
||||||
"ALTER TABLE django_site AUTO_INCREMENT=%s",
|
"ALTER TABLE django_site AUTO_INCREMENT=%s",
|
||||||
[max_id + 1],
|
[max_id + 1],
|
||||||
)
|
)
|
||||||
{% endif -%}
|
{%- endif %}
|
||||||
|
|
||||||
|
|
||||||
def update_site_forward(apps, schema_editor):
|
def update_site_forward(apps, schema_editor):
|
||||||
|
|
Loading…
Reference in New Issue
Block a user