예제 #1
0
 def post(self):
     args = self.parser.parse_args()
     if args:
         if Vets.create(**args):
             vet = Vets.filter(**args).__getitem__(0)
             flash('You were successfully created Vet!')
             next_page = request.args.get("next", url_for("home_page"))
             return redirect(next_page)
         else:
             flash('You were failed to create Vet!')
             next_page = request.args.get("next", url_for("home_page"))
             return redirect(next_page)
     return {}, 404
예제 #2
0
 def delete(self, id):
     if current_user.is_admin:
         u = Vets.get(id=id)
         if u:
             r = u.__dict__
             u.delete()
             return r, 200
     else:
         abort(403)
예제 #3
0
 def get(self):
     if current_user.is_admin:
         qs = Vets.filter()
         if qs:
             r = [u.__dict__ for u in qs]
             return r
     else:
         abort(403)
     abort(404)
예제 #4
0
 def put(self, id):
     if current_user.is_admin:
         args = self.parser.parse_args()
         u = Vets.get(id=id)
         if u and args:
             u.update(**args)
             return u.__dict__
     else:
         abort(403)
     return {}, 404
예제 #5
0
 def get(self, id):
     u = Vets.get(id=id)
     if u:
         vet = u.__dict__
         return vet
     return {}, 404
예제 #6
0
def owner_profile(phonenumber):
    o = Owners.get(phonenumber=phonenumber)
    _vets = Vets.filter()
    return render_template('owner_profile.html', owner=o, vet_list=_vets)
예제 #7
0
def vet_profiles():
    v = Vets.filter()
    return render_template('vet_profiles.html', vets=v)
예제 #8
0
def vet_profile(id):
    v = Vets.get(id=id)
    return render_template('vet_profile.html', vet=v)