Skip to content

Commit

Permalink
fix(settings): disable broken settings page (#130)
Browse files Browse the repository at this point in the history
  • Loading branch information
drahamim authored Mar 11, 2024
1 parent bdc6b7a commit ac7fdeb
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 20 deletions.
31 changes: 15 additions & 16 deletions src/invenflask/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,8 @@
from werkzeug.utils import secure_filename
from flask_moment import Moment
from sqlalchemy import func
# from .models import Asset, Staff, Checkout, History, db, GlobalSet
from .models import Asset, Staff, Checkout, History, db
# from .forms import SettingsForm
from .models import Asset, Staff, Checkout, History, db, GlobalSet
from .forms import SettingsForm

app = Flask(__name__)
app.config['SQLALCHEMY_DATABASE_URI'] = os.getenv(
Expand Down Expand Up @@ -437,16 +436,16 @@ def showData():
return redirect(url_for('staffs'))


# @app.route('/settings', methods=['GET', 'POST'])
# def settings():
# form = SettingsForm()
# if form.validate_on_submit():
# tz = GlobalSet.query.filter_by(settingid="timezone").first()
# tz.setting = form.timezone.data
# db.session.commit()
# flash('Your settings have been updated.')
# return redirect(url_for('settings'))
# elif request.method == 'GET':
# form.timezone.data = db.session.query(GlobalSet).filter(
# GlobalSet.settingid == "timezone").first().setting
# return render_template('settings.html', title='Settings', form=form)
@app.route('/settings', methods=['GET', 'POST'])
def settings():
form = SettingsForm()
if form.validate_on_submit():
tz = GlobalSet.query.filter_by(settingid="timezone").first()
tz.setting = form.timezone.data
db.session.commit()
flash('Your settings have been updated.')
return redirect(url_for('settings'))
elif request.method == 'GET':
form.timezone.data = db.session.query(GlobalSet).filter(
GlobalSet.settingid == "timezone").first().setting
return render_template('settings.html', title='Settings', form=form)
9 changes: 5 additions & 4 deletions src/invenflask/templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,12 @@
<a class="nav-link" href="{{ url_for('history') }}">History
</a>
</li>
<!-- <li class="nav-item">
<a class="nav-link" href="{{ url_for('settings') }}">Settings
</a>
</li> -->
</ul>
<!-- <li class="nav-item">
<a class="nav-link" href="{{ url_for('settings') }}">Settings
</a>
</li> -->

<!-- <form class="d-flex">
<input class="form-control me-sm-2" type="search" placeholder="Search">
<button class="btn btn-secondary my-2 my-sm-0" type="submit">Search</button>
Expand Down

0 comments on commit ac7fdeb

Please sign in to comment.