Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/develop' into feature/EGCETSII#43-…
Browse files Browse the repository at this point in the history
…backend-test
  • Loading branch information
JSnow11 committed Jan 9, 2022
2 parents d61ca41 + 4362620 commit 88ee4bb
Show file tree
Hide file tree
Showing 95 changed files with 33,218 additions and 779 deletions.
26 changes: 0 additions & 26 deletions .github/ISSUE_TEMPLATE/bug_report.md

This file was deleted.

14 changes: 0 additions & 14 deletions .github/ISSUE_TEMPLATE/document.md

This file was deleted.

16 changes: 0 additions & 16 deletions .github/ISSUE_TEMPLATE/task.md

This file was deleted.

2 changes: 2 additions & 0 deletions .github/workflows/django.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ jobs:
python manage.py makemigrations
python manage.py migrate
- name: Test administration module
env:
TELEGRAM_TOKEN: ${{ secrets.TELEGRAM_TOKEN }}
run: |
cd decide
coverage run --branch --source=./administration/ ./manage.py test administration --keepdb -v 2
Expand Down
34 changes: 0 additions & 34 deletions .github/workflows/react.yml

This file was deleted.

5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ coverage.xml

# Django stuff:
*.log
local_settings.py
decide/local_settings.py

migrations/

Expand Down Expand Up @@ -108,7 +108,8 @@ ENV/
# mypy
.mypy_cache/


.vagrant

# new db migrations
decide/*/migrations/0001_initial.py
decide/*/migrations/0001_initial.py
31 changes: 31 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
from ubuntu

RUN apt update
RUN apt install -y software-properties-common
RUN add-apt-repository ppa:deadsnakes/ppa
RUN apt update
RUN apt install -y python3.8
RUN update-alternatives --install /usr/bin/python python /usr/bin/python3 1
RUN apt-get -y install python3-pip
RUN apt install -y git gcc libc-dev
RUN apt install -y gcc g++ make libffi-dev python3-dev
RUN apt install -y build-essential python3-dev python2.7-dev libldap2-dev libsasl2-dev tox lcov valgrind

RUN pip3 install gunicorn
RUN pip3 install ipdb
RUN pip3 install ipython

WORKDIR /app

RUN git clone https://github.com/Full-Tortuga/decide-full-tortuga-autenticacion.git .
RUN pip3 install -r requirements.txt


WORKDIR /app/decide

# local settings.py
ADD docker-settings.py /app/decide/local_settings.py

RUN ./manage.py collectstatic

CMD ./manage.py runserver 0.0.0.0:$PORT
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@ fichero requirements.txt:
pip install -r requirements.txt

En caso de fallo al instalar las dependencias, es necesario instalas el paquete wheel y volver al comando anterior:
pip install wheel

pip install wheel

Entramos en la carpeta del proyecto (cd decide) y realizamos las migraciones correspondientes para preparar la base de datos:

Expand Down Expand Up @@ -150,6 +151,7 @@ La consola debe de devolver:
\#
\# LDAPv3
\# base <dc=decide, dc=org> with scope subtree

\# filter: (objectclass=\*)
\# requesting: ALL
\#
Expand Down
32 changes: 30 additions & 2 deletions decide/authentication/serializers.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,37 @@
from rest_framework import serializers

from django.contrib.auth.models import User
from django.contrib.auth.hashers import make_password


class UserSerializer(serializers.HyperlinkedModelSerializer):
class UserSerializer(serializers.ModelSerializer):
def create(self, validated_data):
user = User.objects.create(
username=validated_data['username'],
first_name=validated_data['first_name'] if "first_name" in validated_data else "",
last_name=validated_data['last_name'] if "last_name" in validated_data else "",
email=validated_data['email'] if "email" in validated_data else "",
password=make_password(validated_data['password'])
)
return user

def update(self, instance, validated_data):
instance.username = validated_data.get('username', instance.username)
instance.first_name = validated_data.get(
'first_name', instance.first_name)
instance.last_name = validated_data.get(
'last_name', instance.last_name)
instance.email = validated_data.get('email', instance.email)
instance.password = make_password(validated_data['password'])

instance.save()
return instance

class Meta:
model = User
fields = ('id', 'username', 'first_name', 'last_name', 'email', 'is_staff')
fields = ('id', 'username', 'first_name', 'last_name', 'email',
'password', 'is_active', 'is_superuser', 'is_staff')
read_only_fields = ('is_active', 'is_superuser', 'is_staff')
extra_kwargs = {'password': {
'write_only': True,
'min_length': 4, 'required': True}}
Loading

0 comments on commit 88ee4bb

Please sign in to comment.