Herramientas de usuario

Herramientas del sitio


wiki2:python:django:models

Diferencias

Muestra las diferencias entre dos versiones de la página.

Enlace a la vista de comparación

Ambos lados, revisión anterior Revisión previa
Próxima revisión
Revisión previa
wiki2:python:django:models [2019/03/25 08:48]
alfred [Migrations]
wiki2:python:django:models [2020/05/09 09:25] (actual)
Línea 3: Línea 3:
  
 <​code>​ <​code>​
-python manage.py makemigrations <app>+python manage.py makemigrations <app>
 </​code> ​ </​code> ​
 Will create migration files for all the apps if the ''​app''​ was not indicated. Will create migration files for all the apps if the ''​app''​ was not indicated.
  
 +<​code>​ 
 +$ python manage.py migrate 
 +</​code>​  
 +Will apply migrations to the configured DB.
 ===== Signals ===== ===== Signals =====
  
Línea 155: Línea 158:
  
 ===== How to... ===== ===== How to... =====
 +==== Deal with performed queries ====
 +See the current registered queries (with their times):
 +<​code>​
 +from django.db import connection
 +connection.queries
 +</​code>​
 +
 +See a concrete database queries:
 +<​code>​
 +from django.db import connections
 +connections['​my_db_alias'​].queries
 +</​code>​
 +
 +Delete the query array:
 +<​code>​
 +from django.db import reset_queries
 +reset_queries()
 +</​code>​
 ==== Get an app model ==== ==== Get an app model ====
 <​code>​ <​code>​
wiki2/python/django/models.1553503694.txt.gz · Última modificación: 2020/05/09 09:24 (editor externo)