Skip to content

Commit

Permalink
create html for adding books
Browse files Browse the repository at this point in the history
  • Loading branch information
Kunal614 committed Jul 9, 2021
1 parent 0aef3fe commit 0fb0c2d
Show file tree
Hide file tree
Showing 17 changed files with 470 additions and 31 deletions.
Binary file modified cp/__pycache__/urls.cpython-38.pyc
Binary file not shown.
Binary file modified cp/__pycache__/views.cpython-38.pyc
Binary file not shown.
218 changes: 218 additions & 0 deletions cp/templates/addotherRecord.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,218 @@
<!DOCTYPE html> {% load static %}
<html lang="en">

<head>

<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="description" content="">
<meta name="author" content="">

<title>Edit CP</title>
<style>
body {
font-family: Arial, Helvetica, sans-serif;
}
/* The Modal (background) */

@import url(https://fonts.googleapis.com/css?family=Roboto);
/****** LOGIN MODAL ******/

.loginmodal-container {
padding: 30px;
width: 80% !important;
background-color: #F7F7F7;
margin: 0 auto;
border-radius: 2px;
box-shadow: 0px 2px 2px rgba(0, 0, 0, 0.3);
overflow: hidden;
font-family: roboto;
}

.loginmodal-container h1 {
text-align: center;
font-size: 1.8em;
font-family: roboto;
}

.loginmodal-container input[type=submit] {
width: 100%;
display: block;
margin-bottom: 10px;
position: relative;
}

.loginmodal-container input[type=text],
input[type=password] {
height: 50px;
font-size: 16px;
width: 130%;
margin-bottom: 10px;
-webkit-appearance: none;
background: #fff;
border: 1px solid #d9d9d9;
border-top: 1px solid #c0c0c0;
/* border-radius: 2px; */
padding: 0 8px;
box-sizing: border-box;
-moz-box-sizing: border-box;
}

.loginmodal-container input[type=text]:hover {
border: 1px solid #b9b9b9;
border-top: 1px solid #a0a0a0;
-moz-box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1);
-webkit-box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1);
box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1);
}

.loginmodal-submit {
/* border: 1px solid #3079ed; */
border: 0px;
color: #fff;
text-shadow: 0 1px rgba(0, 0, 0, 0.1);
background-color: #4d90fe;
padding: 17px 0px;
font-family: roboto;
font-size: 14px;
/* background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#4d90fe), to(#4787ed)); */
}

.loginmodal-submit:hover {
/* border: 1px solid #2f5bb7; */
border: 0px;
text-shadow: 0 1px rgba(0, 0, 0, 0.3);
background-color: #357ae8;
/* background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#4d90fe), to(#357ae8)); */
}

.loginmodal-container a {
text-decoration: none;
color: #666;
font-weight: 400;
text-align: center;
display: inline-block;
opacity: 0.6;
transition: opacity ease 0.5s;
}

.login-help {
font-size: 12px;
}
</style>
<link href="//maxcdn.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css">
<script src="//maxcdn.bootstrapcdn.com/bootstrap/4.1.1/js/bootstrap.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>


<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<script src='https://kit.fontawesome.com/a076d05399.js'></script>
<link href="https://fonts.googleapis.com/css?family=Nunito:200,200i,300,300i,400,400i,600,600i,700,700i,800,800i,900,900i" rel="stylesheet">
<link href="{%static '/css/sb-admin-2.min.css'%}" rel="stylesheet">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css">
<script src="https://unpkg.com/sweetalert/dist/sweetalert.min.js"></script>



</head>

<body id="page-top">
<!-- #2B2D30 -->
<div id="wrapper">


<div id="content-wrapper" class="d-flex flex-column">

<div id="content">
<nav class="navbar navbar-expand-lg navbar-light bg-light bg-light shadow">

<a href="/cp"><strong>CP</strong></a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarText" aria-controls="navbarText" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarText">
<ul class="navbar-nav mr-auto">
<li class="nav-item active">
<a class="nav-link" href="/">Home <span class="sr-only">(current)</span></a>
</li>
{% if request.user.is_authenticated%}
<li class="nav-item active">
<a class="nav-link" href="/logout">Logout <span class="sr-only">(current)</span></a>
</li>
{%endif%}
</ul>


</div>
<div class="topbar-divider d-none d-sm-block">
{% if request.user.is_authenticated%}
<p>{{request.user.username}}</p>
{%endif%} </div>


</nav>







<div class="container-fluid" style="width:100%;">



<form method="POST" action="" enctype="multipart/form-data">
{%csrf_token%}
<div class="loginmodal-container">
<h1>Add Book</h1><br>
<div class="form-row">
<div class="form-group">
<label for="title">Name</label>
<input type="text" name="name">
</div>
</div>
<div class="form-row">
<div class="form-group">
<label for="data">Drivr / Any Url</label>
<input type="url" name="url" >
</div>
</div>

<button type="submit" class="btn btn-primary">Add</button>
</div>
</form>






<!-- Footer -->




</div>
</div>
</div>
</div>






<script src="https://code.iconify.design/1/1.0.7/iconify.min.js"></script>




<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script>



</body>

</html>
15 changes: 4 additions & 11 deletions cp/templates/cp.html
Original file line number Diff line number Diff line change
Expand Up @@ -475,8 +475,8 @@ <h1 class="bg-light text-center shadow" style="font-family: serif;"><a href="{{p

<h1 style="font-style: italic;font-family:serif;">Books</h1>
{% for books in book%}
<div class="row" style="margin-left: 50px;">
<div class='row' style="width: 100%;">

<div class='row' style="width: 100%; margin-left: 10px;">

<a href='{{books.view_down}}' class="btn btn-primary" style="font-size: 20px; height: 40px;"> Download/View</a>

Expand All @@ -486,7 +486,8 @@ <h1 style="font-style: italic;font-family:serif;">Books</h1>

</div>
</div>
</div>

<span><br></span>
{%endfor%} <span> <br><br></span> {%if request.user.is_authenticated%}
<div class="row" style="margin-left: 10px;">
<form method="GET" action="/addCpRecord">
Expand All @@ -497,16 +498,8 @@ <h1 style="font-style: italic;font-family:serif;">Books</h1>
<small>Please Only Upload Valuabe Things</small> {%endif%}








<!-- Footer -->



<div>
{% if request.user.is_authenticated%}
<div class="d-sm-flex align-items-center justify-content-between mb-4">
Expand Down
1 change: 1 addition & 0 deletions cp/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
path('edit/<int:id>' ,edit, name='edit' ),
path('problemset' ,problemsets, name='problemset' ),
path('clist' , clist , name='clist'),
path('addCpRecord',addCpRecord , name='addcprecord'),
# path('pr' , pr, name='pr')

]
12 changes: 4 additions & 8 deletions cp/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ def cP(request):
# refresh = requests.get('https://iiitkalyani.herokuapp.com/updatecache/14MBVQyZ6NtKVFHCBJMVsNRWoWFWQpntD')
# book = requests.get('https://iiitkalyani.herokuapp.com/getfiles/14MBVQyZ6NtKVFHCBJMVsNRWoWFWQpntD').json()
book = CpBooks.objects.all()
print(book)
print(book ,"Alllllllll bookssssssssssssss")
context={
'book':book,
'msg':msg,
Expand Down Expand Up @@ -269,16 +269,12 @@ def clist(request):



def addCseRecord(request):
def addCpRecord(request):
if request.method == 'POST':
res = request.POST
name = res['name']
url = res['url']
if res['type'] == 'Book':
add_book = CpBooks(book_name = name , down_view = url)
add_book.save()
else:
add_other = Other_stuff(subj = subj , other_name = name , down_view = url)
add_other.save()
add_book = CpBooks(book_name = name , view_down = url)
add_book.save()
return HttpResponseRedirect('/cp')
return render(request , 'addotherRecord.html')
Binary file modified cse/__pycache__/urls.cpython-38.pyc
Binary file not shown.
Binary file modified cse/__pycache__/views.cpython-38.pyc
Binary file not shown.
Loading

0 comments on commit 0fb0c2d

Please sign in to comment.