This file contains hidden or 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 AddImage(LoginRequiredMixin, CreateView): | |
| """ | |
| adds a image | |
| """ | |
| form_class = ImageForm | |
| model = Image | |
| def get_template_names(self): | |
| if self.request.htmx: |
This file contains hidden or 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
| from django.utils.translation import gettext_lazy as _ | |
| from wagtail.images.formats import Format, register_image_format, unregister_image_format | |
| unregister_image_format('fullwidth') | |
| register_image_format(Format('fullwidth', _('Full width'), 'w-100 rounded-lg', 'width-800')) | |
| unregister_image_format('left') | |
| register_image_format(Format('left', _('Left-aligned'), 'w-1/2 float-left rounded-lg', 'width-800')) | |
| unregister_image_format('right') |
This file contains hidden or 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
| module.exports = { | |
| root: true, | |
| env: { | |
| browser: true, | |
| node: true | |
| }, | |
| parserOptions: { | |
| parser: 'babel-eslint' | |
| }, | |
| extends: [ |
This file contains hidden or 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
| Digialocean | |
| Postgres | |
| To dump: pg_dump -h localhost -U USERNAME DATABASENMAE > /home/NAME/DATABASENAME.sql | |
| To import: psql -h localhost -U username databasename < databasename.sql | |
| Python | |
| python3 -m venv /path/to/new/virtual/environment | |
| find . -name '*.pyc' -delete - gets rid of old .pyc files |
This file contains hidden or 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
| Reference: | |
| Django/Postgres/Nginx/Gunicorn in Ubuntu: https://www.digitalocean.com/community/tutorials/how-to-set-up-django-with-postgres-nginx-and-gunicorn-on-ubuntu-16-04 | |
| Encryption: https://www.digitalocean.com/community/tutorials/how-to-secure-nginx-with-let-s-encrypt-on-ubuntu-16-04 | |
| Where you see "user", "myproject" and "myprojectuser" replace that with what is relevent to what you are working on. | |
| User Setup | |
| $ ssh root@SERVER_IP_ADDRESS | |
| Complete login process |
This file contains hidden or 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
| # This example will allow you to manipluate a Parent and a Child via various endpoints | |
| # /api - All endpoints | |
| # /api/parents - Parents list | |
| # /api/parents/(?P<pk>\d+) - Parent detail | |
| # /api/parents/(?P<pk>\d+)/children - List of children of parent | |
| # /api/children - Child list | |
| # /api/children/(?P<pk>\d+) - Child Detail | |
| # Models - models.py | |
| # Pretty simple setup. Children have a FK to parent |
This file contains hidden or 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
| Can an admin GET any endpoint? | |
| Can an admin POST any endpoint? | |
| Can an admin PUT any endpoint? | |
| Can an admin PATCH any endpoint? | |
| Can an admin DELETE any endpoint? | |
| Can a user GET thier endpoint? | |
| Can a user POST thier endpoint? | |
| Can a user PUT thier endpoint? | |
| Can a user PATCH thier endpoint? |
This file contains hidden or 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
| AddType application/vnd.ms-fontobject .eot | |
| AddType font/ttf .ttf | |
| AddType font/otf .otf | |
| AddType application/x-font-woff woff | |
| <FilesMatch "\.(ttf|ttc|otf|eot|woff|font.css)$"> | |
| <IfModule mod_headers.c> | |
| Header set Access-Control-Allow-Origin "http://*.domainname.org" | |
| </IfModule> | |
| </FilesMatch> |
This file contains hidden or 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
| behavior: url(http://path-to-file.com/ie-css3.htc); /* Add me to any box or text shadow and rounded corner object to execute in IE7 and 8 */ |
This file contains hidden or 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
| $('#slideshow').loopedSlider({ | |
| addPagination: true, | |
| slides: ".slides", | |
| containerClick: true, | |
| autoStart: 6000, | |
| fadespeed: 2000, | |
| }); |
NewerOlder