This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
*, *::before, *::after { | |
box-sizing: border-box; | |
} | |
* { | |
margin: 0; | |
} | |
body { | |
line-height: 1.5; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const Path = require('path'), | |
NodeExternals = require('webpack-node-externals'), | |
Copy = require('copy-webpack-plugin'), | |
Obfuscator = require('webpack-obfuscator') | |
module.exports = { | |
context: __dirname, | |
mode: 'production', | |
target: 'electron-main', | |
entry: { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[build-system] | |
build-backend = "setuptools.build_meta" | |
requires = [ | |
"setuptools", | |
"wheel", | |
] | |
[project] | |
name = "Django Project" | |
version = "0.0.1" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""Text utils.""" | |
strip_bom(value): | |
"""Strip Byte Order Mark from UTF-8 text.""" | |
return value.encode("utf-8").decode("utf-8-sig") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""Django storages.""" | |
from django.core.files.storage import FileSystemStorage | |
class FileSystemOverwriteStorage(FileSystemStorage): | |
"""A file system storage with file overwriting capabilities.""" | |
def get_available_name(self, name, max_length=None): | |
"""Return the available name.""" | |
self.delete(name) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""Django filters.""" | |
from django.contrib.admin import SimpleListFilter | |
class ArrayFieldListFilter(SimpleListFilter): | |
"""An admin list filter for ArrayFields.""" | |
def lookups(self, request, model_admin): | |
"""Return the filtered queryset.""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Initialise settings. | |
This implementation requires class-based definition of each environment | |
in an individual file (e.g. `production.py` / `class Production`). | |
This very init code should go in an `__init__.py` file in the same folder as the environment files. | |
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class FieldPermissionsMixin: | |
""" | |
Define a mixin handling read-only fields per group, admin model and form type. | |
!!!THIS IS JUST A STUB, AWAITING COMPLETION!!! | |
Read-only fields can be specified in a setting exemplified below. | |
For permission names, codenames without the model name are considered well-formed. | |
GROUPS = { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Requirements: | |
# - a model with `file`and `thumbnail` fields. | |
# - the smartcrop module for Python https://github.com/smartcrop/smartcrop.py | |
@admin.register(MyModel) | |
class MyModelAdmin(admin.ModelAdmin): | |
"""Set MyModel Admin.""" | |
formset = MyModelFormset | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""Define Django Response Mock.""" | |
import json | |
from django.conf import settings | |
from django.utils.translation import gettext_lazy as _ | |
class ResponseMock: | |
"""Define response mock.""" |
NewerOlder