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
No related branches found
No related tags found
No related merge requests found
......@@ -110,7 +110,7 @@ def addlibraryItem(name,user=None):
movie = Movie.convertMovie(movie)
library.addUnit(movie)
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)
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):
@app.route('/send-reminder', methods=['POST'])
@security('user')
def reminderEmail(user=None):
import smtplib
from_addr = user.email
to_addr = request.form['email']
subject = request.form['subject'] or "Movie Return Reminder"
......@@ -22,6 +23,8 @@ def reminderEmail(user=None):
if not movie:
return jsonify(response='error',message='Invalid Movie given'),404
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)
login = app.config['SMTP_USER']
password = app.config['SMTP_PASSWORD']
......@@ -37,3 +40,4 @@ def reminderEmail(user=None):
server.login(login,password)
problems = server.sendmail(from_addr, to_addr, message)
server.quit()
return jsonify(response='success',type="reload")
\ No newline at end of file
......@@ -6,6 +6,7 @@ class Movie(db.Document):
title = db.StringField(max_length=255, required=True)
summary = db.StringField(max_length=10000, required=True)
tags = db.ListField(db.StringField(max_length=50))
cast = db.ListField(db.StringField())
tmdb_id = db.IntField()
runtime = db.IntField()
poster = db.StringField()
......@@ -51,9 +52,12 @@ class Movie(db.Document):
result.runtime = int(movie.runtime)
tags = movie.keywords
for tag in tags:
result.addTag(str(tag))
result.addTag(str(tag.name.encode('utf-8')))
genres = movie.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()
return result
......@@ -5,19 +5,19 @@
<div class="form-group">
<label for="userEmail" class="col-sm-3 control-label">Email</label>
<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 class="form-group">
<label for="userPassword" class="col-sm-3 control-label">Password</label>
<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 class="form-group">
<label for="userPasswordConfirm" class="col-sm-3 control-label">Confirm Password</label>
<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>
</form>
......@@ -30,8 +30,7 @@ rules: {
password: "required",
passwordConfirm: {
required: true,
minlength: 5,
equalTo: "#userPassword"
equalTo: "#signupPassword"
},
email: {
required: true,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment