Skip to content

Commit

Permalink
Drop support for Django 2.2 (#22)
Browse files Browse the repository at this point in the history
  • Loading branch information
knyghty authored Apr 23, 2022
1 parent d620646 commit b68aa09
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 37 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
django-version: ["2.2", "3.2", "4.0"]
django-version: ["3.2", "4.0"]
python-version: ["3.7", "3.8", "3.9", "3.10"]
exclude:
- python-version: 3.7
Expand Down
6 changes: 2 additions & 4 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,8 @@
django-snakeoil
===============

django-snakeoil helps manage your ``<meta>`` tags.

Works on all supported Django versions using PostgreSQl, or with any database
on Django 3.1+.
django-snakeoil helps manage your ``<meta>`` tags. It works on all supported
Django versions and databases.

It offers full internationalization support (tags for multiple languages),
content set dynamically from object attributes, automatic Opengraph image
Expand Down
12 changes: 1 addition & 11 deletions snakeoil/migrations/0001_initial.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,6 @@

from django.db import migrations, models

try:
from django.db.models import JSONField

postgres_only = False
except ImportError:
from django.contrib.postgres.fields import JSONField # type: ignore

postgres_only = True


class Migration(migrations.Migration):

Expand All @@ -22,7 +13,7 @@ class Migration(migrations.Migration):
migrations.CreateModel(
name="SEOPath",
fields=[
("meta_tags", JSONField(default=dict, verbose_name="meta tags")),
("meta_tags", models.JSONField(default=dict, verbose_name="meta tags")),
(
"path",
models.CharField(
Expand All @@ -36,7 +27,6 @@ class Migration(migrations.Migration):
options={
"verbose_name": "SEO path",
"verbose_name_plural": "SEO paths",
"required_db_vendor": "postgresql" if postgres_only else None,
},
),
]
10 changes: 2 additions & 8 deletions snakeoil/migrations/0002_auto_20200727_0951.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
from django.db import migrations

try:
from django.db.models import JSONField

except ImportError:
from django.contrib.postgres.fields import JSONField # type: ignore
from django.db import migrations, models


class Migration(migrations.Migration):
Expand All @@ -17,6 +11,6 @@ class Migration(migrations.Migration):
migrations.AlterField(
model_name="seopath",
name="meta_tags",
field=JSONField(blank=True, default=dict, verbose_name="meta tags"),
field=models.JSONField(blank=True, default=dict, verbose_name="meta tags"),
),
]
14 changes: 1 addition & 13 deletions snakeoil/models.py
Original file line number Diff line number Diff line change
@@ -1,22 +1,12 @@
import django
from django.db import models
from django.utils.translation import gettext_lazy as _

if django.VERSION > (3, 0):
postgres_only = False
from django.db.models import JSONField
else:
postgres_only = True
from django.contrib.postgres.fields import JSONField # type: ignore


class SEOModel(models.Model):
meta_tags = JSONField(blank=True, default=dict, verbose_name=_("meta tags"))
meta_tags = models.JSONField(blank=True, default=dict, verbose_name=_("meta tags"))

class Meta:
abstract = True
if postgres_only:
required_db_vendor = "postgresql"


class SEOPath(SEOModel):
Expand All @@ -25,8 +15,6 @@ class SEOPath(SEOModel):
class Meta:
verbose_name = _("SEO path")
verbose_name_plural = _("SEO paths")
if postgres_only:
required_db_vendor = "postgresql"

def __str__(self) -> str:
return self.path

0 comments on commit b68aa09

Please sign in to comment.