Skip to content

Commit

Permalink
Merge pull request #75 from veselosky/v2dev
Browse files Browse the repository at this point in the history
Version 2: Significant refactor of the models
  • Loading branch information
veselosky authored May 4, 2024
2 parents 9d94cc6 + 3bb2646 commit 56707b5
Show file tree
Hide file tree
Showing 37 changed files with 2,820 additions and 758 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,18 @@ jobs:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
steps:
- name: Check out the code
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: pip

- name: Install test dependencies
run: |
python -m pip install --upgrade pip setuptools wheel
pip install build tox tox-gh-actions
pip install build "tox>=4.7.0" "tox-gh-actions>=3.0.0"
- name: Run the test suite
run: tox
run: tox run
7 changes: 7 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,13 @@
"console": "integratedTerminal",
"justMyCode": false,
"env": { "PYTEST_ADDOPTS": "--no-cov", "SITE_ID": "1" }
},
{
"name": "Static Mocks",
"type": "python",
"request": "launch",
"program": "${workspaceFolder}/mockups/serve.py",
"cwd": "${workspaceFolder}/mockups"
}
]
}
52 changes: 15 additions & 37 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ GenericSite is a Django app designed to get you that first 80% of your website
functionality as quickly as possible. It performs the undifferentiated heavy lifting so
you can focus on the 20% of the work that makes your site special.

GenericSite defines a data model based on the [open graph protocol](https://ogp.me),
extended in some places using fields from [Schema.org](https://schema.org) or other web
standards. It provides both concrete Django models for common web objects, and abstract
Django models if your prefer full customization of your data model.
GenericSite defines a data model based on [Schema.org](https://schema.org), extended in
some places using fields from the [open graph protocol](https://ogp.me), or other web
standards. It provides concrete Django models for common web objects, as well as an
abstract CreativeWork model for extending the available page types.

GenericSite includes a set of views to be used with the included models. These are based
on Django's generic class-based views. They can be used directly or subclassed to meet
Expand Down Expand Up @@ -46,16 +46,18 @@ Add the following to your `settings.py`:

```python
import genericsite.apps
INSTALLED_APPS = genericsite.apps.plus(
# Your apps here
)
INSTALLED_APPS = [
*genericsite.apps.CONTENT
# Optionally use tinymce in the admin
"tinymce",
# Other Django apps here, then
*genericsite.apps.ADMIN
]
MIDDLEWARE += [
"django.contrib.sites.middleware.CurrentSiteMiddleware",
"genericsite.redirects.TemporaryRedirectFallbackMiddleware",
]
THUMBNAIL_PROCESSORS = genericsite.apps.THUMBNAIL_PROCESSORS
THUMBNAIL_WIDGET_OPTIONS = genericsite.apps.THUMBNAIL_WIDGET_OPTIONS
THUMBNAIL_DEBUG = DEBUG
# If using tinymce
TINYMCE_DEFAULT_CONFIG = genericsite.apps.TINYMCE_CONFIG

# Add `genericsite.apps.context_defaults` to your context processors. You will also
Expand Down Expand Up @@ -98,8 +100,8 @@ urlpatterns = [
# path("accounts/", include("allauth.urls")),
# You need to add the admin yourself:
path("admin/", admin.site.urls),
# Admin docs are included in the GenericSite urlconf, don't add your own.
# TinyMCE urls are included in the GenericSite urlconf, too.
# TinyMCE urls if desired
path("tinymce/", include("tinymce.urls")),
# All other urls are handed to GenericSite
path("", include("genericsite.urls")),
]
Expand Down Expand Up @@ -156,7 +158,7 @@ the default templates/models can be found on the Admin Documentation page for Si

## Images and Media

GenericSite takes advantage of easy_thumbnails to manage images. Models are provided for
GenericSite takes advantage of Django Imagekit to manage images. Models are provided for
storing file metadata including copyright information.

GenericSite uses presets to produce images in specific sizes as recommended by
Expand All @@ -176,27 +178,3 @@ These named thumbnail settings are available:
- portrait_cover: 1000x1500
- portrait_social: 1080x1350
- portrait_hd: 1080x1920

## Open Graph attributes used by the templates

- title
- url
- type
- description
- locale
- site_name
- fb:app_id
- image.alt
- image.url
- image.secure_url
- image.type
- image.width
- image.height
- audio.url
- audio.secure_url
- audio.type
- video.url
- video.secure_url
- video.type
- video.width
- video.height
168 changes: 168 additions & 0 deletions mockups/SiteManager.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,168 @@
<!DOCTYPE html>
<html
prefix="og: https://ogp.me/ns#
article: https://ogp.me/ns/article#
book: https://ogp.me/ns/book#
profile: https://ogp.me/ns/profile#
video: https://ogp.me/ns/video#
"
lang="en"
>
<head>
<meta charset="utf-8" />
<title>Site Manager Mock Up</title>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<style>
:root {
/* Default variable for "light mode" */
--border-color: #ccc;
--color: black;
--color-muted: dimgray;
--color-inverse: white;
--background-color-muted: ghostwhite;
--background-color-inverse: darkslategray;
--border-radius: 0.25rem;
--link-color: darkgreen;
--link-color-inverse: greenyellow;
--symbol-button-size: 1.5em;
--max-list-column-width: 25%;
}
*,
*:before,
*:after {
box-sizing: border-box;
}
body {
font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
Oxygen, Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;
}
main {
display: flex;
flex-direction: row;
justify-content: start;
align-items: flex-start;
gap: 1rem;
}
.page-tree {
flex: 1 1 20%;
background-color: var(--background-color-muted);
color: var(--color-muted);
}
.page-tree p {
margin: 0;
padding: 0;
}
.page-tree p.add-page {
display: list-item;
list-style: inside "+";
}
.page-tree details p.add-page {
margin-left: 1rem;
}
details details {
margin-left: 1rem;
}
details details details {
margin-left: 2rem;
}
details details details details {
margin-left: 3rem;
}
details details details details details {
margin-left: 4rem;
}
details details details details details details {
margin-left: 5rem;
}
details details details details details details details {
margin-left: 6rem;
}
.page-content {
flex: 1 1 80%;
}
.go-button {
background-color: greenyellow;
color: darkgreen;
transition: box-shadow 0.25s ease-in-out;
display: flex;
align-items: center;
}
/* .go-button:hover,
.go-button:focus {
box-shadow: 0 0 1em 0.5em greenyellow;
} */
.symbol-button {
border: 1px solid green;
width: var(--symbol-button-size);
height: var(--symbol-button-size);
border-radius: 50%;
display: flex;
justify-content: center;
align-items: center;
text-decoration: none;
}
i.bi-plus {
width: var(--symbol-button-size);
height: var(--symbol-button-size);
}
i.bi-plus::before {
content: "";
color: darkgreen;
display: inline-block;
background-image: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' fill='currentColor' class='bi bi-plus' viewBox='0 0 16 16'> <path d='M8 4a.5.5 0 0 1 .5.5v3h3a.5.5 0 0 1 0 1h-3v3a.5.5 0 0 1-1 0v-3h-3a.5.5 0 0 1 0-1h3v-3A.5.5 0 0 1 8 4'/></svg>");
background-repeat: no-repeat;
width: var(--symbol-button-size);
height: var(--symbol-button-size);
}
</style>
</head>
<body class="">
<header class="page_header">
<h1>Site Manager Mock Up</h1>
</header>
<div class="precontent"></div>
<main class="">
<section class="page-tree">
<h2>Page Tree</h2>
<p class="add-page">
<a href="#">Add Page</a>
</p>
<details>
<summary>Home</summary>
<p class="add-page">
<a href="#">Add Child Page</a>
</p>
</details>
<details>
<summary>About</summary>
<details>
<summary>Contact</summary>
<p class="add-page">
<a href="#">Add Child Page</a>
</p>
</details>
<details>
<summary>Media Kit</summary>
<p class="add-page">
<a href="#">Add Child Page</a>
</p>
</details>
<p class="add-page">
<a href="#">Add Child Page</a>
</p>
</details>
</section>
<section class="page-content">
<h2 id="page-title">Page Content Here</h2>
<div class="page-content">
<p>This is where the page content will go.</p>
</div>
</section>
</main>
<div class="postcontent"></div>
<footer class="page_footer"></footer>
<script>
const pageTitle = document.getElementById("page-title");
</script>
</body>
</html>
10 changes: 10 additions & 0 deletions mockups/serve.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import http.server
import socketserver

PORT = 8001

Handler = http.server.SimpleHTTPRequestHandler

with socketserver.TCPServer(("", PORT), Handler) as httpd:
print("serving at port", PORT)
httpd.serve_forever()
20 changes: 8 additions & 12 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,15 @@
name = "django-genericsite"
dynamic = ["version"]
authors = [{ name = "Vince Veselosky", email = "[email protected]" }]
description = "basic templates for Django's generic views to produce a decent-looking website with minimal effort"
description = "basic data model and templates for Django's generic views to produce a decent-looking website with minimal effort"
readme = "README.md"
requires-python = ">=3.8"
dependencies = [
"django-bootstrap-icons>=0.7.8",
"django-taggit>=3.0.0",
"django-tinymce>=3.4.0",
"django<5.1,>=3.2",
"docutils>=0.19",
"easy-thumbnails>=2.8.4",
"pillow>=2.3.0",
"pydantic<2.0,>=1.9.1",
"django-imagekit>=5.0.0",
"django-taggit>=5.0.0",
"django<5.3,>=4.2",
"pillow>=10.1.0",
]
classifiers = [
"Programming Language :: Python :: 3",
Expand All @@ -23,14 +20,13 @@ classifiers = [

[project.optional-dependencies]
dev = [
"black",
"django-allauth>=0.51.0",
"django-debug-toolbar",
"django-environ",
"django-extensions",
"isort",
"pip-tools",
"pycodestyle",
"django-tinymce",
"djlint",
"docutils>=0.19",
"pytest",
"pytest-cov",
"pytest-django",
Expand Down
Loading

0 comments on commit 56707b5

Please sign in to comment.