Skip to content

Commit

Permalink
user system
Browse files Browse the repository at this point in the history
  • Loading branch information
lionleaf committed Dec 30, 2015
1 parent 9432aba commit 422f4e5
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 7 deletions.
20 changes: 20 additions & 0 deletions dwitter/feed/templates/feed/feed.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
.dweet-feed {
width: 80%;
margin: 0 auto;
padding-top: 4em;
}
.dweet {
padding:40px;
Expand Down Expand Up @@ -53,10 +54,29 @@
height:100%;

}
.head-menu {
position:fixed;
width:100%;
z-index:100;
background:white;
}
.head-account-info {
padding:1em;
text-align:right;
}

</style>
</head>
<body>
<div class=head-menu>
<div class=head-account-info>
{% if request.user.is_authenticated %}
Logged in as {{ request.user.username }}. <a href="/accounts/logout"> Log out. </a>
{% else %}
<a href="/accounts/login"> Login </a>
{% endif %}
</div>
</div>
<div class=dweet-feed>
<div class=submit-box>
<form action="{% url 'dweet' %}" method="post">
Expand Down
3 changes: 2 additions & 1 deletion dwitter/feed/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@ def feed(request):
from django.contrib.auth.models import User
from django.utils import timezone

@login_required
def dweet(request):
d = Dweet(code = request.POST['code']
, author = User.objects.get(username='lionleaf')
, author = request.user
, posted = timezone.now() )
d.save()
return HttpResponseRedirect(reverse('feed'))
27 changes: 22 additions & 5 deletions dwitter/templates/base.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,23 @@
<title> {% block title %} {% endblock %} </title>
<html>
<head>
<title> {% block title %} {% endblock %} </title>
<style>
body{
background:#ddd;
}
#content {
padding-top:4em;
width: 80%;
margin: 0 auto;

<div id=content>
{% block content %}
{% endblock %}
</div>
}
</style>
</head>
<body>

<div id=content>
{% block content %}
{% endblock %}
</div>
</body>
</html>
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
django==1.9
django==1.8
django-registration-redux==1.2
flake8

0 comments on commit 422f4e5

Please sign in to comment.