Skip to content

Commit

Permalink
Projects Done
Browse files Browse the repository at this point in the history
  • Loading branch information
NarayanAdithya committed Feb 28, 2022
1 parent 1747c25 commit 26086d8
Show file tree
Hide file tree
Showing 18 changed files with 156 additions and 231 deletions.
Binary file modified app.db
Binary file not shown.
7 changes: 4 additions & 3 deletions app/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@ def __repr__(self):
class Project(db.Model):
id = db.Column(db.Integer, primary_key=True)
image_name = db.Column(db.String(30))
name = db.Column(db.String(10),unique=True, nullable=False)
description = db.Column(db.String(150), nullable=False)
name = db.Column(db.String(30),unique=True, nullable=False)
description = db.Column(db.String(500), nullable=False)
github = db.Column(db.String(120), nullable=False)
tag_urls = db.Column(db.String(120), nullable=True)
tag_urls = db.Column(db.String(500), nullable=True)
status = db.Column(db.Integer,default=1)
def __repr__(self):
return f'<Project {self.name}>'
12 changes: 10 additions & 2 deletions app/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,27 @@
from werkzeug.utils import secure_filename
import os
from app.models import TechStack, Project
import json
#Route Home / or /home
@app.route('/home')
@app.route('/')
def home():
techstack = TechStack.query.all()
return render_template('index.html',techstack=techstack)
projects = Project.query.all()
tags=[]
for i in projects:
tags.append(json.loads(i.tag_urls))
return render_template('index.html',techstack=techstack,projects=projects,p_tags=tags)


@app.route('/image_upload', methods=['GET','POST'])
@login_required
def image_upload():
if request.method=='POST':
f=request.files['img']
f.save(os.path.join(app.config['UPLOAD_FOLDER'], secure_filename(f.filename)))
if request.form['folder']=='tech_stack':
f.save(os.path.join(app.config['UPLOAD_FOLDER'], secure_filename(f.filename)))
else:
f.save(os.path.join(app.config['PROJECT_UPLOAD_FOLDER'], secure_filename(f.filename)))
return redirect(url_for('image_upload',status='Success'))
return render_template('image_upload.html')
Loading

0 comments on commit 26086d8

Please sign in to comment.