forked from EGCETSII/decide_django_2
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/develop' into feature/EGCETSII#43-…
…backend-test
- Loading branch information
Showing
95 changed files
with
33,218 additions
and
779 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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
This file was deleted.
Oops, something went wrong.
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
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
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 |
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
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
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}} |
Oops, something went wrong.