Skip to content

Commit

Permalink
Second Deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
khannakshat7 committed Jul 26, 2020
1 parent 913aa6a commit 9e771f3
Show file tree
Hide file tree
Showing 29 changed files with 4,258 additions and 86 deletions.
Binary file modified InsideUG/__pycache__/settings.cpython-36.pyc
Binary file not shown.
Binary file modified InsideUGApp/__pycache__/admin.cpython-36.pyc
Binary file not shown.
Binary file modified InsideUGApp/__pycache__/models.cpython-36.pyc
Binary file not shown.
Binary file modified InsideUGApp/__pycache__/views.cpython-36.pyc
Binary file not shown.
5 changes: 3 additions & 2 deletions InsideUGApp/admin.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from django.contrib import admin
from InsideUGApp.models import Course
from InsideUGApp.models import Course,Books
# Register your models here.
admin.site.register(Course)
admin.site.register(Course)
admin.site.register(Books)
19 changes: 19 additions & 0 deletions InsideUGApp/migrations/0002_course_link.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Generated by Django 3.0.7 on 2020-07-26 07:40

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('InsideUGApp', '0001_initial'),
]

operations = [
migrations.AddField(
model_name='course',
name='link',
field=models.URLField(default='http://google.com'),
preserve_default=False,
),
]
26 changes: 26 additions & 0 deletions InsideUGApp/migrations/0003_books.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Generated by Django 3.0.7 on 2020-07-26 08:05

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('InsideUGApp', '0002_course_link'),
]

operations = [
migrations.CreateModel(
name='Books',
fields=[
('bookid', models.AutoField(primary_key=True, serialize=False)),
('stream', models.CharField(max_length=100)),
('branch', models.CharField(max_length=100)),
('title', models.CharField(max_length=100)),
('discription', models.TextField()),
('link', models.URLField()),
('smallImage', models.FileField(upload_to='booksmall/')),
('BigImage', models.FileField(upload_to='bookbig/')),
],
),
]
Binary file not shown.
Binary file not shown.
14 changes: 14 additions & 0 deletions InsideUGApp/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,22 @@ class Course(models.Model):
branch = models.CharField(max_length=100)
title = models.CharField(max_length=100)
discription = models.TextField()
link = models.URLField()
smallImage = models.FileField(upload_to='coursesmall/')
BigImage = models.FileField(upload_to='coursebig/')

def __str__(self):
return self.title

class Books(models.Model):
bookid = models.AutoField(primary_key=True)
stream = models.CharField(max_length=100)
branch = models.CharField(max_length=100)
title = models.CharField(max_length=100)
discription = models.TextField()
link = models.URLField()
smallImage = models.FileField(upload_to='booksmall/')
BigImage = models.FileField(upload_to='bookbig/')

def __str__(self):
return self.title
73 changes: 55 additions & 18 deletions InsideUGApp/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from django.views.decorators.csrf import csrf_exempt

from InsideUGApp.forms import UserForm
from InsideUGApp.models import Course
from InsideUGApp.models import Course,Books
# Create your views here.

def index(request):
Expand All @@ -21,31 +21,68 @@ def category(request,cat):
@csrf_exempt
def addcourse(request):
if(request.method == 'POST'):
stream = request.POST.get('course')
branch = request.POST.get('branch')
title = request.POST.get('title')
disc = request.POST.get('disc')
imageSmall = request.FILES['imgsmall']
imageBig = request.FILES['imgbig']
print(stream,branch,title,disc,imageSmall,imageBig)
course = Course()
course.stream = stream
course.branch = branch
course.title = title
course.discription = disc
course.smallImage = imageSmall
course.BigImage = imageBig
course.save()
return HttpResponse("Done")
try:
stream = request.POST.get('course')
branch = request.POST.get('branch')
title = request.POST.get('title')
disc = request.POST.get('disc')
link = request.POST.get('link')
imageSmall = request.FILES['imgsmall']
imageBig = request.FILES['imgbig']

course = Course()
course.stream = stream
course.branch = branch
course.title = title
course.link = link
course.discription = disc
course.smallImage = imageSmall
course.BigImage = imageBig
course.save()
data = {
"msg": "The course added successfully!!"
}
except:
data = {
"err": "An error occured in adding the course"
}
return render(request,'addcourse.html',data)
else:
return render(request,'addcourse.html')

@csrf_exempt
def addbook(request):
if(request.method == 'POST'):
pass
try:
stream = request.POST.get('course')
branch = request.POST.get('branch')
title = request.POST.get('title')
disc = request.POST.get('disc')
link = request.POST.get('link')
imageSmall = request.FILES['imgsmall']
imageBig = request.FILES['imgbig']

book = Books()
book.stream = stream
book.branch = branch
book.title = title
book.link = link
book.discription = disc
book.smallImage = imageSmall
book.BigImage = imageBig
book.save()
data = {
"msg": "The Book added successfully!!"
}
except:
data = {
"err": "An error occured in adding the Book!!"
}
return render(request,'addbook.html',data)
else:
return render(request,'addbook.html')


def addnews(request):
if(request.method == 'POST'):
pass
Expand Down
Binary file modified db.sqlite3
Binary file not shown.
14 changes: 14 additions & 0 deletions media/bookbig/books.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 14 additions & 0 deletions media/booksmall/books.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 14 additions & 0 deletions media/coursebig/books.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 14 additions & 0 deletions media/coursebig/books_ch38Zbi.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed media/coursebig/report_page.jpg
Binary file not shown.
Binary file removed media/coursebig/report_page_LzHPAJ9.jpg
Binary file not shown.
14 changes: 14 additions & 0 deletions media/coursesmall/books.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 14 additions & 0 deletions media/coursesmall/books_oJmzIWd.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed media/coursesmall/report_page.jpg
Binary file not shown.
Binary file removed media/coursesmall/report_page_LJC6mDc.jpg
Binary file not shown.
Loading

0 comments on commit 9e771f3

Please sign in to comment.