added DB support for recycle bin
This commit is contained in:
@@ -15,9 +15,10 @@ class Settings(db.Model):
|
||||
id = db.Column(db.Integer, db.Sequence('settings_id_seq'), primary_key=True )
|
||||
import_path = db.Column(db.String)
|
||||
storage_path = db.Column(db.String)
|
||||
recycle_bin_path = db.Column(db.String)
|
||||
|
||||
def __repr__(self):
|
||||
return f"<id: {self.id}, import_path: {self.import_path}, storage_path: {self.storage_path}>"
|
||||
return f"<id: {self.id}, import_path: {self.import_path}, storage_path: {self.storage_path}, recycle_bin_path: {self.recycle_bin_path}>"
|
||||
|
||||
################################################################################
|
||||
# Helper class that inherits a .dump() method to turn class Settings into json / useful in jinja2
|
||||
@@ -37,6 +38,7 @@ class SettingsForm(FlaskForm):
|
||||
id = HiddenField()
|
||||
import_path = StringField('Path(s) to import from:', [validators.DataRequired()])
|
||||
storage_path = StringField('Path to store sorted images to:', [validators.DataRequired()])
|
||||
recycle_bin_path = StringField('Path to temporarily store deleted images in:', [validators.DataRequired()])
|
||||
submit = SubmitField('Save' )
|
||||
|
||||
################################################################################
|
||||
@@ -57,6 +59,7 @@ def settings():
|
||||
st.SetMessage("Successfully Updated Settings" )
|
||||
s.import_path = request.form['import_path']
|
||||
s.storage_path = request.form['storage_path']
|
||||
s.recycle_bin_path = request.form['recycle_bin_path']
|
||||
db.session.commit()
|
||||
return redirect( '/settings' )
|
||||
except SQLAlchemyError as e:
|
||||
|
||||
Reference in New Issue
Block a user