Skip to content

Instantly share code, notes, and snippets.

View claudep's full-sized avatar

Claude Paroz claudep

View GitHub Profile
@claudep
claudep / save_restore_dependencies.sql
Last active February 23, 2024 06:09 — forked from mateuszwenus/save_restore_dependencies.sql
Replaced quotes by quote_ident
create table if not exists deps_saved_ddl
(
deps_id serial primary key,
deps_view_schema varchar(255),
deps_view_name varchar(255),
deps_ddl_to_run text
);
create or replace function deps_save_and_drop_dependencies(p_view_schema varchar, p_view_name varchar) returns void as
$$
@claudep
claudep / 27895.diff
Created March 7, 2017 16:14
Test for #27895
diff --git a/tests/test_client_regress/tests.py b/tests/test_client_regress/tests.py
index c9dffdb..0233786 100644
--- a/tests/test_client_regress/tests.py
+++ b/tests/test_client_regress/tests.py
@@ -1200,6 +1200,21 @@ class RequestMethodStringDataTests(SimpleTestCase):
response = self.client.get('/json_response/')
self.assertEqual(response.json(), {'key': 'value'})
+ def test_json_non_ascii(self):
+ """Test with both escaped and non-escaped UTF-8 content."""
diff --git a/tests/queries/tests.py b/tests/queries/tests.py
index 48b5737..145adf5 100644
--- a/tests/queries/tests.py
+++ b/tests/queries/tests.py
@@ -2483,6 +2483,19 @@ class ToFieldTests(TestCase):
[node1]
)
+ def test_isnull_query(self):
+ apple = Food.objects.create(name="apple")
diff --git a/django/contrib/auth/models.py b/django/contrib/auth/models.py
index 87c3adf..49bdb32 100644
--- a/django/contrib/auth/models.py
+++ b/django/contrib/auth/models.py
@@ -144,9 +144,8 @@ class UserManager(BaseUserManager):
"""
if not username:
raise ValueError('The given username must be set')
- email = self.normalize_email(email)
- username = self.normalize_username(username)
@claudep
claudep / 21523.diff
Last active April 18, 2016 08:19
Django issue #21523
diff --git a/django/db/models/fields/__init__.py b/django/db/models/fields/__init__.py
index a4018dd..5acf520 100644
--- a/django/db/models/fields/__init__.py
+++ b/django/db/models/fields/__init__.py
@@ -1286,14 +1286,14 @@ class DateField(DateTimeCheckMixin, Field):
def to_python(self, value):
if value is None:
return value
- if isinstance(value, datetime.datetime):
+ if hasattr(value, 'tzinfo') and hasattr(value, 'date'):
def test_connection_import_doesnt_configure_settings(self):
"""
Test that importing django.db doesn't trigger settings configuration.
"""
from django.conf import settings
from django.utils.functional import empty
old_wrapped = settings._wrapped
settings._wrapped = empty
try:
self.assertFalse(settings.configured)
/etc/ssh/sshd_config:
file.replace:
- pattern: Subsystem sftp /usr/lib/openssh/sftp-server
- repl: |
Subsystem sftp internal-sftp
Match Group sftponly
ChrootDirectory /home/sftpusers/%u
X11Forwarding no
AllowTcpForwarding no
ForceCommand internal-sftp
diff --git a/docs/templatetags/docs.py b/docs/templatetags/docs.py
index f43d998..3029f4c 100644
--- a/docs/templatetags/docs.py
+++ b/docs/templatetags/docs.py
@@ -38,8 +38,6 @@ class AllDocVersionsTag(template.Node):
def __init__(self, docurl, asvar):
self.docurl = template.Variable(docurl)
self.asvar = asvar
- # FIXME
- self.lang = 'en'
diff --git a/docs/fixtures/doc_releases.json b/docs/fixtures/doc_releases.json
index 56b5394..aa93fe8 100644
--- a/docs/fixtures/doc_releases.json
+++ b/docs/fixtures/doc_releases.json
@@ -82,5 +82,17 @@
"version": "1.5",
"docs_subdir": "docs"
}
+ },
+ {
diff --git a/django/utils/html.py b/django/utils/html.py
index 5732350..ebf97f8 100644
--- a/django/utils/html.py
+++ b/django/utils/html.py
@@ -137,12 +137,7 @@ def strip_tags(value):
"""Returns the given HTML with all tags stripped."""
s = MLStripper()
s.feed(value)
- data = s.get_data()
- try: