-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Release #43
Release #43
Changes from 132 commits
c97fd06
d408bdb
9ec81af
4019065
f129bca
012d61a
872bae2
592e876
a428e00
1170e3a
5008307
159c3da
557f365
976a90d
3c9c37f
f1cbaf0
9791ee2
03f6ae7
57ad3e1
7011d20
57526e3
5dd6617
bf98a7d
c40521f
21e63e2
e04ce2f
b6b438a
698ace8
26485ab
31afbd4
999102d
1a9233e
1de7c3a
8df718a
6c72cfd
b89d81c
7c37868
c805777
43b079a
b1dceb0
08cae2b
7f93ef0
631f858
0051447
340bc07
93d719c
5521592
2601aa1
31a6f13
ed663fd
4476a25
2a9f06e
e0ed3ff
b6ec48a
9b13438
b0c2acb
f90ded2
513d238
c02e14c
402b50c
3315754
31f9419
c6e92de
e07af2a
9afc03a
5e3aba7
37ed959
e17dead
354b34a
d70948b
16ccc2a
c0acc06
242af30
10385f8
dfa1da8
bdc9b7b
d8c9144
2d6675b
c071225
d7d907e
ac3e024
3c5b303
5a22e0f
16ea637
7817dbc
34632f1
33df7ee
167fa33
c08ea60
480be67
74a8c30
d64e0e6
db90bbe
0a95345
13f7de6
544b36e
b6e0662
f8f401c
7491309
1ca9e9a
f391616
60c4f2c
6df5e70
21da54d
0a969ce
cce4866
4a41462
9da293f
ae7bd8c
05931f0
9e28d9e
3d46452
76afc02
31a326f
004698d
ebf6762
6d5ddb8
8ae4562
785f119
637fec2
3c0b630
8707638
64f2aec
a65292b
637b1f1
331bca2
5240c1a
0412b7a
506a18d
05b63a1
5b9c0de
5154e96
6c8de7e
a3e606b
2d6ad4d
a56e338
6693ad0
aa5118d
6e276e5
432cc41
c8773f5
4d4bb1b
6282d9c
5c11fa3
4ff1e74
b57b783
1431c2a
aa9c2c3
d0cece2
8056859
e9a62fe
fb0a310
3df87ad
95411c8
8c1cccf
e87a77f
d9ae1db
0d6e8b8
176ae28
8ac2047
5c6dbc8
4c6a9e9
1e36b0b
1af8da5
7d05270
d1705ca
1929bee
be44d11
946e748
e5d8614
56bbcc0
06e6568
ed66813
f876dbf
1582b6b
2e19d1c
e52b35c
f231eb7
1bf7fd2
07f11d6
c779ebb
d1f2911
96eadbf
1aa844c
4696a2f
4961bfc
fe31614
a77dde2
e0a53d9
147646a
f37e713
662c634
1f223ed
3547853
782666f
19669ab
6f542db
eb8173d
fdb422d
dcf5423
ab8ea49
2104997
dc2c512
84b9430
ba0d777
ecd72d4
89fc9b7
e4fcc2c
88edfdf
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,9 @@ | ||
from django.contrib import admin | ||
|
||
from .models import Timeline | ||
|
||
# Register your models here. | ||
|
||
# @admin.register(Timeline) | ||
# class TimelineAdmin(admin.ModelAdmin): | ||
# list_display = ('title', 'timing', 'description') |
This file was deleted.
This file was deleted.
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,13 @@ | ||
from django.contrib import admin | ||
|
||
from .models import Event, EventUpdate | ||
|
||
# Register your models here. | ||
|
||
@admin.register(Event) | ||
class EventAdmin(admin.ModelAdmin): | ||
list_display = ('types', 'title', 'timing', 'description', 'description1', 'url', 'image', 'is_visible' ) | ||
|
||
@admin.register(EventUpdate) | ||
class EventUpdateAdmin(admin.ModelAdmin): | ||
list_display = ('title', 'description', 'description1', 'description2', 'url', 'image', 'event') |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
# Generated by Django 2.2.4 on 2020-01-01 19:42 | ||
|
||
from django.db import migrations, models | ||
import django.db.models.deletion | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
initial = True | ||
|
||
dependencies = [ | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name='Event', | ||
fields=[ | ||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | ||
('types', models.CharField(choices=[('upcoming event', 'upcoming'), ('app update', 'app'), ('online competition', 'online'), ('past event', 'past')], max_length=100)), | ||
('priority', models.CharField(choices=[('large', 'large'), ('small', 'small')], max_length=50)), | ||
('title', models.CharField(max_length=40)), | ||
('timing', models.CharField(blank=True, max_length=50)), | ||
('description', models.CharField(blank=True, max_length=500)), | ||
('description1', models.CharField(blank=True, max_length=1000)), | ||
('url', models.URLField()), | ||
('image', models.ImageField(blank=True, upload_to='news')), | ||
('is_visible', models.BooleanField(default=True)), | ||
], | ||
options={ | ||
'db_table': 'events', | ||
}, | ||
), | ||
migrations.CreateModel( | ||
name='EventUpdate', | ||
fields=[ | ||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | ||
('title', models.CharField(max_length=40)), | ||
('timing', models.CharField(blank=True, default='', max_length=50)), | ||
('description', models.CharField(blank=True, max_length=500)), | ||
('description1', models.CharField(blank=True, max_length=500)), | ||
('description2', models.CharField(blank=True, max_length=500)), | ||
('description3', models.CharField(blank=True, max_length=500)), | ||
('url', models.URLField(blank=True)), | ||
('image', models.ImageField(blank=True, upload_to='news')), | ||
('event', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='news.Event')), | ||
], | ||
options={ | ||
'db_table': 'event updates', | ||
}, | ||
), | ||
] |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,55 @@ | ||
from django.db import models | ||
|
||
# Create your models here. | ||
|
||
TYPES = [ | ||
('upcoming event', 'upcoming'), | ||
('app update', 'app'), | ||
('online competition', 'online'), | ||
('past event', 'past') | ||
] | ||
|
||
PRIORITY = [ | ||
('large', 'large'), | ||
('small', 'small') | ||
] | ||
|
||
|
||
class Event(models.Model): | ||
"""Model representing details of upcoming event""" | ||
types = models.CharField(max_length=100, choices=TYPES) | ||
priority = models.CharField(max_length=50, choices=PRIORITY) | ||
title = models.CharField(max_length=40) | ||
timing = models.CharField(max_length=50, blank=True) | ||
description = models.CharField(max_length=500, blank=True) | ||
description1 = models.CharField(max_length=1000, blank=True) | ||
url = models.URLField(max_length=200) | ||
image = models.ImageField(upload_to='news', blank=True) | ||
is_visible = models.BooleanField(default=True) | ||
|
||
class Meta: | ||
app_label = 'news' | ||
db_table = 'events' | ||
|
||
def __str__(self): | ||
return self.title | ||
|
||
|
||
class EventUpdate(models.Model): | ||
"""Model representing event update""" | ||
title = models.CharField(max_length=40) | ||
timing = models.CharField(max_length=50, blank=True, default='') | ||
description = models.CharField(max_length=500, blank=True) | ||
description1 = models.CharField(max_length=500, blank=True) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Change names here too. |
||
description2 = models.CharField(max_length=500, blank=True) | ||
description3 = models.CharField(max_length=500, blank=True) | ||
url = models.URLField(max_length=200, blank=True) | ||
image = models.ImageField(upload_to='news', blank=True) | ||
event = models.ForeignKey(Event, on_delete=models.CASCADE) | ||
|
||
class Meta: | ||
app_label = 'news' | ||
db_table = 'event updates' | ||
|
||
def __str__(self): | ||
return self.title |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
from rest_framework import serializers | ||
|
||
from .models import Event, EventUpdate | ||
|
||
|
||
class EventSerializer(serializers.ModelSerializer): | ||
|
||
class Meta: | ||
model = Event | ||
fields = ('types', 'priority', 'title', 'timing', 'description', 'description1', 'url', 'image', 'is_visible' ) | ||
|
||
|
||
class EventUpdateSerializer(serializers.ModelSerializer): | ||
|
||
class Meta: | ||
model = EventUpdate | ||
fields = ('title', 'timing', 'description', 'description1', 'description2', 'description3', 'image', 'event') |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
from django.conf.urls import url | ||
|
||
from .import views | ||
|
||
|
||
urlpatterns = [ | ||
url(r'^$', views.get_events, name='get_events'), | ||
url(r'updates', views.get_event_updates, name='get_news_updates') | ||
] |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,59 @@ | ||
from django.shortcuts import render | ||
from rest_framework import permissions, status | ||
from rest_framework.decorators import ( | ||
api_view, | ||
permission_classes, | ||
throttle_classes, | ||
) | ||
from rest_framework.response import Response | ||
from rest_framework.throttling import AnonRateThrottle | ||
|
||
# Create your views here. | ||
from .models import Event, EventUpdate | ||
from .serializers import EventSerializer, EventUpdateSerializer | ||
|
||
|
||
@throttle_classes([ | ||
AnonRateThrottle, | ||
]) | ||
@api_view(['GET']) | ||
@permission_classes((permissions.AllowAny, )) | ||
def get_events(request): | ||
""" | ||
Get a list of events | ||
""" | ||
event_requested = request.query_params.get('title') | ||
if event_requested is not None: | ||
event = Event.objects.filter(title=event_requested, is_visible=True) | ||
event_update = EventUpdate.objects.filter(event=event[0]) | ||
event_serializer = EventSerializer(event, many=True, context={'request': request}) | ||
event_update_serializer = EventUpdateSerializer(event_update, many=True, context={'request': request}) | ||
response_data = {'event': event_serializer.data, 'event_update': event_update_serializer.data} | ||
return Response(response_data, status=status.HTTP_200_OK) | ||
else: | ||
event_array = [] | ||
events = Event.objects.filter(is_visible=True) | ||
for event in events: | ||
event_update = EventUpdate.objects.filter(event=event) | ||
event_serializer = EventSerializer( | ||
event, many=False, context={'request': request}) | ||
event_update_serializer = EventUpdateSerializer( | ||
event_update, many=True, context={'request': request} | ||
) | ||
response_data = {'event': event_serializer.data, 'event_update': event_update_serializer.data} | ||
event_array.append(response_data) | ||
return Response(event_array, status=status.HTTP_200_OK) | ||
|
||
|
||
@throttle_classes([ | ||
AnonRateThrottle, | ||
]) | ||
@api_view(['GET']) | ||
@permission_classes((permissions.AllowAny, )) | ||
def get_event_updates(request): | ||
""" | ||
Get a list of updates | ||
""" | ||
event_update = EventUpdate.objects.filter() | ||
serializer = EventUpdateSerializer( | ||
event_update, many=True, context={'request': request}) | ||
response_data = serializer.data | ||
return Response(response_data, status=status.HTTP_200_OK) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
from django.contrib import admin | ||
|
||
from .models import Timeline | ||
|
||
# Register your models here. | ||
|
||
@admin.register(Timeline) | ||
class TimelineAdmin(admin.ModelAdmin): | ||
list_display = ('title', 'timing', 'description') |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
from django.apps import AppConfig | ||
|
||
|
||
class TimelineConfig(AppConfig): | ||
name = 'timeline' |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# Generated by Django 2.2.4 on 2019-12-29 11:24 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
initial = True | ||
|
||
dependencies = [ | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name='Timeline', | ||
fields=[ | ||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | ||
('timing', models.CharField(max_length=50)), | ||
('title', models.CharField(max_length=40)), | ||
('description', models.CharField(max_length=500)), | ||
], | ||
options={ | ||
'db_table': 'timeline', | ||
}, | ||
), | ||
] |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Generated by Django 2.2.4 on 2019-12-29 12:42 | ||
|
||
from django.db import migrations | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('timeline', '0001_initial'), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterModelTable( | ||
name='timeline', | ||
table='timeline', | ||
), | ||
] |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
from django.db import models | ||
|
||
# Create your models here. | ||
|
||
class Timeline(models.Model): | ||
"""Model representing details of timeline""" | ||
timing = models.CharField(max_length=50) | ||
title = models.CharField(max_length=40) | ||
description = models.CharField(max_length=500) | ||
|
||
class Meta: | ||
app_label = 'timeline' | ||
db_table = 'timeline' | ||
|
||
def __str__(self): | ||
return self.title | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
from rest_framework import serializers | ||
|
||
from .models import Timeline | ||
|
||
|
||
class TimelineSerializer(serializers.ModelSerializer): | ||
|
||
class Meta: | ||
model = Timeline | ||
fields = ( 'timing', 'title', 'description' ) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
from rest_framework import permissions, status | ||
from rest_framework.decorators import ( | ||
api_view, | ||
permission_classes, | ||
throttle_classes, | ||
) | ||
from rest_framework.response import Response | ||
from rest_framework.throttling import AnonRateThrottle | ||
|
||
# Create your views here. | ||
from .models import Timeline | ||
from .serializers import TimelineSerializer | ||
|
||
|
||
@throttle_classes([ | ||
AnonRateThrottle, | ||
]) | ||
@api_view(['GET']) | ||
@permission_classes((permissions.AllowAny, )) | ||
def get_timeline(request): | ||
""" | ||
Get a list of timeline | ||
""" | ||
timeline = Timeline.objects.filter() | ||
serializer = TimelineSerializer( | ||
timeline, many=True, context={'request': request}) | ||
response_data = serializer.data | ||
return Response(response_data, status=status.HTTP_200_OK) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<VirtualHost *:80> | ||
# ProxyPreserveHost On | ||
# Servers to proxy the connection, or; | ||
# List of application servers: | ||
# Usage: | ||
# ProxyPass / http://[IP Addr.]:[port]/ | ||
# ProxyPassReverse / http://[IP Addr.]:[port]/ | ||
# Example: | ||
ProxyPass / http://127.0.0.1:8000/ | ||
ProxyPassReverse / http://127.0.0.1:8000/ | ||
ServerName portfolio-backend.sdslabs.co | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Don't we have a better name for this? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this was only for testing purpose |
||
</VirtualHost> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we have two descriptions. Atleast give them sensible names.