Add not joined rank

This commit is contained in:
rubenwardy 2018-03-20 04:03:13 +00:00
parent 73f24add61
commit 363f9d8016
3 changed files with 16 additions and 6 deletions

@ -16,11 +16,12 @@ def url_to_title(url):
return url.replace("_", " ")
class UserRank(enum.Enum):
NEW_MEMBER = 0
MEMBER = 1
EDITOR = 2
MODERATOR = 3
ADMIN = 4
NOT_JOINED = 0
NEW_MEMBER = 1
MEMBER = 2
EDITOR = 3
MODERATOR = 4
ADMIN = 5
def atLeast(self, min):
return self.value >= min.value
@ -59,7 +60,7 @@ class User(db.Model, UserMixin):
self.username = username
self.confirmed_at = datetime.datetime.now() - datetime.timedelta(days=6000)
self.display_name = username
self.rank = UserRank.MEMBER
self.rank = UserRank.NOT_JOINED
def isClaimed(self):
return self.password is not None and self.password != ""

@ -13,6 +13,14 @@
<td>Name</td>
<td>{{ package.name }}</td>
</tr>
<tr>
<td>Author</td>
<td>
<a href="{{ url_for('user_profile_page', username=package.author.username) }}">
{{ package.author.display_name }}
</a>
</td>
</tr>
<tr>
<td>Type</td>
<td>{{ package.type.value }}</td>

@ -14,6 +14,7 @@ if not os.path.isfile("db.sqlite"):
ruben = User("rubenwardy")
ruben.github_username = "rubenwardy"
ruben.rank = UserRank.MEMBER
db.session.add(ruben)
jeija = User("Jeija")