Hello community,
here is the log from the commit of package python-django-extensions for
openSUSE:Factory checked in at 2019-10-08 19:57:53
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-django-extensions (Old)
and /work/SRC/openSUSE:Factory/.python-django-extensions.new.2352 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-django-extensions"
Tue Oct 8 19:57:53 2019 rev:3 rq:735849 version:2.2.3
Changes:
--------
---
/work/SRC/openSUSE:Factory/python-django-extensions/python-django-extensions.changes
2019-09-18 13:11:27.064689757 +0200
+++
/work/SRC/openSUSE:Factory/.python-django-extensions.new.2352/python-django-extensions.changes
2019-10-08 19:57:54.788200576 +0200
@@ -1,0 +2,7 @@
+Mon Oct 7 13:10:59 UTC 2019 - Tomáš Chvátal <[email protected]>
+
+- Update to 2.2.3:
+ * minor fixes
+- Disable py2 package due to unsattisfied dependencies
+
+-------------------------------------------------------------------
Old:
----
django-extensions-2.2.1.tar.gz
New:
----
django-extensions-2.2.3.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ python-django-extensions.spec ++++++
--- /var/tmp/diff_new_pack.d04aI3/_old 2019-10-08 19:57:55.296199054 +0200
+++ /var/tmp/diff_new_pack.d04aI3/_new 2019-10-08 19:57:55.300199042 +0200
@@ -16,13 +16,13 @@
#
+%define skip_python2 1
Name: python-django-extensions
-Version: 2.2.1
+Version: 2.2.3
Release: 0
Summary: Extensions for Django
License: BSD-3-Clause
-Group: Development/Languages/Python
-URL: http://github.com/django-extensions/django-extensions
+URL: https://github.com/django-extensions/django-extensions
Source:
https://github.com/django-extensions/django-extensions/archive/%{version}.tar.gz#/django-extensions-%{version}.tar.gz
BuildRequires: %{python_module Django}
BuildRequires: %{python_module Pygments}
@@ -44,11 +44,11 @@
Recommends: python-Pygments
Recommends: python-Werkzeug
Recommends: python-django-json-widget
-Recommends: python-python-dateutil
Recommends: python-djangorestframework
+Recommends: python-python-dateutil
Suggests: python-pip
-Suggests: python-shortuuid
Suggests: python-python-dateutil
+Suggests: python-shortuuid
BuildArch: noarch
%python_subpackages
++++++ django-extensions-2.2.1.tar.gz -> django-extensions-2.2.3.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/django-extensions-2.2.1/.travis.yml
new/django-extensions-2.2.3/.travis.yml
--- old/django-extensions-2.2.1/.travis.yml 2019-07-19 13:26:36.000000000
+0200
+++ new/django-extensions-2.2.3/.travis.yml 2019-10-02 22:08:52.000000000
+0200
@@ -44,12 +44,34 @@
dist: xenial
sudo: required
- python: 3.7
+ env: TOXENV=py37-dj30
+ dist: xenial
+ sudo: required
+ - python: 3.7
env: TOXENV=py37-dj22-postgres
dist: xenial
sudo: required
services:
- postgresql
- python: 3.7
+ env: TOXENV=py37-dj30-postgres
+ dist: xenial
+ sudo: required
+ services:
+ - postgresql
+ - python: 3.7
+ env: TOXENV=py37-dj22-mysql
+ dist: xenial
+ sudo: required
+ services:
+ - mysql
+ - python: 3.7
+ env: TOXENV=py37-dj30-mysql
+ dist: xenial
+ sudo: required
+ services:
+ - mysql
+ - python: 3.7
env: TOXENV=py37-djmaster
dist: xenial
sudo: required
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/django-extensions-2.2.1/CHANGELOG.md
new/django-extensions-2.2.3/CHANGELOG.md
--- old/django-extensions-2.2.1/CHANGELOG.md 2019-07-19 13:26:36.000000000
+0200
+++ new/django-extensions-2.2.3/CHANGELOG.md 2019-10-02 22:08:52.000000000
+0200
@@ -1,6 +1,27 @@
Changelog
=========
+2.2.3
+-----
+
+Changes:
+ - Fix: admin widgets, fix import of static template tag (part 2)
+
+2.2.2
+-----
+
+Changes:
+ - Fix: autoslugfield, find unique method overrideable
+ - Fix: notes, do not replace dot in template dirs
+ - Fix: admin widgets, fix import of static template tag
+ - Improvement: print_user_for_session, use session backend
+ - Improvement: sqlcreate, postgis support
+ - Improvement: graph_models, permit combination of includes and excludes
+ - Improvement: Adds missing GIS engine to DEFAULT_MYSQL_ENGINES
+ - Improvement: sqldiff, use lowercase field names in MySQL
+ - Improvement: sqldiff, mysql code could duplicate AUTO_INCREMENT and
UNSIGNED statements
+
+
2.2.1
-----
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/django-extensions-2.2.1/README.rst
new/django-extensions-2.2.3/README.rst
--- old/django-extensions-2.2.1/README.rst 2019-07-19 13:26:36.000000000
+0200
+++ new/django-extensions-2.2.3/README.rst 2019-10-02 22:08:52.000000000
+0200
@@ -30,7 +30,7 @@
The easiest way to figure out what Django Extensions are all about is to watch
the
`excellent screencast by Eric Holscher`__ (`watch the video on vimeo`__). In a
couple
minutes Eric walks you through a half a dozen command extensions. There is
also a
-`short screencast on GoDjango`__ to help show you even more.
+`short screencast on GoDjango's Youtube Channel`__ to help show you even more.
Requirements
@@ -123,4 +123,4 @@
__
http://ericholscher.com/blog/2008/sep/12/screencast-django-command-extensions/
__ http://vimeo.com/1720508
-__ https://godjango.com/39-be-more-productive-with-django_extensions/
+__ https://www.youtube.com/watch?v=1F6G3ONhr4k
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/django-extensions-2.2.1/django_extensions/__init__.py
new/django-extensions-2.2.3/django_extensions/__init__.py
--- old/django-extensions-2.2.1/django_extensions/__init__.py 2019-07-19
13:26:36.000000000 +0200
+++ new/django-extensions-2.2.3/django_extensions/__init__.py 2019-10-02
22:08:52.000000000 +0200
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
-VERSION = (2, 2, 1)
+VERSION = (2, 2, 3)
def get_version(version):
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/django-extensions-2.2.1/django_extensions/admin/widgets.py
new/django-extensions-2.2.3/django_extensions/admin/widgets.py
--- old/django-extensions-2.2.1/django_extensions/admin/widgets.py
2019-07-19 13:26:36.000000000 +0200
+++ new/django-extensions-2.2.3/django_extensions/admin/widgets.py
2019-10-02 22:08:52.000000000 +0200
@@ -4,7 +4,11 @@
from django import forms
from django.contrib.admin.sites import site
from django.contrib.admin.widgets import ForeignKeyRawIdWidget
-from django.contrib.admin.templatetags.admin_static import static
+try:
+ from django.templatetags.static import static
+except ImportError:
+ # compatibility with django < 2.1
+ from django.contrib.admin.templatetags.admin_static import static
try:
from django.urls import reverse
except ImportError:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/django-extensions-2.2.1/django_extensions/db/fields/__init__.py
new/django-extensions-2.2.3/django_extensions/db/fields/__init__.py
--- old/django-extensions-2.2.1/django_extensions/db/fields/__init__.py
2019-07-19 13:26:36.000000000 +0200
+++ new/django-extensions-2.2.3/django_extensions/db/fields/__init__.py
2019-10-02 22:08:52.000000000 +0200
@@ -232,7 +232,7 @@
setattr(model_instance, self.attname, slug)
return slug
- return super(AutoSlugField, self).find_unique(
+ return self.find_unique(
model_instance, slug_field, self.slug_generator(original_slug,
start))
def get_slug_fields(self, model_instance, lookup_value):
@@ -365,7 +365,7 @@
setattr(model_instance, self.attname, new)
return new
- return super(RandomCharField, self).find_unique(
+ return self.find_unique(
model_instance,
model_instance._meta.get_field(self.attname),
random_chars,
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/django-extensions-2.2.1/django_extensions/management/commands/notes.py
new/django-extensions-2.2.3/django_extensions/management/commands/notes.py
--- old/django-extensions-2.2.1/django_extensions/management/commands/notes.py
2019-07-19 13:26:36.000000000 +0200
+++ new/django-extensions-2.2.3/django_extensions/management/commands/notes.py
2019-10-02 22:08:52.000000000 +0200
@@ -31,13 +31,12 @@
@signalcommand
def handle(self, *args, **options):
# don't add django internal code
- apps = [app for app in filter(lambda app: not
app.startswith('django.contrib'), settings.INSTALLED_APPS)]
+ apps = [app.replace(".", "/") for app in filter(lambda app: not
app.startswith('django.contrib'), settings.INSTALLED_APPS)]
template_dirs = get_template_setting('DIRS', [])
base_dir = getattr(settings, 'BASE_DIR')
if template_dirs:
apps += template_dirs
for app_dir in apps:
- app_dir = app_dir.replace(".", "/")
if base_dir:
app_dir = os.path.join(base_dir, app_dir)
for top, dirs, files in os.walk(app_dir):
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/django-extensions-2.2.1/django_extensions/management/commands/print_user_for_session.py
new/django-extensions-2.2.3/django_extensions/management/commands/print_user_for_session.py
---
old/django-extensions-2.2.1/django_extensions/management/commands/print_user_for_session.py
2019-07-19 13:26:36.000000000 +0200
+++
new/django-extensions-2.2.3/django_extensions/management/commands/print_user_for_session.py
2019-10-02 22:08:52.000000000 +0200
@@ -4,10 +4,9 @@
import importlib
from django.conf import settings
-from django.contrib.auth import get_user_model
+from django.contrib.auth import load_backend, BACKEND_SESSION_KEY, SESSION_KEY
from django.contrib.sessions.backends.base import VALID_KEY_CHARS
from django.core.management.base import BaseCommand, CommandError
-
from django_extensions.management.utils import signalcommand
@@ -39,8 +38,12 @@
print('Session to Expire: %s' % session.get_expiry_date())
print('Raw Data: %s' % data)
+ uid = data.get(SESSION_KEY, None)
+ backend_path = data.get(BACKEND_SESSION_KEY, None)
- uid = data.get('_auth_user_id', None)
+ if backend_path is None:
+ print('No authentication backend associated with session')
+ return
if uid is None:
print('No user associated with session')
@@ -48,10 +51,9 @@
print(u"User id: %s" % uid)
- User = get_user_model()
- try:
- user = User.objects.get(pk=uid)
- except User.DoesNotExist:
+ backend = load_backend(backend_path)
+ user = backend.get_user(user_id=uid)
+ if user is None:
print("No user associated with that id.")
return
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/django-extensions-2.2.1/django_extensions/management/commands/shell_plus.py
new/django-extensions-2.2.3/django_extensions/management/commands/shell_plus.py
---
old/django-extensions-2.2.1/django_extensions/management/commands/shell_plus.py
2019-07-19 13:26:36.000000000 +0200
+++
new/django-extensions-2.2.3/django_extensions/management/commands/shell_plus.py
2019-10-02 22:08:52.000000000 +0200
@@ -469,9 +469,10 @@
finally:
execution_time = time.time() - starttime
raw_sql = self.db.ops.last_executed_query(self.cursor,
sql, params)
+ if truncate:
+ raw_sql = raw_sql[:truncate]
if sqlparse:
- raw_sql = raw_sql[:truncate]
raw_sql = sqlparse.format(raw_sql,
**sqlparse_format_kwargs)
if pygments:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/django-extensions-2.2.1/django_extensions/management/commands/sqlcreate.py
new/django-extensions-2.2.3/django_extensions/management/commands/sqlcreate.py
---
old/django-extensions-2.2.1/django_extensions/management/commands/sqlcreate.py
2019-07-19 13:26:36.000000000 +0200
+++
new/django-extensions-2.2.3/django_extensions/management/commands/sqlcreate.py
2019-10-02 22:08:52.000000000 +0200
@@ -57,7 +57,7 @@
dbname, dbuser, dbclient, dbpass
))
- elif engine in ('postgresql', 'postgresql_psycopg2'):
+ elif engine in ('postgresql', 'postgresql_psycopg2', 'postgis'):
if options['drop']:
print("DROP DATABASE IF EXISTS %s;" % (dbname,))
print("DROP USER IF EXISTS %s;" % (dbuser,))
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/django-extensions-2.2.1/django_extensions/management/commands/sqldiff.py
new/django-extensions-2.2.3/django_extensions/management/commands/sqldiff.py
---
old/django-extensions-2.2.1/django_extensions/management/commands/sqldiff.py
2019-07-19 13:26:36.000000000 +0200
+++
new/django-extensions-2.2.3/django_extensions/management/commands/sqldiff.py
2019-10-02 22:08:52.000000000 +0200
@@ -203,10 +203,6 @@
self.introspection = connection.introspection
- self.cursor = connection.cursor()
- self.django_tables =
self.introspection.django_table_names(only_existing=options['only_existing'])
- # TODO: We are losing information about tables which are views here
- self.db_tables = [table_info.name for table_info in
self.introspection.get_table_list(self.cursor)]
self.differences = []
self.unknown_db_fields = {}
self.new_db_fields = set()
@@ -231,6 +227,12 @@
'notnull-differ': self.SQL_NOTNULL_DIFFER,
}
+ def load(self):
+ self.cursor = connection.cursor()
+ self.django_tables =
self.introspection.django_table_names(only_existing=self.options['only_existing'])
+ # TODO: We are losing information about tables which are views here
+ self.db_tables = [table_info.name for table_info in
self.introspection.get_table_list(self.cursor)]
+
if self.can_detect_notnull_differ:
self.load_null()
@@ -254,6 +256,9 @@
# type: () -> Dict[int, Union[str, Callable]]
return self.DATA_TYPES_REVERSE_OVERRIDE
+ def format_field_names(self, field_names):
+ return field_names
+
def sql_to_dict(self, query, param):
"""
Execute query and return a dict
@@ -265,6 +270,7 @@
cursor = connection.cursor()
cursor.execute(query, param)
fieldnames = [name[0] for name in cursor.description]
+ fieldnames = self.format_field_names(fieldnames)
result = []
for row in cursor.fetchall():
rowset = []
@@ -348,7 +354,7 @@
tablespace = field.db_tablespace
if not tablespace:
tablespace = "public"
- if (tablespace, table_name, field.column) in self.unsigned:
+ if (tablespace, table_name, field.column) in self.unsigned and
self.unsigned_suffix not in field_db_type:
field_db_type = '%s %s' % (field_db_type, self.unsigned_suffix)
return field_db_type
@@ -361,8 +367,8 @@
module_path, package_name = class_path.rsplit('.', 1)
module = importlib.import_module(module_path)
return getattr(module, package_name)
- else:
- return getattr(models, class_path)
+
+ return getattr(models, class_path)
def get_field_db_nullable(self, field, table_name):
tablespace = field.db_tablespace
@@ -744,6 +750,13 @@
class GenericSQLDiff(SQLDiff):
can_detect_notnull_differ = False
+ can_detect_unsigned_differ = False
+
+ def load_null(self):
+ pass
+
+ def load_unsigned(self):
+ pass
class MySQLDiff(SQLDiff):
@@ -751,11 +764,14 @@
can_detect_unsigned_differ = True
unsigned_suffix = 'UNSIGNED'
- def __init__(self, *args, **kwargs):
- super(MySQLDiff, self).__init__(*args, **kwargs)
+ def load(self):
+ super(MySQLDiff, self).load()
self.auto_increment = set()
self.load_auto_increment()
+ def format_field_names(self, field_names):
+ return [f.lower() for f in field_names]
+
def load_null(self):
tablespace = 'public'
for table_name in self.db_tables:
@@ -811,13 +827,14 @@
# just convert it back to it's proper type, a bool is a bool and
nothing else.
if db_type == 'integer' and description[1] == FIELD_TYPE.TINY and
description[2] == 1:
db_type = 'bool'
- if (table_name, field.column) in self.auto_increment:
+ if (table_name, field.column) in self.auto_increment and
'AUTO_INCREMENT' not in db_type:
db_type += ' AUTO_INCREMENT'
return db_type
class SqliteSQLDiff(SQLDiff):
can_detect_notnull_differ = True
+ can_detect_unsigned_differ = False
def load_null(self):
for table_name in self.db_tables:
@@ -829,11 +846,15 @@
key = (tablespace, table_name, table_info['name'])
self.null[key] = not table_info['notnull']
+ def load_unsigned(self):
+ pass
+
# Unique does not seem to be implied on Sqlite for Primary_key's
# if this is more generic among databases this might be usefull
# to add to the superclass's find_unique_missing_in_db method
- def find_unique_missing_in_db(self, meta, table_indexes,
table_constraints, table_name):
- skip_list = []
+ def find_unique_missing_in_db(self, meta, table_indexes,
table_constraints, table_name, skip_list=None):
+ if skip_list is None:
+ skip_list = []
unique_columns = [field.db_column or field.attname for field in
all_local_fields(meta) if field.unique]
@@ -864,7 +885,7 @@
def get_field_db_type(self, description, field=None, table_name=None):
db_type = super(SqliteSQLDiff, self).get_field_db_type(description,
field, table_name)
if not db_type:
- return
+ return None
if field:
field_type = self.get_field_model_type(field)
# Fix char/varchar inconsistencies
@@ -885,26 +906,26 @@
# Hopefully in the future we can add constraint checking and other more
# advanced checks based on this database.
SQL_LOAD_CONSTRAINTS = """
- SELECT nspname, relname, conname, attname,
pg_get_constraintdef(pg_constraint.oid)
- FROM pg_constraint
- INNER JOIN pg_attribute ON pg_constraint.conrelid = pg_attribute.attrelid
AND pg_attribute.attnum = any(pg_constraint.conkey)
- INNER JOIN pg_class ON conrelid=pg_class.oid
- INNER JOIN pg_namespace ON pg_namespace.oid=pg_class.relnamespace
- ORDER BY CASE WHEN contype='f' THEN 0 ELSE 1
END,contype,nspname,relname,conname;
+ SELECT nspname, relname, conname, attname,
pg_get_constraintdef(pg_constraint.oid)
+ FROM pg_constraint
+ INNER JOIN pg_attribute ON pg_constraint.conrelid =
pg_attribute.attrelid AND pg_attribute.attnum = any(pg_constraint.conkey)
+ INNER JOIN pg_class ON conrelid=pg_class.oid
+ INNER JOIN pg_namespace ON pg_namespace.oid=pg_class.relnamespace
+ ORDER BY CASE WHEN contype='f' THEN 0 ELSE 1
END,contype,nspname,relname,conname;
"""
SQL_LOAD_NULL = """
- SELECT nspname, relname, attname, attnotnull
- FROM pg_attribute
- INNER JOIN pg_class ON attrelid=pg_class.oid
- INNER JOIN pg_namespace ON pg_namespace.oid=pg_class.relnamespace;
+ SELECT nspname, relname, attname, attnotnull
+ FROM pg_attribute
+ INNER JOIN pg_class ON attrelid=pg_class.oid
+ INNER JOIN pg_namespace ON pg_namespace.oid=pg_class.relnamespace;
"""
SQL_FIELD_TYPE_DIFFER = lambda self, style, qn, args: "%s %s\n\t%s %s %s
%s;" % (style.SQL_KEYWORD('ALTER TABLE'), style.SQL_TABLE(qn(args[0])),
style.SQL_KEYWORD('ALTER'), style.SQL_FIELD(qn(args[1])),
style.SQL_KEYWORD("TYPE"), style.SQL_COLTYPE(args[2]))
SQL_FIELD_PARAMETER_DIFFER = lambda self, style, qn, args: "%s %s\n\t%s %s
%s %s;" % (style.SQL_KEYWORD('ALTER TABLE'), style.SQL_TABLE(qn(args[0])),
style.SQL_KEYWORD('ALTER'), style.SQL_FIELD(qn(args[1])),
style.SQL_KEYWORD("TYPE"), style.SQL_COLTYPE(args[2]))
SQL_NOTNULL_DIFFER = lambda self, style, qn, args: "%s %s\n\t%s %s %s %s;"
% (style.SQL_KEYWORD('ALTER TABLE'), style.SQL_TABLE(qn(args[0])),
style.SQL_KEYWORD('ALTER COLUMN'), style.SQL_FIELD(qn(args[1])),
style.SQL_KEYWORD(args[2]), style.SQL_KEYWORD('NOT NULL'))
- def __init__(self, *args, **kwargs):
- super(PostgresqlSQLDiff, self).__init__(*args, **kwargs)
+ def load(self):
+ super(PostgresqlSQLDiff, self).load()
self.check_constraints = {}
self.load_constraints()
@@ -1251,6 +1272,7 @@
cls = DATABASE_SQLDIFF_CLASSES.get(engine, GenericSQLDiff)
sqldiff_instance = cls(app_models, options, stdout=self.stdout,
stderr=self.stderr)
+ sqldiff_instance.load()
sqldiff_instance.find_differences()
if not sqldiff_instance.has_differences:
self.exit_code = 0
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/django-extensions-2.2.1/django_extensions/management/modelviz.py
new/django-extensions-2.2.3/django_extensions/management/modelviz.py
--- old/django-extensions-2.2.1/django_extensions/management/modelviz.py
2019-07-19 13:26:36.000000000 +0200
+++ new/django-extensions-2.2.3/django_extensions/management/modelviz.py
2019-10-02 22:08:52.000000000 +0200
@@ -381,18 +381,18 @@
Decide whether to use a model, based on the model name and the lists of
models to exclude and include.
"""
+ # Check against include list.
+ if self.include_models:
+ for model_pattern in self.include_models:
+ model_pattern = '^%s$' % model_pattern.replace('*', '.*')
+ if re.search(model_pattern, model_name):
+ return True
# Check against exclude list.
if self.exclude_models:
for model_pattern in self.exclude_models:
model_pattern = '^%s$' % model_pattern.replace('*', '.*')
if re.search(model_pattern, model_name):
return False
- # Check against exclude list.
- elif self.include_models:
- for model_pattern in self.include_models:
- model_pattern = '^%s$' % model_pattern.replace('*', '.*')
- if re.search(model_pattern, model_name):
- return True
# Return `True` if `include_models` is falsey, otherwise return
`False`.
return not self.include_models
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/django-extensions-2.2.1/django_extensions/settings.py
new/django-extensions-2.2.3/django_extensions/settings.py
--- old/django-extensions-2.2.1/django_extensions/settings.py 2019-07-19
13:26:36.000000000 +0200
+++ new/django-extensions-2.2.3/django_extensions/settings.py 2019-10-02
22:08:52.000000000 +0200
@@ -12,6 +12,7 @@
)
DEFAULT_MYSQL_ENGINES = (
'django.db.backends.mysql',
+ 'django.contrib.gis.db.backends.mysql',
)
DEFAULT_POSTGRESQL_ENGINES = (
'django.db.backends.postgresql',
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/django-extensions-2.2.1/django_extensions/templates/django_extensions/widgets/foreignkey_searchinput.html
new/django-extensions-2.2.3/django_extensions/templates/django_extensions/widgets/foreignkey_searchinput.html
---
old/django-extensions-2.2.1/django_extensions/templates/django_extensions/widgets/foreignkey_searchinput.html
2019-07-19 13:26:36.000000000 +0200
+++
new/django-extensions-2.2.3/django_extensions/templates/django_extensions/widgets/foreignkey_searchinput.html
2019-10-02 22:08:52.000000000 +0200
@@ -1,4 +1,4 @@
-{% load i18n staticfiles %}
+{% load i18n %}
<input type="text" id="lookup_{{ name }}" value="{{ label }}"
style="display:none;" />
<a href="{{ related_url }}{{ url }}" class="related-lookup" id="lookup_id_{{
name }}" onclick="return showRelatedObjectLookupPopup(this);"></a>
<script type="text/javascript">
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/django-extensions-2.2.1/docs/conf.py
new/django-extensions-2.2.3/docs/conf.py
--- old/django-extensions-2.2.1/docs/conf.py 2019-07-19 13:26:36.000000000
+0200
+++ new/django-extensions-2.2.3/docs/conf.py 2019-10-02 22:08:52.000000000
+0200
@@ -47,7 +47,7 @@
# The short X.Y version.
version = '2.2'
# The full version, including alpha/beta/rc tags.
-release = '2.2.1'
+release = '2.2.3'
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/django-extensions-2.2.1/docs/graph_models.rst
new/django-extensions-2.2.3/docs/graph_models.rst
--- old/django-extensions-2.2.1/docs/graph_models.rst 2019-07-19
13:26:36.000000000 +0200
+++ new/django-extensions-2.2.3/docs/graph_models.rst 2019-10-02
22:08:52.000000000 +0200
@@ -115,6 +115,12 @@
::
+ # Create a graph including models matching a given pattern and excluding
some of them
+ # It will first select the included ones, then filter out the ones to exclude
+ $ ./manage.py graph_models -a -I Product* -X *Meta -o
my_project_products_sans_meta.png
+
+::
+
# Create a graph without showing its edges' labels
$ ./manage.py graph_models -a --hide-edge-labels -o
my_project_sans_foo_bar.png
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/django-extensions-2.2.1/docs/shell_plus.rst
new/django-extensions-2.2.3/docs/shell_plus.rst
--- old/django-extensions-2.2.1/docs/shell_plus.rst 2019-07-19
13:26:36.000000000 +0200
+++ new/django-extensions-2.2.3/docs/shell_plus.rst 2019-10-02
22:08:52.000000000 +0200
@@ -108,9 +108,12 @@
SHELL_PLUS_PRINT_SQL = True
- # Truncate sql queries to this number of characters
+ # Truncate sql queries to this number of characters (this is the default)
SHELL_PLUS_PRINT_SQL_TRUNCATE = 1000
+ # To disable truncation of sql queries use
+ SHELL_PLUS_PRINT_SQL_TRUNCATE = None
+
# Specify sqlparse configuration options when printing sql queries to the
console
SHELL_PLUS_SQLPARSE_FORMAT_KWARGS = dict(
reindent_aligned=True,
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/django-extensions-2.2.1/tests/management/commands/test_notes.py
new/django-extensions-2.2.3/tests/management/commands/test_notes.py
--- old/django-extensions-2.2.1/tests/management/commands/test_notes.py
2019-07-19 13:26:36.000000000 +0200
+++ new/django-extensions-2.2.3/tests/management/commands/test_notes.py
2019-10-02 22:08:52.000000000 +0200
@@ -23,6 +23,28 @@
def test_with_template_dirs(capsys, settings, tmpdir_factory):
templates_dirs_path = tmpdir_factory.getbasetemp().strpath
template_path = os.path.join(templates_dirs_path, 'fixme.html')
+ os.mkdir(os.path.join(templates_dirs_path, 'sub.path'))
+ sub_path = os.path.join(templates_dirs_path, 'sub.path', 'todo.html')
+ settings.TEMPLATES[0]['DIRS'] = [templates_dirs_path]
+ with open(template_path, 'w') as f:
+ f.write('''{# FIXME This is a comment. #}
+{# TODO Do not show this. #}''')
+ with open(sub_path, 'w') as f:
+ f.write('''{# FIXME This is a second comment. #}
+{# TODO Do not show this. #}''')
+
+ call_command('notes', '--tag=FIXME')
+ out, err = capsys.readouterr()
+
+ assert '{}:\n * [ 1] FIXME This is a comment.'.format(template_path) in
out
+ assert '{}:\n * [ 1] FIXME This is a second comment.'.format(sub_path)
in out
+ assert 'TODO Do not show this.' not in out
+
+
+def test_with_template_sub_dirs(capsys, settings, tmpdir_factory):
+ templates_dirs_path = tmpdir_factory.getbasetemp().strpath
+ os.mkdir(os.path.join(templates_dirs_path, 'test.path'))
+ template_path = os.path.join(templates_dirs_path, 'test.path',
'fixme.html')
settings.TEMPLATES[0]['DIRS'] = [templates_dirs_path]
with open(template_path, 'w') as f:
f.write('''{# FIXME This is a comment. #}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/django-extensions-2.2.1/tests/management/commands/test_print_user_for_session.py
new/django-extensions-2.2.3/tests/management/commands/test_print_user_for_session.py
---
old/django-extensions-2.2.1/tests/management/commands/test_print_user_for_session.py
2019-07-19 13:26:36.000000000 +0200
+++
new/django-extensions-2.2.3/tests/management/commands/test_print_user_for_session.py
2019-10-02 22:08:52.000000000 +0200
@@ -48,6 +48,19 @@
self.assertIn('No user associated with session', m_stdout.getvalue())
@patch('sys.stdout', new_callable=StringIO)
+ def
test_should_print_that_there_is_no_backend_associated_with_given_session(self,
m_stdout):
+ session = self.engine.SessionStore()
+ session.update({
+ '_auth_user_id': 1234,
+ '_auth_user_hash': 'b67352fde8582b12f068c10fd9d29f9fa1af0459',
+ })
+ session.create()
+
+ call_command('print_user_for_session', session.session_key)
+
+ self.assertIn('No authentication backend associated with session',
m_stdout.getvalue())
+
+ @patch('sys.stdout', new_callable=StringIO)
def test_should_print_that_there_is_no_user_associated_with_id(self,
m_stdout):
session = self.engine.SessionStore()
session.update({
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/django-extensions-2.2.1/tests/test_admin_widgets.py
new/django-extensions-2.2.3/tests/test_admin_widgets.py
--- old/django-extensions-2.2.1/tests/test_admin_widgets.py 2019-07-19
13:26:36.000000000 +0200
+++ new/django-extensions-2.2.3/tests/test_admin_widgets.py 2019-10-02
22:08:52.000000000 +0200
@@ -35,3 +35,17 @@
# Just making sure rendering the widget doesn't cause any issue
widget.render('person', person.pk)
widget.render('person', None)
+
+ # Check media to make sure rendering media doesn't cause any issue
+ self.assertListEqual(
+ [
+ '/static/django_extensions/js/jquery.bgiframe.js',
+ '/static/django_extensions/js/jquery.ajaxQueue.js',
+ '/static/django_extensions/js/jquery.autocomplete.js',
+ ],
+ widget.media._js,
+ )
+ self.assertListEqual(
+ ['/static/django_extensions/css/jquery.autocomplete.css'],
+ list(widget.media._css['all']),
+ )
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/django-extensions-2.2.1/tests/test_autoslug_fields.py
new/django-extensions-2.2.3/tests/test_autoslug_fields.py
--- old/django-extensions-2.2.1/tests/test_autoslug_fields.py 2019-07-19
13:26:36.000000000 +0200
+++ new/django-extensions-2.2.3/tests/test_autoslug_fields.py 2019-10-02
22:08:52.000000000 +0200
@@ -14,6 +14,7 @@
ChildSluggedTestModel, CustomFuncPrecedenceSluggedTestModel,
CustomFuncSluggedTestModel,
FKSluggedTestModel, FKSluggedTestModelCallable, FunctionSluggedTestModel,
ModelMethodSluggedTestModel, SluggedTestModel,
SluggedTestNoOverwriteOnAddModel,
+ OverridedFindUniqueModel,
)
@@ -189,6 +190,14 @@
m.save()
self.assertEqual(m.slug, 'slug')
+ def test_overrided_find_unique_autoslug_field(self):
+ m = OverridedFindUniqueModel(title='foo')
+ slug_field = m._meta.fields[2]
+ self.assertFalse(hasattr(slug_field, 'overrided'))
+ m.save()
+ slug_field = m._meta.fields[2]
+ self.assertTrue(slug_field.overrided)
+
def test_slugify_func(self):
to_upper = lambda c: c.upper()
to_lower = lambda c: c.lower()
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/django-extensions-2.2.1/tests/test_management_command.py
new/django-extensions-2.2.3/tests/test_management_command.py
--- old/django-extensions-2.2.1/tests/test_management_command.py
2019-07-19 13:26:36.000000000 +0200
+++ new/django-extensions-2.2.3/tests/test_management_command.py
2019-10-02 22:08:52.000000000 +0200
@@ -138,6 +138,7 @@
'*WildcardPrefixExclude',
'WildcardSuffixExclude*',
'*WildcardBothExclude*',
+ '*Include',
]
# Any model name should be used if neither include or exclude
# are defined.
@@ -220,6 +221,19 @@
None,
exclude_models,
))
+ # Test with `exclude_models` and `include_models` combined
+ # where the user wants to exclude some models through a wildcard
+ # while still being able to include given models
+ self.assertTrue(use_model(
+ 'MyWildcardPrefixInclude',
+ include_models,
+ exclude_models
+ ))
+ self.assertFalse(use_model(
+ 'MyInclude',
+ include_models,
+ exclude_models
+ ))
def test_no_models_dot_py(self):
data = generate_graph_data(['testapp_with_no_models_file'])
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/django-extensions-2.2.1/tests/test_sqldiff.py
new/django-extensions-2.2.3/tests/test_sqldiff.py
--- old/django-extensions-2.2.1/tests/test_sqldiff.py 2019-07-19
13:26:36.000000000 +0200
+++ new/django-extensions-2.2.3/tests/test_sqldiff.py 2019-10-02
22:08:52.000000000 +0200
@@ -1,4 +1,5 @@
# -*- coding: utf-8 -*-
+import mock
import six
import pytest
from django.conf import settings
@@ -6,24 +7,29 @@
from django.test import TestCase
# from django.core.management import call_command
-from django_extensions.management.commands.sqldiff import SqliteSQLDiff,
Command
+from django_extensions.management.commands.sqldiff import SqliteSQLDiff,
Command, MySQLDiff, PostgresqlSQLDiff
class SqlDiffTests(TestCase):
+
+ def setUp(self):
+ self.parser = Command().create_parser("test", "sqldiff")
+ self.args = ["-a"]
+ self.options = self.parser.parse_args(args=self.args)
+ self.tmp_out = six.StringIO()
+ self.tmp_err = six.StringIO()
+
def _include_proxy_models_testing(self, should_include_proxy_models): #
type: (bool) -> ()
- parser = Command().create_parser("test", "sqldiff")
- args = ["-a"]
if should_include_proxy_models:
- args.append("--include-proxy-models")
- options = parser.parse_args(args=args)
- tmp_out = six.StringIO()
- tmp_err = six.StringIO()
+ self.args.append("--include-proxy-models")
+ self.options = self.parser.parse_args(args=self.args)
instance = SqliteSQLDiff(
apps.get_models(include_auto_created=True),
- vars(options),
- stdout=tmp_out,
- stderr=tmp_err,
+ vars(self.options),
+ stdout=self.tmp_out,
+ stderr=self.tmp_err,
)
+ instance.load()
instance.find_differences()
checked_models = {"%s.%s" % (app_label, model_name) for app_label,
model_name, _ in instance.differences}
self.assertEqual(should_include_proxy_models,
"testapp.PostWithTitleOrdering" in checked_models)
@@ -36,6 +42,64 @@
def test_sql_diff_with_proxy_models(self):
self._include_proxy_models_testing(True)
+ def test_format_field_names(self):
+ instance = MySQLDiff(
+ apps.get_models(include_auto_created=True),
+ vars(self.options),
+ stdout=self.tmp_out,
+ stderr=self.tmp_err,
+ )
+ expected_field_name = ['name', 'email', 'address']
+ self.assertEquals(instance.format_field_names(['Name', 'EMAIL',
'aDDress']), expected_field_name)
+
+ @pytest.mark.skipif(settings.DATABASES['default']['ENGINE'] !=
'django.db.backends.mysql', reason="Test can only run on mysql")
+ def test_mysql_to_dict(self):
+ mysql_instance = MySQLDiff(
+ apps.get_models(include_auto_created=True),
+ vars(self.options),
+ stdout=self.tmp_out,
+ stderr=self.tmp_err,
+ )
+ mysql_dict = mysql_instance.sql_to_dict("""select 1 as "foo", 1 + 1 as
"BAR";""", [])
+ self.assertEquals(mysql_dict, [{'bar': 2, 'foo': 1}])
+
+ @pytest.mark.skipif(settings.DATABASES['default']['ENGINE'] !=
'django.db.backends.mysql', reason="Test can only run on mysql")
+
@mock.patch('django_extensions.management.commands.sqldiff.MySQLDiff.format_field_names')
+ def test_invalid_mysql_to_dict(self, format_field_names):
+ format_field_names.side_effect = lambda x: x
+ mysql_instance = MySQLDiff(
+ apps.get_models(include_auto_created=True),
+ vars(self.options),
+ stdout=self.tmp_out,
+ stderr=self.tmp_err,
+ )
+ mysql_dict = mysql_instance.sql_to_dict("""select 1 as "foo", 1 + 1 as
"BAR";""", [])
+ self.assertNotEquals(mysql_dict, [{'bar': 2, 'foo': 1}])
+
+ @pytest.mark.skipif(settings.DATABASES['default']['ENGINE'] !=
'django.db.backends.sqlite3', reason="Test can only run on sqlite3")
+ def test_sqlite_to_dict(self):
+ sqlite_instance = SqliteSQLDiff(
+ apps.get_models(include_auto_created=True),
+ vars(self.options),
+ stdout=self.tmp_out,
+ stderr=self.tmp_err,
+ )
+
+ sqlite_dict = sqlite_instance.sql_to_dict("""select 1 as "foo", 1 + 1
as "BAR";""", [])
+ self.assertEquals(sqlite_dict, [{'BAR': 2, 'foo': 1}])
+
+ @pytest.mark.skipif(settings.DATABASES['default']['ENGINE'] !=
'django.db.backends.postgresql', reason="Test can only run on postgresql")
+ def test_postgresql_to_dict(self):
+ postgresql_instance = PostgresqlSQLDiff(
+ apps.get_models(include_auto_created=True),
+ vars(self.options),
+ stdout=self.tmp_out,
+ stderr=self.tmp_err,
+ )
+
+ postgresql_dict = postgresql_instance.sql_to_dict("""select 1 as
"foo", 1 + 1 as "BAR";""", [])
+ self.assertEquals(postgresql_dict, [{'BAR': 2, 'foo': 1}])
+
# def test_sql_diff_run(self):
# tmp_out = six.StringIO()
# call_command("sqldiff", all_applications=True,
migrate_for_tests=True, stdout=tmp_out)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/django-extensions-2.2.1/tests/testapp/models.py
new/django-extensions-2.2.3/tests/testapp/models.py
--- old/django-extensions-2.2.1/tests/testapp/models.py 2019-07-19
13:26:36.000000000 +0200
+++ new/django-extensions-2.2.3/tests/testapp/models.py 2019-10-02
22:08:52.000000000 +0200
@@ -146,6 +146,17 @@
app_label = 'django_extensions'
+class OverridedFindUniqueAutoSlugField(AutoSlugField):
+ def find_unique(self, model_instance, field, iterator, *args):
+ self.overrided = True
+ return super(OverridedFindUniqueAutoSlugField,
self).find_unique(model_instance, field, iterator, *args)
+
+
+class OverridedFindUniqueModel(models.Model):
+ title = models.CharField(max_length=42)
+ slug = OverridedFindUniqueAutoSlugField(populate_from='title')
+
+
class CustomFuncSluggedTestModel(models.Model):
def slugify_function(self, content):
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/django-extensions-2.2.1/tox.ini
new/django-extensions-2.2.3/tox.ini
--- old/django-extensions-2.2.1/tox.ini 2019-07-19 13:26:36.000000000 +0200
+++ new/django-extensions-2.2.3/tox.ini 2019-10-02 22:08:52.000000000 +0200
@@ -13,8 +13,10 @@
{py34,py35,py36,py37,pypy}-dj20
{py35,py36,py37,pypy}-dj21
{py35,py36,py37,pypy}-dj22
+ {py36,py37}-dj30
{py35,py36,py37,pypy}-djmaster
py37-dj22-postgres
+ py37-dj22-mysql
py37-djmaster-postgres
[testenv]
@@ -28,12 +30,15 @@
setenv =
postgres: DJANGO_EXTENSIONS_DATABASE_ENGINE =
{env:DJANGO_EXTENSIONS_DATABASE_ENGINE:django.db.backends.postgresql}
postgres: DJANGO_EXTENSIONS_DATABASE_NAME =
{env:DJANGO_EXTENSIONS_DATABASE_NAME:django_extensions_test}
+ mysql: DJANGO_EXTENSIONS_DATABASE_ENGINE =
{env:DJANGO_EXTENSIONS_DATABASE_ENGINE:django.db.backends.mysql}
+ mysql: DJANGO_EXTENSIONS_DATABASE_NAME =
{env:DJANGO_EXTENSIONS_DATABASE_NAME:django_extensions_test}
deps =
dj111: Django>=1.11,<2.0
dj20: Django>=2.0,<2.1
dj21: Django>=2.1,<2.2
dj22: Django==2.2
+ dj30: Django>=3.0a1,<3.1
djmaster: https://github.com/django/django/archive/master.tar.gz
shortuuid
werkzeug
@@ -48,6 +53,7 @@
mock
pygments
postgres: psycopg2-binary
+ mysql: mysqlclient
[testenv:precommit]
deps =