- Joined
- Jan 18, 2012
- Messages
- 335
- Reaction score
- 119
CaveCMS
This something I've been keen on trying out for quite a while. I'm currently in the process of writing a CMS in Python, so far the name has been decided as CaveCMS. Don't ask why.
I'll be developing this at my own pace: admittedly I do have a lot on my plate at the moment, but this will get done as I slowly progress through it. Once it's in a usable state I'll put up the source on a scm repository, as well as a demo.
CaveCMS uses Flask as its web framework; the variety of extensions as well as Jinja made it a great choice to write the CMS in. For the design, I'll use Bootstrap with the "United" swatch from Bootswatch. I won't be using any (if any) Habbo assets since I want to release the whole thing under an open source license (MIT).
Screenshots so far:
Not much, I know. The design isn't (currently) something I'm focusing on.
Snippets:
Login view:
Landing jinja2 template:
I'll keep this thread update as I go along. Advice, feedback or suggestions are greatly appreciated!
This something I've been keen on trying out for quite a while. I'm currently in the process of writing a CMS in Python, so far the name has been decided as CaveCMS. Don't ask why.
I'll be developing this at my own pace: admittedly I do have a lot on my plate at the moment, but this will get done as I slowly progress through it. Once it's in a usable state I'll put up the source on a scm repository, as well as a demo.
CaveCMS uses Flask as its web framework; the variety of extensions as well as Jinja made it a great choice to write the CMS in. For the design, I'll use Bootstrap with the "United" swatch from Bootswatch. I won't be using any (if any) Habbo assets since I want to release the whole thing under an open source license (MIT).
Screenshots so far:
Snippets:
Login view:
Code:
@no_login
@cave.route('/login', methods=['GET', 'POST'])
def login():
if request.method == 'GET':
return redirect(url_for('index') + '#login')
form = LoginForm(request.form)
if form.validate_on_submit():
user = User.query.filter_by(username=form.login_username.data).first()
if user and user.password == hashlib.md5(form.login_password.data).hexdigest():
login_user(user)
flash('Welcome back, %s!' % user.username)
return redirect(url_for('me'))
flash('Invalid username or password.')
return render_template('index.html', form=form)
Code:
{% extends 'layout.html' %}
{% block title %}Home{% endblock %}
{% block body %}
{% for e in form.errors %}
{% if e.startswith('login_') %}
<script type="text/javascript">
$(document).ready(function(){showLogin();});
</script> {% break %}
{% endif %}
{% endfor %}
<h1>Welcome to {{ config['HOTEL_NAME'] }}!</h1>
<p>{{ config['HOTEL_NAME'] }} is a free, fun virtual world where you can build your own rooms, chat to your friends, and make new ones!</p>
{% for flash in get_flashed_messages() %}
<div class="alert">{{ flash}}
{% endfor %}
{% for error in form.errors %}
<div class="alert alert-error">{{ error }}</div>
{% endfor %}
<div class="well">
<button class="btn btn-large btn-primary" type="button" id="hp-login-btn">Log in</button>
<button class="btn btn-large btn-success" type="button" id="hp-register-btn">New here? Register!</button>
<div id="hp-login-form">
{% from '_render.html' import render %}
<form action="login" method="POST">
<fieldset>
<legend>Log in to {{ config['HOTEL_NAME'] }}</legend>
{{ form.csrf_token }}
{{ render(form.login_username) }}
{{ render(form.login_password) }}
<button class="btn btn-large btn-primary" type="submit" id="hp-login-btn">Log in</button>
<span style="padding-left:15px">Don't have an account? <a href="#register" id="hp-loginreg-a">Register now!</a>
</div>
</div>
<div id="ws-content">
<div class="alert">TODO: Add filler content, maybe features?</div>
</div>
{% endblock %}

