This file contains hidden or 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
| <!-- Components/Songs.vue--> | |
| <template> | |
| <v-container> | |
| <v-layout wrap> | |
| <v-flex xs4 md2 | |
| v-for="(item, index) in posts" | |
| :key="index" | |
| mb-16> | |
| <v-card | |
| class="mx-auto" |
This file contains hidden or 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
| <!--add to views/signup.vue--> | |
| <template lang="html"> | |
| <v-form> | |
| <v-container> | |
| <v-row> | |
| <v-col cols="12" sm="12" md="12" lg="6"> | |
| <p class="mx-auto" justify-center>Login</p> | |
| <v-text-field | |
| v-model="email" |
This file contains hidden or 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
| //add to store/index.js | |
| import Vue from 'vue' | |
| import Vuex from 'vuex' | |
| import axios from 'axios' | |
| Vue.use(Vuex) | |
| // Make Axios good with django csrf | |
| axios.defaults.xsrfCookieName = 'csrftoken' |
This file contains hidden or 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
| <template lang="html" class="primary_bg"> | |
| <div class="primary_bg"> | |
| <v-container fluid class="mb-15"> | |
| <v-layout row> | |
| <v-flex md6 lg6 sm12 xs12 x6> | |
| <img src="../assets/Chilling-at-Home/main_files/chilling.svg" width="95%"> | |
| </v-flex> | |
| <v-flex md6 lg6 sm12 xs12 x6 pl-3> | |
| <h1 class="white--text font-weight-medium mt-16 d-sm-pl-8 d-xs-pl-6">Roni<span class="red--text">X</span></h1> | |
| <h2 class="white--text d-sm-pl-6">Discover great music <span class="yellow--text">that rules out </span></h2> |
This file contains hidden or 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
| REST_FRAMEWORK = { | |
| 'DEFAULT_PERMISSION_CLASSES': ( | |
| # By default we set everything to admin, | |
| # then open endpoints on a case-by-case basis | |
| 'rest_framework.permissions.IsAdminUser', | |
| ), | |
| 'TEST_REQUEST_RENDERER_CLASSES': ( | |
| 'rest_framework.renderers.MultiPartRenderer', | |
| 'rest_framework.renderers.JSONRenderer', | |
| 'rest_framework.renderers.TemplateHTMLRenderer' |
This file contains hidden or 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
| #Now add this to api/settings.py | |
| AUTH_USER_MODEL = 'users.CustomUser' | |
| ACCOUNT_USER_MODEL_USERNAME_FIELD = None | |
| #setting email field as required one | |
| ACCOUNT_EMAIL_REQUIRED = True | |
| ACCOUNT_UNIQUE_EMAIL = True | |
| ACCOUNT_USERNAME_REQUIRED = False | |
| ACCOUNT_AUTHENTICATION_METHOD = 'email' |
This file contains hidden or 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
| from django.db import models | |
| # Create your models here. | |
| from django.contrib.auth.models import AbstractUser | |
| from django.utils.translation import ugettext_lazy as _ | |
| from .managers import CustomUserManager | |
| class CustomUser(AbstractUser): |
This file contains hidden or 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
| from rest_framework import serializers | |
| from users.models import CustomUser | |
| class UserSerializer(serializers.ModelSerializer): | |
| class Meta: | |
| model = CustomUser | |
| fields = ['id', 'email', 'profile_name', 'avatar',] |
This file contains hidden or 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
| from django.contrib.auth.base_user import BaseUserManager | |
| from django.utils.translation import ugettext_lazy as _ | |
| class CustomUserManager(BaseUserManager): | |
| """ | |
| Custom user model manager where email is the unique identifiers | |
| for authentication instead of usernames. | |
| """ | |
| def create_user(self, email, password, **extra_fields): |
This file contains hidden or 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
| from django.contrib import admin | |
| from django.urls import path , include , re_path | |
| urlpatterns = [ | |
| path('admin/', admin.site.urls), | |
| re_path('api/(?P<version>(v1|v2))/', include('music.urls')), | |
| ] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) #tgis helps in accessing media with native elements |