Skip to content

Commit c8ff23d

Browse files
List all sessions in allsessions page (#193)
* list all chat sessions * migration and fixes * aah migrations issues
1 parent f400a39 commit c8ff23d

File tree

9 files changed

+85
-46
lines changed

9 files changed

+85
-46
lines changed

Diff for: .DS_Store

6 KB
Binary file not shown.

Diff for: oshc/main/admin.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88

99
class chatSessionAdmin(admin.ModelAdmin):
10-
list_display = ('title', 'start_date')
10+
list_display = ('name', 'start_date')
1111

1212

1313
class journeyAdmin(admin.ModelAdmin):

Diff for: oshc/main/migrations/0001_initial.py

+22-32
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# -*- coding: utf-8 -*-
2-
# Generated by Django 1.11.2 on 2017-10-09 13:36
2+
# Generated by Django 1.11.6 on 2017-11-26 12:05
33
from __future__ import unicode_literals
44

55
from django.db import migrations, models
@@ -15,44 +15,34 @@ class Migration(migrations.Migration):
1515
migrations.CreateModel(
1616
name='chatSession',
1717
fields=[
18-
('id',
19-
models.AutoField(
20-
auto_created=True,
21-
primary_key=True,
22-
serialize=False,
23-
verbose_name='ID')),
24-
('title',
25-
models.CharField(help_text='Session title', max_length=128)),
26-
('profile_name',
27-
models.CharField(
28-
help_text="The person's name", max_length=128)),
29-
('profile_url',
30-
models.URLField(help_text="The Url of the person's website")),
31-
('description',
32-
models.TextField(help_text='Session details',
33-
max_length=512)),
18+
19+
('id', models.AutoField(auto_created=True, primary_key=True,
20+
serialize=False, verbose_name='ID')),
21+
('name', models.CharField(help_text='Session title',
22+
max_length=128)),
23+
('profile_name', models.CharField(help_text="The person's name",
24+
max_length=128)),
25+
('profile_url', models.URLField(help_text="The Url of the " +
26+
"person's website")),
27+
('description', models.TextField(help_text='Session details',
28+
max_length=512)),
3429
('start_date', models.DateTimeField()),
3530
('end_date', models.DateTimeField()),
36-
('register_url',
37-
models.URLField(help_text='URL for the event registration')),
31+
('link', models.URLField(help_text='Chat session URL')),
3832
],
3933
),
4034
migrations.CreateModel(
4135
name='Contest',
4236
fields=[
43-
('id',
44-
models.AutoField(
45-
auto_created=True,
46-
primary_key=True,
47-
serialize=False,
48-
verbose_name='ID')),
49-
('name',
50-
models.CharField(help_text='Contest name', max_length=128)),
51-
('link',
52-
models.URLField(help_text="URL of the contest's website")),
53-
('description',
54-
models.TextField(
55-
help_text='Contest details', max_length=512, null=True)),
37+
38+
('id', models.AutoField(auto_created=True, primary_key=True,
39+
serialize=False, verbose_name='ID')),
40+
('name', models.CharField(help_text='Contest name',
41+
max_length=128)),
42+
('link', models.URLField(help_text="URL of the contest's " +
43+
"website")),
44+
('description', models.TextField(help_text='Contest details',
45+
max_length=512, null=True)),
5646
('start_date', models.DateField(null=True)),
5747
('end_date', models.DateField(null=True)),
5848
('approved', models.BooleanField(default=False)),

Diff for: oshc/main/models.py

+7-5
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,19 @@
55

66

77
class chatSession(models.Model):
8-
title = models.CharField(max_length=128, help_text="Session title")
9-
profile_name = models.CharField(
10-
max_length=128, help_text="The person's name")
8+
<<<<<<< issue1
9+
name = models.CharField(max_length=128, help_text="Session title")
10+
link = models.URLField(help_text="Chat session URL")
11+
profile_name = models.CharField(max_length=128,
12+
help_text="The person's name")
1113
profile_url = models.URLField(help_text="The Url of the person's website")
1214
description = models.TextField(max_length=512, help_text="Session details")
1315
start_date = models.DateTimeField()
1416
end_date = models.DateTimeField()
15-
register_url = models.URLField(help_text="URL for the event registration")
17+
link = models.URLField(help_text="Chat session URL")
1618

1719
def __str__(self):
18-
return self.title
20+
return self.name
1921

2022

2123
class Contest(models.Model):

Diff for: oshc/main/templates/base.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@
2828
<li class="dropdown">
2929
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Sessions <span class="caret"></span></a>
3030
<ul class="dropdown-menu" role="menu">
31-
<li><a href="https://www.youtube.com/channel/UC1_IAby-9me3iICtxuiDL5Q/videos" target="_blank">View Session</a></li>
32-
<li><a href="{% url 'request_session' %}">Request a Session</a></li>
31+
<li><a href="{% url 'chat_sessions' %}" target="_blank">View Session</a></li>
32+
<li><a href="{% url 'request_session' %}" target="_blank">Request a Session</a></li>
3333
</ul>
3434
</li>
3535
<li><a href="https://github.com/OpenSourceHelpCommunity" target="_blank">Resources</a></li>

Diff for: oshc/main/templates/chatsessions.html

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
{% extends 'base.html' %}
2+
{% load static %}
3+
{% block content %}
4+
<style>
5+
h3 {
6+
text-align: center;
7+
}
8+
span
9+
{
10+
display: block;
11+
}
12+
</style>
13+
<section class="main-section">
14+
<div class="container">
15+
<h3>Open Source Contributors Chat Sessions</h3>
16+
<div class="container-fluid">
17+
<div class="row">
18+
{% for chat_session in chat_session_list %}
19+
{% if chat_session.approved %}
20+
<div class="col-lg-4">
21+
<div class="panel panel-default">
22+
<div class="panel-heading" style="background-color: #0275d8;color:white">{{chat_session.name}}</div>
23+
<div class="panel-body">
24+
<span><i class="fa fa-youtube"></i> <a href="{{chat_session.link}}">{{chat_session.link}}</a></span>
25+
<span><i class="fa fa-clock-o"></i> {{chat_session.start_date}}</span>
26+
<span><i class="fa fa-info-circle"></i> {{chat_session.description}}</span>
27+
</div>
28+
</div>
29+
</div>
30+
{% endif %}
31+
{% endfor %}
32+
</div>
33+
</div>
34+
</div>
35+
</section>
36+
{% endblock %}

Diff for: oshc/main/urls.py

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
url(r'^contest_new/', views.contest_new, name="contest_new"),
99
url(r'^add_contest/', views.add_contest, name="add_contest"),
1010
url(r'^submit_contest/', views.submit_contest, name="submit_contest"),
11+
url(r'^chatsessions/', views.chat_sessions, name="chat_sessions"),
1112
url(r'^journey/', views.journey, name="journey"),
1213
url(r'^jobs/', views.jobs, name="jobs"),
1314
]

Diff for: oshc/main/views.py

+15-5
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55

66

77
def home(request):
8-
session_list = chatSession.objects.order_by('start_date')[:3]
9-
context_dict = {'chatSession': session_list}
10-
return render(request, 'index.html', context=context_dict)
8+
# chat_session_list = chatSessions.objects.order_by('start_date')[:3]
9+
# context_dict = {'chatSessions': chat_session_list}
10+
return render(request, 'index.html')
1111

1212

1313
def request_session(request):
@@ -41,11 +41,21 @@ def add_contest(request):
4141
def submit_contest(request):
4242
return render(request, 'contest_submission.html')
4343

44+
def chat_sessions(request):
45+
chat_session_list = chatSession.objects.all()
46+
return render(request, 'chatsessions.html',
47+
context={'chat_session_list': chat_session_list})
48+
49+
50+
def handler404(request):
51+
response = render_to_response('404.html', {},
52+
context_instance=RequestContext(request))
53+
response.status_code = 404
54+
return response
4455

4556
def journey(request):
4657
journey_list = Journey.objects.order_by('start_date')
4758
return render(request, 'journey.html', context={'Journey': journey_list})
48-
49-
59+
5060
def jobs(request):
5161
return render(request, 'jobs.html')

Diff for: oshc/oshc/settings.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
SECRET_KEY = 'x1-pogt0-b5owbgq0=ui02-4v)bba!bg&1m8_$)8-&13(907qf'
2222

2323
# SECURITY WARNING: don't run with debug turned on in production!
24-
DEBUG = os.getenv("DEBUG", False)
24+
DEBUG = os.getenv("DEBUG", True)
2525

2626
ALLOWED_HOSTS = ['*']
2727

0 commit comments

Comments
 (0)