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
| <!DOCTYPE html> | |
| <html lang="en" dir="ltr"> | |
| <head> | |
| <meta charset="utf-8"> | |
| <title>File Upload</title> | |
| <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous"> | |
| </head> | |
| <body> | |
| <div class="container"> |
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
| <!DOCTYPE html> | |
| <html lang="en" dir="ltr"> | |
| <head> | |
| <meta charset="utf-8"> | |
| <title>File Upload</title> | |
| <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous"> | |
| </head> | |
| <body> | |
| <div class="container"> |
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
| <!DOCTYPE html> | |
| <html lang="en" dir="ltr"> | |
| <head> | |
| <meta charset="utf-8"> | |
| <title>File Upload</title> | |
| <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous"> | |
| </head> | |
| <body> | |
| <div class="container"> |
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.shortcuts import render | |
| from xyz.models import FileUpload | |
| from xyz.forms import FileUploadForm | |
| # Create your views here. | |
| def home(request): | |
| return render(request,'xyz/index.html',{}) | |
| def upload(request): | |
| file_uploaded = False |
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 import forms | |
| from xyz.models import FileUpload | |
| class FileUploadForm(forms.ModelForm): | |
| class Meta(): | |
| model = FileUpload | |
| fields = ['file_name','file'] |
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. | |
| class FileUpload(models.Model): | |
| file_name = models.CharField(max_length=250) | |
| file = models.FileField(upload_to='files') | |
| uploading_time = models.DateTimeField(auto_now=True) | |
| def __str__(self): | |
| return self.file_name |
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
| """ | |
| Django settings for fileupload project. | |
| Generated by 'django-admin startproject' using Django 3.1. | |
| For more information on this file, see | |
| https://docs.djangoproject.com/en/3.1/topics/settings/ | |
| For the full list of settings and their values, see | |
| https://docs.djangoproject.com/en/3.1/ref/settings/ |
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
| import datetime | |
| #your app name - appname.User | |
| AUTH_USER_MODEL = "first.User" | |
| INSTALLED_APPS = [ | |
| 'django.contrib.admin', | |
| 'django.contrib.auth', | |
| 'django.contrib.contenttypes', | |
| 'django.contrib.sessions', | |
| 'django.contrib.messages', |
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 . import views | |
| from django.urls import path | |
| from rest_framework_simplejwt.views import ( | |
| TokenRefreshView, | |
| ) | |
| app_name = 'api' | |
| urlpatterns = [ | |
| path('register/',views.RegisterView.as_view(),name="register"), |
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 generics,status,views,permissions | |
| from rest_framework.response import Response | |
| from rest_framework.decorators import api_view, permission_classes | |
| from rest_framework.permissions import IsAuthenticated | |
| from .serializers import RegisterSerializer,LoginSerializer,LogoutSerializer | |
| # Create your views here. | |
| class RegisterView(generics.GenericAPIView): | |
| serializer_class = RegisterSerializer |
NewerOlder