Skip to content

Commit

Permalink
Merge branch 'master' into 659-create-lyche-about-us-page
Browse files Browse the repository at this point in the history
  • Loading branch information
Snorre98 authored Sep 21, 2023
2 parents 550e8a3 + 3281422 commit eb1bece
Show file tree
Hide file tree
Showing 42 changed files with 1,006 additions and 115 deletions.
31 changes: 16 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,27 +7,28 @@
- **[Technical Documentation](/docs/technical/README.md)**
- [Work Methodology](/docs/work-methodology.md)
- [Useful Commands](/docs/useful-commands.md)

- [Technologies used on Samf4 🤖](/docs/technical/Samf4Tech.md)
- [Useful Docker aliases](/docs/docker-project-specific-commands.md)
## Installation

We have a script that handles all installation for you. To run the script, a Github Personal Access Token (PAT) is required.
You can make one here https://github.com/settings/tokens/new. Tick scopes `repo`, `read:org` and `admin:public_key`),
We have a script that handles all installation for you. To run the script, a Github Personal Access Token (PAT) is required.
You can make one here https://github.com/settings/tokens/new. Tick scopes `repo`, `read:org` and `admin:public_key`),
then store the token somewhere safe (Github will never show it again).

Copy these commands (press button on the right-hand side of the block)
Copy these commands (press button on the right-hand side of the block)
and run from the directory you would clone the project.

```sh
# non-interactive
read -s -p "Github PAT token: " TOKEN ; X_INTERACTIVE=n /bin/bash -c "$(curl -fsSL https://$TOKEN@raw.githubusercontent.com/Samfundet/Samfundet4/master/{bash_utils.sh,install.sh})" && . ~/.bash_profile && cd Samfundet4; unset TOKEN; unset X_INTERACTIVE;
# Interactive
read -s -p "Github PAT token: " TOKEN ; X_INTERACTIVE=y /bin/bash -c "$(curl -fsSL https://$TOKEN@raw.githubusercontent.com/Samfundet/Samfundet4/master/{bash_utils.sh,install.sh})" && . ~/.bash_profile && cd Samfundet4; unset TOKEN; unset X_INTERACTIVE;
```

<details>
<summary>Interactive (show/hide)</summary>
<summary>Non-interactive (show/hide)</summary>

```sh
# interactive
read -s -p "Github PAT token: " TOKEN ; X_INTERACTIVE=y /bin/bash -c "$(curl -fsSL https://$TOKEN@raw.githubusercontent.com/Samfundet/Samfundet4/master/{bash_utils.sh,install.sh})" && . ~/.bash_profile && cd Samfundet4; unset TOKEN; unset X_INTERACTIVE;
# Non-interactive
read -s -p "Github PAT token: " TOKEN ; X_INTERACTIVE=n /bin/bash -c "$(curl -fsSL https://$TOKEN@raw.githubusercontent.com/Samfundet/Samfundet4/master/{bash_utils.sh,install.sh})" && . ~/.bash_profile && cd Samfundet4; unset TOKEN; unset X_INTERACTIVE;
```

<!--
Expand All @@ -38,12 +39,12 @@ cd ~/my-projects/test; rm -rf Samfundet4; read -s -p "Github PAT token: " TOKEN
<details>
<summary>Flags explained (show/hide)</summary>

> - X_INTERACTIVE (y/n): determines how many prompts you receive before performing an action.
> curl:
> - -f: fail fast
> - -s: silent, no progress-meter
> - -S: show error on fail
> - -L: follow redirect
> - X_INTERACTIVE (y/n): determines how many prompts you receive before performing an action.
> curl:
> - -f: fail fast
> - -s: silent, no progress-meter
> - -S: show error on fail
> - -L: follow redirect
</details>

Expand Down
2 changes: 1 addition & 1 deletion backend/.docker.example.env
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ ENABLE_DEBUGPY=yes
# Automatically create local superuser
DJANGO_SUPERUSER_USERNAME=emilte
DJANGO_SUPERUSER_PASSWORD=Django123
DJANGO_SUPERUSER_EMAIL=[email protected]
DJANGO_SUPERUSER_EMAIL=[email protected]

DOMAIN=0.0.0.0

Expand Down
22 changes: 22 additions & 0 deletions backend/Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,28 @@ url = "https://pypi.org/simple"
verify_ssl = true
name = "pypi"

[scripts]
# See '/docs/pipenv.md'.
"pipenv:install" = "pipenv install"
"pipenv:update" = "pipenv update"
"pipenv:sync" = "bash -c \"pipenv clean; pipenv sync --dev\""
"pipenv:docker-install-dev" = "pipenv install --deploy --ignore-pipfile --dev" # 'deploy' means abort if outdated lock file. 'ignore-pipfile' means only install using the lock file. 'dev' means install dev dependencies.
"pipenv:docker-install-prod" = "pipenv install --deploy --ignore-pipfile" # 'deploy' means abort if outdated lock file. 'ignore-pipfile' means only install using the lock file.
"pipenv:outdated" = "pipenv update --outdated" # Show outdated dependencies.
"pipenv:graph" = "pipenv graph" # Show dependency graph.
"pipenv:where" = "pipenv --where" # Show location of virtual environment.
"pipenv:rm" = "pipenv --rm" # Completely remove virtual environment.
"pipenv:shell" = "pipenv shell" # Opens a shell within the virtual environment.
"mypy:run" = "pipenv run mypy --config-file mypy.ini ."
"migrations:verify" = "pipenv run python manage.py makemigrations --check --dry-run --noinput --verbosity 2"
"bandit:run" = "pipenv run bandit --recursive --ini .bandit ."
"flake8:run" = "pipenv run flake8 --config=.flake8 ."
"yapf:diff" = "pipenv run yapf --parallel --recursive --diff ." # Dry-run yapf on all files in the project.
"yapf:apply" = "pipenv run yapf --parallel --recursive -i ." # Applies yapf to all files in the project.
"pytest:run" = "pipenv run pytest"
"pipeline:run" = "bash -c \"pipenv run mypy:run && pipenv run yapf:diff && pipenv run migrations:verify && pipenv run bandit:run && pipenv run flake8:run && pipenv run pytest:run\""
"seed:run" = "pipenv run python manage.py seed"

[packages]
django = "*"
pytest = "*"
Expand Down
62 changes: 36 additions & 26 deletions backend/Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions backend/root/management/commands/seed_scripts/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
billig,
menu,
documents,
textitems,
example,
samf3,
recruitment,
Expand All @@ -32,6 +33,7 @@
('menu', menu.seed),
('documents', documents.seed),
('information_page', information_pages.seed),
('textitems', textitems.seed),
('blogposts', blogposts.seed),
('organization', oganizations.seed),
('recruitment', recruitment.seed),
Expand Down
44 changes: 44 additions & 0 deletions backend/root/management/commands/seed_scripts/textitems.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
from samfundet.models.general import TextItem


def seed():
text_items = [
{
'key': 'welcome_message',
'text_nb': 'Velkommen til Studentersamfundet i Trondhjem!',
'text_en': 'Welcome to the Student Society in Trondheim!',
},
{
'key': 'upcoming_events',
'text_nb': 'Sjekk ut våre kommende arrangementer og konsertene vi har planlagt!',
'text_en': 'Check out our upcoming events and concerts we have planned!',
},
{
'key': 'join_us',
'text_nb': 'Bli medlem av Studentersamfundet og nyt godt av medlemsfordelene!',
'text_en': 'Join the Student Society and enjoy the benefits of membership!',
},
{
'key': 'volunteer',
'text_nb': 'Vil du bli frivillig? Bli med i vårt fantastiske team og bidra til studentkulturen i Trondheim!',
'text_en': 'Want to volunteer? Join our amazing team and contribute to the student culture in Trondheim!',
},
{
'key': 'about_us',
'text_nb': 'Studentersamfundet i Trondhjem er et kulturelt senter for studenter og en viktig del av studentlivet i Trondheim.',
'text_en': 'The Student Society in Trondheim is a cultural center for students and an essential part of student life in Trondheim.',
},
{
'key': 'contact_us',
'text_nb': 'Har du spørsmål eller ønsker å komme i kontakt med oss? Ikke nøl med å ta kontakt!',
'text_en': 'Do you have any questions or want to get in touch with us? Don"t hesitate to contact us!',
},
]

TextItem.objects.all().delete()
yield 0, 'Deleted old textitems'

for i, item in enumerate(text_items):
text_item, created = TextItem.objects.get_or_create(key=item['key'], text_nb=item['text_nb'], text_en=item['text_en'])
if created:
yield (100 * (i + 1) // len(text_items), f'Created {len(TextItem.objects.all())} textitems')
2 changes: 2 additions & 0 deletions backend/root/management/commands/seed_scripts/venues.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import random

from django.utils import timezone
from django.utils.text import slugify

from root.utils.samfundet_random import words
from samfundet.models.general import Venue
Expand All @@ -26,6 +27,7 @@ def seed():
for i, name in enumerate(VENUES):
Venue.objects.create(
name=name,
slug=slugify(name),
description=words(10),
floor=random.randint(1, 4),
last_renovated=timezone.now() + timezone.timedelta(days=-random.randint(30, 365 * 30)),
Expand Down
Loading

0 comments on commit eb1bece

Please sign in to comment.