diff --git a/sachet/server/models.py b/sachet/server/models.py index 69e3752..f2e7cba 100644 --- a/sachet/server/models.py +++ b/sachet/server/models.py @@ -89,9 +89,13 @@ class User(db.Model): self.password = self.gen_hash(password) self.username = username - self.url = url_for("users_blueprint.user_api", username=self.username) self.register_date = datetime.datetime.now() + @property + def url(self): + """URL linking to this resource.""" + return url_for("users_blueprint.user_api", username=self.username) + def gen_hash(self, psswd): """Generates a hash from a password.""" return bcrypt.generate_password_hash(