31 |
32 |
Featured Sculptures
33 |
34 |
35 |
36 | {% for painting,file in sculptures.items() %}
37 |
38 |
39 |
{{painting}}
40 |
41 |
42 |
43 | {% endfor %}
44 |
45 |
46 |
47 |
48 |
About This Site
49 |
ALM Art Gallery is an open source website containing over 100 different varieties of paintings and sculptures, including collections of
50 | visuals, performing, and media arts of modern and medieval times. A reflection of our multidisciplinary mission and the increasingly
51 | cross-disciplinary practice of artists, ALM gallery reflect a diverse range of artistic pursuits, including: a permanent collection
52 | of visual arts, the Moving Image Collection, performing arts commissions, the library’s Collection of
53 | artists’ books, Company Collection like those from Pixar, and the Digital Arts Study Collection.
54 | Browse our holdings and learn more about the art and artists who animate our collections.
55 |
56 |
57 |
58 |
59 |
60 |
Contributors
61 |
62 |
63 |
64 |
65 |
66 |
Abdul Mohsin Siddiqi
67 |
Frontend Developer
68 |
Undergraduate in Bachelors of Technology (Computer Engineering) at Jamia Millia Islamia, New Delhi
69 |
70 |
71 |
72 |
73 |
Ajitesh Rai
74 |
Backend Developer
75 |
Undergraduate in Bachelors of Technology (Computer Engineering) at Jamia Millia Islamia, New Delhi
76 |
77 |
78 |
79 |
80 |
Lakshita Bhatia
81 |
Team Leader
82 |
Undergraduate in Bachelors of Technology (Computer Engineering) at Jamia Millia Islamia, New Delhi
83 |
84 |
92 |
93 |
94 |
95 |
96 |
Feedback
97 |
98 |
99 |
100 |
101 |
Write a review...
102 |
108 |
109 |
110 |
111 |
112 | {% endblock %}
113 |
--------------------------------------------------------------------------------
/art_web/templates/macros.html:
--------------------------------------------------------------------------------
1 | {% macro render_field(field) -%}
2 |
3 | {% if field.type == 'CSRFTokenField' %}
4 | {{ field }}
5 |
6 | {% if field.errors %}
7 |
You have submitted an invalid CSRF token
8 | {% endif %}
9 | {% elif field.type == 'HiddenField' %}
10 | {{ field }}
11 | {# any other special case you may need #}
12 | {% else %}
13 |
14 | {{ field(placeholder=field.description,class_="w3-input w3-section") }}
15 | {% if field.errors %}
16 |
17 | {% for err in field.errors %}
18 |
{{ err|e }}
19 | {% endfor %}
20 |
21 | {% endif %}
22 | {% endif %}
23 |
24 | {%- endmacro %}
25 |
--------------------------------------------------------------------------------
/art_web/templates/profile.html:
--------------------------------------------------------------------------------
1 | {% extends "base.html" %}
2 |
3 | {% block title %}{{ title }}{% endblock %}
4 |
5 | {% block content %}
6 |
7 |
8 |
9 |
10 |
User profile
11 |
12 |
{{ session['email'] }}
13 |
15 |
Submit Art
16 |
17 |
18 |
19 | {% endblock %}
20 |
--------------------------------------------------------------------------------
/art_web/templates/signin.html:
--------------------------------------------------------------------------------
1 | {% extends "base.html" %}
2 | {% block title %}{{ title }}{% endblock %}
3 | {% block content %}
4 |
28 | {% endblock %}
29 |
--------------------------------------------------------------------------------
/art_web/templates/signup.html:
--------------------------------------------------------------------------------
1 | {% extends 'base.html' %}
2 | {% block title %}{{ title }}{% endblock %}
3 | {% block content %}
4 |
5 |
72 | {% endblock %}
73 |
--------------------------------------------------------------------------------
/art_web/templates/submit_art.html:
--------------------------------------------------------------------------------
1 | {% extends "base.html" %}
2 |
3 | {% block title %}{{ title }}{% endblock %}
4 |
5 | {% block content %}
6 |
7 |
8 |
15 |
16 |
17 | {% endblock %}
18 |
--------------------------------------------------------------------------------
/art_web/views.py:
--------------------------------------------------------------------------------
1 | from art_web import app
2 | from flask import render_template, request, flash, redirect, url_for, session
3 | from models import db, User, Feedback, Paintings, Artist, AdminUser
4 | from forms import SignupForm, SigninForm , FeedbackForm, SubmitArt
5 | from flask_admin import Admin
6 | from flask_admin.base import MenuLink
7 | from flask_admin.contrib.sqla import ModelView
8 | # from flask_basicauth import BasicAuth
9 |
10 |
11 | class MyModelView(ModelView):
12 | column_display_pk = True
13 | column_hide_backrefs = True
14 |
15 |
16 | # Admin views
17 | admin = Admin(app, name='Art Gallery', template_mode='bootstrap3')
18 | # admin = Admin(app, name='art_gallery', base_template='base.html')
19 | admin.add_view(MyModelView(AdminUser, db.session))
20 | admin.add_view(MyModelView(User, db.session))
21 | admin.add_view(MyModelView(Feedback, db.session))
22 | admin.add_view(MyModelView(Paintings, db.session))
23 | admin.add_view(MyModelView(Artist, db.session))
24 | # Add home link by url
25 | admin.add_link(MenuLink(name='Back', url='/'))
26 |
27 |
28 | @app.route('/testdb')
29 | def testdb():
30 | user = Paintings.query.with_entities(Paintings.name, Paintings.painting_photo).filter_by(artist_id=1)
31 | print dict(user.all())
32 | for u in user.all():
33 | print u
34 | # return render_template("login.html",title="login")
35 | return "done!"
36 |
37 | @app.route('/', methods=['GET', 'POST'])
38 | def index():
39 | title = 'Home'
40 | form = FeedbackForm()
41 | pnt = Paintings.query.with_entities(Paintings.name, Paintings.painting_photo).filter_by(artist_id=1)
42 | scp = Paintings.query.with_entities(Paintings.name, Paintings.painting_photo).filter_by(artist_id=2)
43 | paintings = dict(pnt.all())
44 | sculptures = dict(scp.all())
45 | if request.method == 'POST':
46 | if form.validate() == False:
47 | return render_template('index.html',title = title, paintings = paintings, sculptures = sculptures, form = form)
48 | else:
49 | feedback = Feedback(form.name.data, form.email.data, form.subject.data, form.comment.data)
50 | db.session.add(feedback)
51 | db.session.commit()
52 | flash("Form submitted successfully!", "success")
53 | return redirect(url_for('index'))
54 | return render_template('index.html',title = title, paintings = paintings, sculptures = sculptures, form = form)
55 |
56 | @app.route('/profile')
57 | def profile():
58 | title = 'Profile'
59 | if 'email' not in session:
60 | return redirect(url_for('signin'))
61 |
62 | # Admin user
63 | if session['email'] == 'admin':
64 | return render_template('profile.html',title=title)
65 |
66 | # Normal user
67 | user = User.query.filter_by(email = session['email']).first()
68 | if user is None:
69 | return redirect(url_for('signin'))
70 | else:
71 | return render_template('profile.html',title=title)
72 |
73 | @app.route('/signout')
74 | def signout():
75 | if 'email' not in session:
76 | return redirect(url_for('signin'))
77 |
78 | session.pop('email', None)
79 | return redirect(url_for('index'))
80 |
81 | @app.route('/signup', methods=['GET', 'POST'])
82 | def signup():
83 | title = 'Sign Up'
84 | form = SignupForm()
85 | # If user is signed in
86 | if 'email' in session:
87 | return redirect(url_for('profile'))
88 | if request.method == 'POST':
89 | if form.validate() == False:
90 | return render_template('signup.html',title = title, form=form)
91 | else:
92 | newuser = User(form.firstname.data, form.lastname.data, form.email.data\
93 | , form.password.data, form.phone_number.data, form.gender.data, form.address.data\
94 | , form.city.data, form.country.data)
95 | db.session.add(newuser)
96 | db.session.commit()
97 | session['email'] = newuser.email
98 | return redirect(url_for('profile'))
99 |
100 | elif request.method == 'GET':
101 | return render_template('signup.html',title = title, form=form)
102 |
103 | @app.route('/signin', methods=['GET', 'POST'])
104 | def signin():
105 | title = 'Login'
106 | form = SigninForm()
107 | # If user is signed in
108 | if 'email' in session:
109 | return redirect(url_for('profile'))
110 |
111 | if request.method == 'POST':
112 | auser = AdminUser.query.filter_by(email = form.email.data.lower()).first()
113 |
114 | # Admin login
115 | if auser and auser.check_password(form.password.data):
116 | session['email'] = 'admin'
117 | return redirect('/admin')
118 |
119 | elif form.validate() == False:
120 | return render_template('signin.html',title = title, form=form)
121 |
122 | else:
123 | # return "hello!"
124 | session['email'] = form.email.data
125 | return redirect(url_for('profile'))
126 |
127 | elif request.method == 'GET':
128 | return render_template('signin.html',title = title, form=form)
129 |
130 |
131 | @app.route('/art', methods=['GET','POST'])
132 | def art():
133 | title = "Submit art"
134 | form = SubmitArt()
135 | if 'email' not in session:
136 | flash("Signin first!","error")
137 | return redirect(url_for(signin))
138 | elif request.method == 'POST':
139 | if form.validate() == False:
140 | flash("Enter correct values!","error")
141 | return render_template('submit_art.html',title = title, form=form)
142 | else:
143 | newart = Paintings(form.name.data, form.location.data, form.artist_id.data)
144 | db.session.add(newart)
145 | db.session.commit()
146 | flash("Form submitted successfully!", "success")
147 | return redirect(url_for('art'))
148 |
149 | return render_template("submit_art.html",title=title, form=form)
150 |
--------------------------------------------------------------------------------
/before_install.txt:
--------------------------------------------------------------------------------
1 | sudo apt install python-dev libmysqlclient-dev python-mysqldb
2 |
--------------------------------------------------------------------------------
/cur_tree.txt:
--------------------------------------------------------------------------------
1 | .
2 | ├── cur_tree.txt
3 | ├── forms.py
4 | ├── __init__.py
5 | ├── models.py
6 | ├── static
7 | │ ├── assets
8 | │ ├── js
9 | │ │ ├── bootstrap.min.js
10 | │ │ └── jquery.min.js
11 | │ └── style
12 | ├── templates
13 | └── views.py
14 |
15 | 5 directories, 7 files
16 |
--------------------------------------------------------------------------------
/requirements.txt:
--------------------------------------------------------------------------------
1 | alembic==0.8.8
2 | click==6.6
3 | Flask==0.11.1
4 | Flask-Admin==1.4.2
5 | Flask-Migrate==2.0.1
6 | Flask-Script==2.0.5
7 | Flask-SQLAlchemy==2.1
8 | Flask-Uploads==0.2.1
9 | Flask-WTF==0.13.1
10 | gunicorn==19.7.1
11 | itsdangerous==0.24
12 | Jinja2==2.8
13 | Mako==1.0.6
14 | MarkupSafe==0.23
15 | MySQL-python==1.2.5
16 | psycopg2==2.7.1
17 | python-editor==1.0.1
18 | SQLAlchemy==1.1.3
19 | Werkzeug==0.11.11
20 | WTForms==2.1
21 |
--------------------------------------------------------------------------------
/runserver.py:
--------------------------------------------------------------------------------
1 | from art_web import app
2 | app.run(debug = True)
3 |
--------------------------------------------------------------------------------