Initial commit
This commit is contained in:
3
.gitignore
vendored
Normal file
3
.gitignore
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
static
|
||||
settings.py
|
||||
*.pyc
|
0
__init__.py
Normal file
0
__init__.py
Normal file
14
manage.py
Executable file
14
manage.py
Executable file
@@ -0,0 +1,14 @@
|
||||
#!/usr/bin/env python
|
||||
from django.core.management import execute_manager
|
||||
import imp
|
||||
try:
|
||||
imp.find_module('settings') # Assumed to be in the same directory.
|
||||
except ImportError:
|
||||
import sys
|
||||
sys.stderr.write("Error: Can't find the file 'settings.py' in the directory containing %r. It appears you've customized things.\nYou'll have to run django-admin.py, passing it your settings module.\n" % __file__)
|
||||
sys.exit(1)
|
||||
|
||||
import settings
|
||||
|
||||
if __name__ == "__main__":
|
||||
execute_manager(settings)
|
0
minecraft/__init__.py
Normal file
0
minecraft/__init__.py
Normal file
4
minecraft/admin.py
Normal file
4
minecraft/admin.py
Normal file
@@ -0,0 +1,4 @@
|
||||
import models
|
||||
from django.contrib import admin
|
||||
admin.site.register(models.MinecraftProfile)
|
||||
admin.site.register(models.Quote)
|
5
minecraft/context.py
Normal file
5
minecraft/context.py
Normal file
@@ -0,0 +1,5 @@
|
||||
import models
|
||||
|
||||
def random_quote(request):
|
||||
quote = models.Quote.objects.order_by('?')[0]
|
||||
return {'quote': quote}
|
15
minecraft/models.py
Normal file
15
minecraft/models.py
Normal file
@@ -0,0 +1,15 @@
|
||||
from django.db import models
|
||||
from django.contrib.auth.models import User
|
||||
|
||||
class MinecraftProfile(models.Model):
|
||||
user = models.OneToOneField(User)
|
||||
mc_username = models.CharField(max_length=30)
|
||||
|
||||
def __unicode__(self):
|
||||
return self.mc_username
|
||||
|
||||
class Quote(models.Model):
|
||||
text = models.CharField(max_length=50)
|
||||
|
||||
def __unicode__(self):
|
||||
return self.text
|
16
minecraft/tests.py
Normal file
16
minecraft/tests.py
Normal file
@@ -0,0 +1,16 @@
|
||||
"""
|
||||
This file demonstrates writing tests using the unittest module. These will pass
|
||||
when you run "manage.py test".
|
||||
|
||||
Replace this with more appropriate tests for your application.
|
||||
"""
|
||||
|
||||
from django.test import TestCase
|
||||
|
||||
|
||||
class SimpleTest(TestCase):
|
||||
def test_basic_addition(self):
|
||||
"""
|
||||
Tests that 1 + 1 always equals 2.
|
||||
"""
|
||||
self.assertEqual(1 + 1, 2)
|
5
minecraft/urls.py
Normal file
5
minecraft/urls.py
Normal file
@@ -0,0 +1,5 @@
|
||||
from django.conf.urls.defaults import patterns, include, url
|
||||
|
||||
urlpatterns = patterns('minecraft',
|
||||
url(r'^profile$', 'views.profile', name='user_profile'),
|
||||
)
|
7
minecraft/views.py
Normal file
7
minecraft/views.py
Normal file
@@ -0,0 +1,7 @@
|
||||
from django.contrib.auth.decorators import login_required
|
||||
from django.shortcuts import render_to_response
|
||||
from django.template import RequestContext
|
||||
|
||||
@login_required
|
||||
def profile(request):
|
||||
return render_to_response('minecraft/profile.html', context_instance = RequestContext(request))
|
41
templates/base.html
Normal file
41
templates/base.html
Normal file
@@ -0,0 +1,41 @@
|
||||
{%load static %}
|
||||
{% get_static_prefix as STATIC_PREFIX %}
|
||||
<html>
|
||||
<head>
|
||||
<title>{% block title %}Caminus{%endblock%} - Caminus</title>
|
||||
<link rel="stylesheet" type="text/css" href="{{ STATIC_PREFIX }}/css/reset.css"/>
|
||||
<link rel="stylesheet" type="text/css" href="{{ STATIC_PREFIX }}/css/text.css"/>
|
||||
<link rel="stylesheet" type="text/css" href="{{ STATIC_PREFIX }}/css/960.css"/>
|
||||
<link rel="stylesheet" type="text/css" href="{{ STATIC_PREFIX }}/css/main.css"/>
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div id="wrapper" class="container_12">
|
||||
<div id="title" class="grid_4">
|
||||
<a href="/">
|
||||
<img src="{{ STATIC_PREFIX }}images/logo.png"/>
|
||||
<h1>Caminus</h1>
|
||||
</a>
|
||||
<div class="slogan">{{ quote }}</div>
|
||||
</div>
|
||||
<div class="grid_4">
|
||||
<div id="epicenter">
|
||||
<h2>Epicenter</h2>
|
||||
{% if user.is_authenticated %}
|
||||
<p>Welcome, {{ user.username }}</p>
|
||||
<ul>
|
||||
<li><a href="{% url user_profile %}">Profile</a></li>
|
||||
</ul>
|
||||
{% else %}
|
||||
<p>Welcome! Do you have an invite?<p>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
<div class="clear"></div>
|
||||
<div id="content" class="grid_12">
|
||||
{% block content %}
|
||||
{% endblock %}
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
6
templates/minecraft/profile.html
Normal file
6
templates/minecraft/profile.html
Normal file
@@ -0,0 +1,6 @@
|
||||
{% extends "base.html" %}
|
||||
{%block title%}Your Profile{%endblock%}
|
||||
|
||||
{%block content %}
|
||||
<p>Welcome, {{ user.username }}</p>
|
||||
{%endblock%}
|
11
templates/registration/login.html
Normal file
11
templates/registration/login.html
Normal file
@@ -0,0 +1,11 @@
|
||||
{% extends "base.html" %}
|
||||
|
||||
{%block title %}Login{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<form action="{% url django.contrib.auth.views.login %}" method="POST">
|
||||
{% csrf_token %}
|
||||
{{ form.as_p }}
|
||||
<input type="submit" value="Login"/>
|
||||
</form>
|
||||
{% endblock %}
|
23
urls.py
Normal file
23
urls.py
Normal file
@@ -0,0 +1,23 @@
|
||||
from django.conf.urls.defaults import patterns, include, url
|
||||
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
|
||||
|
||||
# Uncomment the next two lines to enable the admin:
|
||||
from django.contrib import admin
|
||||
admin.autodiscover()
|
||||
|
||||
urlpatterns = patterns('',
|
||||
url(r'^minecraft/', include('minecraft.urls')),
|
||||
url(r'^accounts/login/$', 'django.contrib.auth.views.login'),
|
||||
url(r'^accounts/profile/$', 'minecraft.views.profile'),
|
||||
# Examples:
|
||||
url(r'^$', 'minecraft.views.profile', name='home'),
|
||||
# url(r'^caminus/', include('caminus.foo.urls')),
|
||||
|
||||
# Uncomment the admin/doc line below to enable admin documentation:
|
||||
# url(r'^admin/doc/', include('django.contrib.admindocs.urls')),
|
||||
|
||||
# Uncomment the next line to enable the admin:
|
||||
url(r'^admin/', include(admin.site.urls)),
|
||||
)
|
||||
|
||||
urlpatterns += staticfiles_urlpatterns()
|
Reference in New Issue
Block a user