Name still to be defined
Start the server:
~$ python3 manage.py runserver
Requirements:
- python3 >= 3.8
- pip3
- packages from requirements.txt
- packages from requirements-dev.txt if you're a developer
~$ pip install -r requirements.txt
precommit hooks are important to guarantee merges with less conflicts. installation make sure you have installed the packages from requirements-dev.txt
~$ pre-commit install
pre-commit installed at .git/hooks/pre-commit
~$ pre-commit run --all-files
if one of the hooks fail, just add & commit again
- add the new site to the app_name/views.py
def view_name(request):
#Do something with data
return render('template.html', context={"foo": "bar"})
- register the url in tutor_smith/urls.py
urlpatterns = [
...,
path('url', app_name.view_name),
]
Important: The Name Field is now seperated in first_name and last_name
If you make changes to the Database please run
~$ python3 manage.py makemigrations
~$ python3 manage.py migrate
Don't forget to inform the others of your changes
# Read
# SQL: SELECT * FROM User WHERE email = email
User.objects.filter(email=email) # -> Returns None on empty Querry
# SQL: SELECT * FROM User WHERE name LIKE '%a'
User.objects.filter(email__startswith="a")
# Selecting a single Object
User.objects.get(email=email) # -> Raises an DoesNotExist Exeption on empty Querry
# Write
# Create a new User with the email test@test
User.objects.create(email="test@test")
# Update an Object
u1.email = "test2@test" # u1 is an already existing User
u1.save()
- Passwords and the Secret Key are stored in an .env file.
- The Secret Key can be generated here or will be given by an Administrator