Skip to content
Snippets Groups Projects
Commit 39547aa6 authored by Brian Wood's avatar Brian Wood
Browse files

Updated movie conversion fixed signup modal problems

parent bfc5f671
Branches
No related tags found
No related merge requests found
...@@ -110,7 +110,7 @@ def addlibraryItem(name,user=None): ...@@ -110,7 +110,7 @@ def addlibraryItem(name,user=None):
movie = Movie.convertMovie(movie) movie = Movie.convertMovie(movie)
library.addUnit(movie) library.addUnit(movie)
if library.name != 'Master': if library.name != 'Master':
master = Library(user=user,name="Master",unit='Movie').first() master = Library.objects(user=user,name="Master",unit='Movie').first()
master.addUnit(movie) master.addUnit(movie)
return jsonify(response='success',type='redirect',path=url_for(endpoint='library',name=name,_external=True)) return jsonify(response='success',type='redirect',path=url_for(endpoint='library',name=name,_external=True))
\ No newline at end of file
...@@ -11,6 +11,7 @@ def loaned(user=None): ...@@ -11,6 +11,7 @@ def loaned(user=None):
@app.route('/send-reminder', methods=['POST']) @app.route('/send-reminder', methods=['POST'])
@security('user') @security('user')
def reminderEmail(user=None): def reminderEmail(user=None):
import smtplib
from_addr = user.email from_addr = user.email
to_addr = request.form['email'] to_addr = request.form['email']
subject = request.form['subject'] or "Movie Return Reminder" subject = request.form['subject'] or "Movie Return Reminder"
...@@ -22,6 +23,8 @@ def reminderEmail(user=None): ...@@ -22,6 +23,8 @@ def reminderEmail(user=None):
if not movie: if not movie:
return jsonify(response='error',message='Invalid Movie given'),404 return jsonify(response='error',message='Invalid Movie given'),404
loan = movie.getLoan(user) loan = movie.getLoan(user)
if not loan:
return jsonify(response='error',message='Invalid Movie given'),404
message = request.form['message'] or "The movie %s, borrowed form %s is due on %s" % (movie.title, user.email, loan.expected_return_date) message = request.form['message'] or "The movie %s, borrowed form %s is due on %s" % (movie.title, user.email, loan.expected_return_date)
login = app.config['SMTP_USER'] login = app.config['SMTP_USER']
password = app.config['SMTP_PASSWORD'] password = app.config['SMTP_PASSWORD']
...@@ -37,3 +40,4 @@ def reminderEmail(user=None): ...@@ -37,3 +40,4 @@ def reminderEmail(user=None):
server.login(login,password) server.login(login,password)
problems = server.sendmail(from_addr, to_addr, message) problems = server.sendmail(from_addr, to_addr, message)
server.quit() server.quit()
return jsonify(response='success',type="reload")
\ No newline at end of file
...@@ -6,6 +6,7 @@ class Movie(db.Document): ...@@ -6,6 +6,7 @@ class Movie(db.Document):
title = db.StringField(max_length=255, required=True) title = db.StringField(max_length=255, required=True)
summary = db.StringField(max_length=10000, required=True) summary = db.StringField(max_length=10000, required=True)
tags = db.ListField(db.StringField(max_length=50)) tags = db.ListField(db.StringField(max_length=50))
cast = db.ListField(db.StringField())
tmdb_id = db.IntField() tmdb_id = db.IntField()
runtime = db.IntField() runtime = db.IntField()
poster = db.StringField() poster = db.StringField()
...@@ -51,9 +52,12 @@ class Movie(db.Document): ...@@ -51,9 +52,12 @@ class Movie(db.Document):
result.runtime = int(movie.runtime) result.runtime = int(movie.runtime)
tags = movie.keywords tags = movie.keywords
for tag in tags: for tag in tags:
result.addTag(str(tag)) result.addTag(str(tag.name.encode('utf-8')))
genres = movie.genres genres = movie.genres
for genre in genres: for genre in genres:
result.addTag(str(genre)) result.addTag(str(genre.name.encode('utf-8')))
cast = movie.cast
for actor in cast:
result.cast.append("%s as %s" % (actor.name,actor.character))
result.save() result.save()
return result return result
...@@ -5,19 +5,19 @@ ...@@ -5,19 +5,19 @@
<div class="form-group"> <div class="form-group">
<label for="userEmail" class="col-sm-3 control-label">Email</label> <label for="userEmail" class="col-sm-3 control-label">Email</label>
<div class="col-xs-9 col-md-6"> <div class="col-xs-9 col-md-6">
<input type="email" class="form-control" id="userEmail" name="email" placeholder="Email address"> <input type="email" class="form-control" id="signupEmail" name="email" placeholder="Email address">
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="userPassword" class="col-sm-3 control-label">Password</label> <label for="userPassword" class="col-sm-3 control-label">Password</label>
<div class="col-xs-9 col-md-6"> <div class="col-xs-9 col-md-6">
<input type="password" class="form-control" id="userPassword" name="password" placeholder="Password"> <input type="password" class="form-control" id="signupPassword" name="password" placeholder="Password">
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="userPasswordConfirm" class="col-sm-3 control-label">Confirm Password</label> <label for="userPasswordConfirm" class="col-sm-3 control-label">Confirm Password</label>
<div class="col-xs-9 col-md-6"> <div class="col-xs-9 col-md-6">
<input type="password" class="form-control" id="userPasswordConfirm" name="passwordConfirm" placeholder="Password"> <input type="password" class="form-control" id="signupPasswordConfirm" name="passwordConfirm" placeholder="Password">
</div> </div>
</div> </div>
</form> </form>
...@@ -30,8 +30,7 @@ rules: { ...@@ -30,8 +30,7 @@ rules: {
password: "required", password: "required",
passwordConfirm: { passwordConfirm: {
required: true, required: true,
minlength: 5, equalTo: "#signupPassword"
equalTo: "#userPassword"
}, },
email: { email: {
required: true, required: true,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment