Skip to content

Instantly share code, notes, and snippets.

View Adarshreddyash's full-sized avatar
:octocat:
Building AI

Adarshreddy adelli Adarshreddyash

:octocat:
Building AI
View GitHub Profile
<!-- 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"
<!--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"
//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'
<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>
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'
#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'
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):
from rest_framework import serializers
from users.models import CustomUser
class UserSerializer(serializers.ModelSerializer):
class Meta:
model = CustomUser
fields = ['id', 'email', 'profile_name', 'avatar',]
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):
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