Skip to content

Commit 6cc1f45

Browse files
committed
Support Django 6, improve README
1 parent ff8940e commit 6cc1f45

File tree

3 files changed

+26
-30
lines changed

3 files changed

+26
-30
lines changed

README.md

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# SQL Views for Postgres
22

33
Adds first-class support for [PostgreSQL Views][pg-views] in the Django ORM.
4-
Fork of the original [django-pgviews][django-pgviews] by [mypebble][mypebble] with support for Django 3.2+.
4+
Fork of the original [django-pgviews][django-pgviews] by [mypebble][mypebble] with support for later Djangos, Pythons, and new features.
55

66
[pg-views]: http://www.postgresql.org/docs/9.1/static/sql-createview.html
77
[django-pgviews]: https://github.com/mypebble/django-pgviews
@@ -49,8 +49,8 @@ class PreferredCustomer(pg.View):
4949
managed = False
5050
```
5151

52-
**NOTE** It is important that we include the `managed = False` in the `Meta` so
53-
Django 1.7 migrations don't attempt to create DB tables for this view.
52+
> [!NOTE]
53+
> It is important that we include the `managed = False` in the `Meta` so Django migrations don't attempt to create DB tables for this view.
5454
5555
The SQL produced by this might look like:
5656

@@ -82,7 +82,7 @@ class PreferredCustomer(pg.View):
8282
## Usage
8383

8484
To map onto a View, simply extend `pg_views.view.View`, assign SQL to the
85-
`sql` argument and define a `db_table`. You must _always_ set `managed = False`
85+
`sql` argument, and define a `db_table`. You must _always_ set `managed = False`
8686
on the `Meta` class.
8787

8888
Views can be created in a number of ways:
@@ -132,12 +132,12 @@ class PreferredCustomer(pg.View):
132132
managed = False
133133
```
134134

135-
This will take all fields on `myapp.Customer` and apply them to
136-
`PreferredCustomer`
135+
This will take all fields on `myapp.Customer` and apply them to `PreferredCustomer`
137136

138137
## Features
139138

140139
### Configuration
140+
141141
`MATERIALIZED_VIEWS_DISABLE_SYNC_ON_MIGRATE`
142142

143143
When set to True, it skips running `sync_pgview` during migrations, which can be useful if you want to control the synchronization manually or avoid potential overhead during migrations. (default: False)
@@ -147,9 +147,8 @@ MATERIALIZED_VIEWS_DISABLE_SYNC_ON_MIGRATE = True
147147

148148
### Updating Views
149149

150-
Sometimes your models change and you need your Database Views to reflect the new
151-
data. Updating the View logic is as simple as modifying the underlying SQL and
152-
running:
150+
Sometimes your models change, and you need your Database Views to reflect the new data.
151+
Updating the View logic is as simple as modifying the underlying SQL and running:
153152

154153
```
155154
python manage.py sync_pgviews --force
@@ -159,12 +158,12 @@ This will forcibly update any views that conflict with your new SQL.
159158

160159
### Dependencies
161160

162-
You can specify other views you depend on. This ensures the other views are
163-
installed beforehand. Using dependencies also ensures that your views get
164-
refreshed correctly when using `sync_pgviews --force`.
161+
You can specify other views you depend on.
162+
This ensures the other views are installed beforehand.
163+
Using dependencies also ensures that your views get refreshed correctly when using `sync_pgviews --force`.
165164

166-
**Note:** Views are synced after the Django application has migrated and adding
167-
models to the dependency list will cause syncing to fail.
165+
> [!NOTE]
166+
> Views are synced after the Django application has migrated, and adding models to the dependency list will cause syncing to fail.
168167
169168
Example:
170169

@@ -184,12 +183,9 @@ class PreferredCustomer(pg.View):
184183
### Materialized Views
185184

186185
Postgres 9.3 and up supports [materialized views](http://www.postgresql.org/docs/current/static/sql-creatematerializedview.html)
187-
which allow you to cache the results of views, potentially allowing them
188-
to load faster.
186+
which allow you to cache the results of views, potentially allowing them to load faster.
189187

190-
However, you do need to manually refresh the view. To do this automatically,
191-
you can attach [signals](https://docs.djangoproject.com/en/1.8/ref/signals/)
192-
and call the refresh function.
188+
However, you do need to manually refresh the view. To do this automatically, you can attach [signals](https://docs.djangoproject.com/en/1.8/ref/signals/) and call the refresh function.
193189

194190
Example:
195191

@@ -477,9 +473,13 @@ to pin views to specific databases.
477473
<td>5.0</td>
478474
<td>0.9.4</td>
479475
</tr>
476+
<tr>
477+
<td>6.0</td>
478+
<td>0.13.0</td>
479+
</tr>
480480
</tbody>
481481
</table>
482482

483-
## Python 3 Support
483+
## Python Support
484484

485-
Django PGViews Redux only officially supports Python 3.7+, it might work on 3.6, but there's no guarantees.
485+
Django PGViews Redux only officially supports Python 3.10+, it might work on previous versions, but there are no guarantees.

pyproject.toml

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "django-pgviews-redux"
3-
version = "0.12.0"
3+
version = "0.13.0"
44
description = "Create and manage Postgres SQL Views in Django"
55
authors = ["Mikuláš Poul <mikulas.poul@xelix.com>"]
66
readme = "README.md"
@@ -16,11 +16,8 @@ classifiers = [
1616
"Programming Language :: Python :: 3.14",
1717
"Framework :: Django",
1818
"Framework :: Django :: 4.2",
19-
"Framework :: Django :: 5.0",
20-
"Framework :: Django :: 5.1",
2119
"Framework :: Django :: 5.2",
22-
"License :: Public Domain",
23-
"License :: OSI Approved :: The Unlicense (Unlicense)",
20+
"Framework :: Django :: 6.0",
2421
]
2522
include = ["UNLICENSE"]
2623
repository = "https://github.com/xelixdev/django-pgviews-redux"
@@ -67,7 +64,6 @@ select = [
6764
# Never enforce...
6865
ignore = [
6966
"E501", # line length violations
70-
"PT004", # missing-fixture-name-underscore
7167
"SIM108", # use-ternary-operator
7268
"RET505", # superfluous-else-return
7369
"RET506", # superfluous-else-raise

tox.ini

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
[tox]
22
envlist =
33
py{310,311}-dj{42}-pg{2,3}
4-
py{310,311,312,313,314}-dj{50,51,52}-pg{2,3}
4+
py{310,311,312,313,314}-dj{52}-pg{2,3}
5+
py{312,313,314}-dj{60}-pg{2,3}
56

67
[gh]
78
python =
@@ -20,9 +21,8 @@ deps=
2021
pg2: psycopg2>2.9
2122
pg3: psycopg>3.1
2223
dj42: https://github.com/django/django/archive/stable/4.2.x.tar.gz#egg=django
23-
dj50: https://github.com/django/django/archive/stable/5.0.x.tar.gz#egg=django
24-
dj51: https://github.com/django/django/archive/stable/5.1.x.tar.gz#egg=django
2524
dj52: https://github.com/django/django/archive/stable/5.2.x.tar.gz#egg=django
25+
dj60: https://github.com/django/django/archive/stable/6.0.x.tar.gz#egg=django
2626
commands=
2727
python manage.py test {posargs:test_project.viewtest test_project.multidbtest test_project.schemadbtest} -v2
2828
passenv =

0 commit comments

Comments
 (0)