From fc8cee82a095fb040e822b9034cc7c566b2a26a3 Mon Sep 17 00:00:00 2001 From: Tapasweni Pathak Date: Sun, 26 Nov 2017 09:44:58 +0530 Subject: [PATCH 1/3] list all chat sessions --- oshc/main/migrations/0002_video.py | 22 ++++++++++++++++++++++ oshc/main/models.py | 7 +++++++ oshc/main/templates/template.html | 12 ++++++++++++ oshc/main/views.py | 5 +++++ 4 files changed, 46 insertions(+) create mode 100644 oshc/main/migrations/0002_video.py create mode 100644 oshc/main/templates/template.html diff --git a/oshc/main/migrations/0002_video.py b/oshc/main/migrations/0002_video.py new file mode 100644 index 0000000..5110d63 --- /dev/null +++ b/oshc/main/migrations/0002_video.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.6 on 2017-11-26 04:14 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('main', '0001_initial'), + ] + + operations = [ + migrations.CreateModel( + name='video', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('link', models.URLField()), + ], + ), + ] diff --git a/oshc/main/models.py b/oshc/main/models.py index 6a7b78a..d4707c8 100644 --- a/oshc/main/models.py +++ b/oshc/main/models.py @@ -29,3 +29,10 @@ class Contest(models.Model): def __str__(self): return self.name + + +class video(models.Model): + link = models.URLField() + + def __unicode__(self): + return self.link diff --git a/oshc/main/templates/template.html b/oshc/main/templates/template.html new file mode 100644 index 0000000..9c72ab2 --- /dev/null +++ b/oshc/main/templates/template.html @@ -0,0 +1,12 @@ +

Open Source Contributors Chat Sessions

+{% if all_sessions %} + +{% else %} +

Not able to retrive sessions at the moment.

+{% endif %} diff --git a/oshc/main/views.py b/oshc/main/views.py index f1f2977..d403cfb 100644 --- a/oshc/main/views.py +++ b/oshc/main/views.py @@ -42,6 +42,11 @@ def submit_contest(request): return render(request, 'contest_submission.html') +def sessions(request): + all_sessions = video.objects.all() + return render_to_response('sessions.html', {'all_sessions' : all_sessions}) + + def handler404(request): response = render_to_response('404.html', {}, context_instance=RequestContext(request)) From 1120b65f967f0a5b71bd4643259b534a21cce597 Mon Sep 17 00:00:00 2001 From: Tapasweni Pathak Date: Sun, 26 Nov 2017 09:59:42 +0530 Subject: [PATCH 2/3] migration and fixes --- oshc/main/templates/{template.html => sessions.html} | 3 +++ oshc/main/views.py | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) rename oshc/main/templates/{template.html => sessions.html} (81%) diff --git a/oshc/main/templates/template.html b/oshc/main/templates/sessions.html similarity index 81% rename from oshc/main/templates/template.html rename to oshc/main/templates/sessions.html index 9c72ab2..bee0167 100644 --- a/oshc/main/templates/template.html +++ b/oshc/main/templates/sessions.html @@ -1,3 +1,5 @@ +{% extends 'base.html' %} {% load static %} +{% block content %}

Open Source Contributors Chat Sessions

{% if all_sessions %}