Compare commits
3 Commits
c178556a2e
...
624fb47e04
Author | SHA1 | Date | |
---|---|---|---|
624fb47e04 | |||
d8a279f4d8 | |||
9c1dd30db7 |
19
frontend/static/css/me.css
Normal file
19
frontend/static/css/me.css
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
#app .account
|
||||||
|
{
|
||||||
|
background-color: red;
|
||||||
|
}
|
||||||
|
|
||||||
|
#app .account, #app .profile
|
||||||
|
{
|
||||||
|
width: 60%;
|
||||||
|
display: flex;
|
||||||
|
margin-left: auto;
|
||||||
|
margin-right: auto;
|
||||||
|
flex-direction: column;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
#app .profile
|
||||||
|
{
|
||||||
|
background-color: green;
|
||||||
|
}
|
@ -12,8 +12,8 @@ export default class extends AbstractAuthentificateView
|
|||||||
{
|
{
|
||||||
if (this.fill() === null)
|
if (this.fill() === null)
|
||||||
return;
|
return;
|
||||||
document.getElementById("save-button").onclick = this.save;
|
document.getElementById("save-account-button").onclick = this.acccount_save;
|
||||||
document.getElementById("delete-button").onclick = this.delete_accounts;
|
document.getElementById("delete-account-button").onclick = this.account_delete_accounts;
|
||||||
}
|
}
|
||||||
|
|
||||||
async fill()
|
async fill()
|
||||||
@ -104,22 +104,27 @@ export default class extends AbstractAuthentificateView
|
|||||||
async getHtml()
|
async getHtml()
|
||||||
{
|
{
|
||||||
return `
|
return `
|
||||||
|
<link rel="stylesheet" href="static/css/me.css">
|
||||||
<h1>ME</h1>
|
<h1>ME</h1>
|
||||||
<div class="accounts">
|
<div class="account">
|
||||||
|
<h3>Account</h3>
|
||||||
<input type="text" placeholder="username" id="username">
|
<input type="text" placeholder="username" id="username">
|
||||||
<span id="error_username"></span>
|
<span id="error_username"></span>
|
||||||
<input type=password placeholder="new password" id="new_password">
|
<input type=password placeholder="new password" id="new_password">
|
||||||
<span id="error_new_password"></span>
|
<span id="error_new_password"></span>
|
||||||
<input type=password placeholder="current password" id="current_password">
|
<input type=password placeholder="current password" id="current_password">
|
||||||
<span id="error_current_password"></span>
|
<span id="error_current_password"></span>
|
||||||
|
<input type="button" value="Save Credentials" id="save-account-button">
|
||||||
|
<span id="error_save"></span>
|
||||||
|
<input type="button" value="Delete Account" id="delete-account-button">
|
||||||
|
<span id="error_delete"></span>
|
||||||
</div>
|
</div>
|
||||||
<div class="profile">
|
<div class="profile">
|
||||||
<input type="file" placeholder="username" id="avatar" accept="image/png, image/jpeg">
|
<h3>Profile</h3>
|
||||||
|
<input type="file" id="avatar" accept="image/png, image/jpeg">
|
||||||
|
<input type="button" value="Save profile" id="save-profile-button">
|
||||||
|
<span id="error_save"></span>
|
||||||
</div>
|
</div>
|
||||||
<input type="button" value="Save" id="save-button">
|
|
||||||
<span id="error_save"></span>
|
|
||||||
<input type="button" value="Delete" id="delete-button">
|
|
||||||
<span id="error_delete"></span>
|
|
||||||
<a href="/logout" class="nav__link" data-link>Logout</a>
|
<a href="/logout" class="nav__link" data-link>Logout</a>
|
||||||
`;
|
`;
|
||||||
}
|
}
|
||||||
|
@ -11,7 +11,7 @@ from .serializers import ProfileSerializer
|
|||||||
from .models import ProfileModel
|
from .models import ProfileModel
|
||||||
|
|
||||||
class ProfileViewSet(viewsets.ModelViewSet):
|
class ProfileViewSet(viewsets.ModelViewSet):
|
||||||
queryset = ProfileModel.objects.all()
|
queryset = ProfileModel.objects.all
|
||||||
serializer_class = ProfileSerializer
|
serializer_class = ProfileSerializer
|
||||||
parser_classes = (MultiPartParser, FormParser)
|
parser_classes = (MultiPartParser, FormParser)
|
||||||
permission_classes = (permissions.IsAuthenticatedOrReadOnly,)
|
permission_classes = (permissions.IsAuthenticatedOrReadOnly,)
|
||||||
@ -23,7 +23,7 @@ class ProfileViewSet(viewsets.ModelViewSet):
|
|||||||
status=status.HTTP_200_OK)
|
status=status.HTTP_200_OK)
|
||||||
|
|
||||||
def list(self, request: HttpRequest):
|
def list(self, request: HttpRequest):
|
||||||
serializer = ProfileSerializer(self.queryset, many=True)
|
serializer = ProfileSerializer(self.queryset(), many=True)
|
||||||
for profile in serializer.data:
|
for profile in serializer.data:
|
||||||
profile["avatar_url"] = profile["avatar_url"][profile["avatar_url"].find("static") - 1:]
|
profile["avatar_url"] = profile["avatar_url"][profile["avatar_url"].find("static") - 1:]
|
||||||
return Response(serializer.data)
|
return Response(serializer.data)
|
||||||
|
Loading…
Reference in New Issue
Block a user