Skip to content
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

community/: Add web-page displaying mentors #293

Open
wants to merge 28 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
de15cb2
Sync Moban
KVGarg Aug 4, 2019
6e9765d
data/: Update Contributor model
KVGarg Jun 8, 2019
c6afccd
.coafile: Ignore openhub module
KVGarg Jun 10, 2019
ab5e860
tests/: Remove dependency of testusers'
Jun 25, 2019
dc36c9f
travis.yml: Install Python v3.6.3
KVGarg Jul 30, 2019
c81d98c
git.py: CI build pass
KVGarg Feb 11, 2019
7f2877a
Enhance the community website homepage
KVGarg Jun 7, 2019
8323939
ci_build/: Re-design build-logs webpage
KVGarg Jun 9, 2019
6bc955e
gci/: Redesign gci students web-page
KVGarg Jun 12, 2019
0746873
data/: Re-design the contributors webpage
KVGarg Jun 13, 2019
c2f5c96
meta-review/: Redesign the webpage
KVGarg Jun 14, 2019
686c2d3
gamification/: Redesign the webpage
KVGarg Jun 14, 2019
5158608
Add netlify-OAuth
KVGarg Jul 11, 2019
41c5e35
community/: Add a joining netlify form
KVGarg Jul 20, 2019
a012693
community/: Display contributor statistics
KVGarg Jul 28, 2019
e05a821
community/: Add a form for uploading google forms
KVGarg Jul 31, 2019
7274277
community/: Add a form for adding calendar events
KVGarg Jul 31, 2019
e94bc5c
community/: Add a form for applying as a mentor
KVGarg Jul 31, 2019
6048e0e
community/: Add a form for adding a gsoc student
KVGarg Jul 31, 2019
e9dd16a
community/: Add a request form to assign issue
KVGarg Aug 1, 2019
7714d9e
community/: Add a newcomer promotion request form
KVGarg Aug 1, 2019
bfbc9c1
community/: Add a feedback form
KVGarg Aug 1, 2019
577b609
Remove openhub and model apps
Jun 28, 2019
8daed65
openhub/: Use openhub_django pypi package
Jun 28, 2019
6fe3e7f
community/: Display org teams
KVGarg Aug 2, 2019
9922faf
community/: Add a webpage for Listing Issues
KVGarg Aug 2, 2019
2f9864f
Display more info. about unassigned issues
KVGarg Aug 2, 2019
ca293fc
community/: Add web-page displaying mentors
KVGarg Aug 2, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
openhub/: Use openhub_django pypi package
Overriding the default openhub_django URLs
so as to define new ones and pass the
header and footer context of webpages and
make openhub_django templates look similar
to that of commuity website.

Closes #285
kvgarg authored and KVGarg committed Aug 6, 2019
commit 8daed650b0097abb790f84ab2d5cc100f066a609
2 changes: 2 additions & 0 deletions .ci/build.sh
Original file line number Diff line number Diff line change
@@ -44,6 +44,8 @@ fi

# Run meta review system
python manage.py run_meta_review_system
# Run openhub system
python manage.py import_openhub_data

rm _site/$ISSUES_JSON

2 changes: 1 addition & 1 deletion .coafile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[all]
files = **.py, **.js, **.sh
ignore = .git/**, **/__pycache__/**, gci/client.py, */migrations/**, private/*, openhub/**, **/leaflet_dist/**
ignore = .git/**, **/__pycache__/**, gci/client.py, */migrations/**, private/*, **/leaflet_dist/**
max_line_length = 80
use_spaces = True
preferred_quotation = '
2 changes: 1 addition & 1 deletion .moban.yaml
Original file line number Diff line number Diff line change
@@ -11,7 +11,6 @@ packages:
- gamification
- ci_build
- meta_review
- model
- unassigned_issues

dependencies:
@@ -24,6 +23,7 @@ dependencies:
- git+https://gitlab.com/gitmate/open-source/IGitt.git@1fa5a0a21ea4fb8739d467c06972f748717adbdc
- requests
- git+https://github.com/andrewda/trav.git@ce805d12d3d1db0a51b1aa26bba9cd9ecc0d96b8
- openhub-django~=0.1.0
- python-dateutil
- pillow
- ruamel.yaml
1 change: 0 additions & 1 deletion .nocover.yaml
Original file line number Diff line number Diff line change
@@ -10,7 +10,6 @@ nocover_file_globs:
- gsoc/*.py
- ci_build/*.py
- meta_review/handler.py
- openhub/*.py
# Optional coverage. Once off scripts.
- inactive_issues/inactive_issues_scraper.py
- unassigned_issues/unassigned_issues_scraper.py
15 changes: 13 additions & 2 deletions community/settings.py
Original file line number Diff line number Diff line change
@@ -13,12 +13,24 @@
import os
import sys

from community.git import get_api_key, get_org_name
from community.config import TokenMissing

from .filters import NoDebugFilter

# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))


# Set Environment variables needed by OpenHub-Django package
try:
OH_TOKEN = get_api_key('OH')
except TokenMissing:
os.environ['OH_TOKEN'] = ''

ORG_NAME = get_org_name()
os.environ['ORG_NAME'] = ORG_NAME

# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/1.11/howto/deployment/checklist/

@@ -37,8 +49,7 @@
'gci',
'gsoc',
'data',
'openhub',
'model',
'openhub_django.apps.OpenhubDjangoConfig',
'gamification',
'meta_review',
'django.contrib.contenttypes',
122 changes: 3 additions & 119 deletions community/urls.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
"""
Community URL configuration.
"""

from django.conf.urls import url
from django.urls import include
from django_distill import distill_url
from django.conf.urls.static import static
from django.conf import settings
@@ -14,27 +15,6 @@
from gamification.views import GamificationResults
from meta_review.views import ContributorsMetaReview
from inactive_issues.inactive_issues_scraper import inactive_issues_json
from openhub.views import index as openhub_index
from model.views import index as model_index
from openhub.models import (
PortfolioProject,
OutsideCommitter,
AffiliatedCommitter,
OutsideProject,
Organization,
)
from model.views import (
PortfolioProjectListView,
PortfolioProjectDetailView,
AffiliatedCommitterListView,
AffiliatedCommitterDetailView,
OrganizationListView,
OrganizationDetailView,
OutsideProjectListView,
OutsideProjectDetailView,
OutsideCommitterListView,
OutsideCommitterDetailView,
)
from unassigned_issues.unassigned_issues_scraper import (
unassigned_issues_activity_json,
)
@@ -46,31 +26,6 @@ def get_index():
return None


def get_all_portfolioprojects():
for portfolioproject in PortfolioProject.objects.all():
yield {'pk': portfolioproject.id}


def get_all_outsidecommitters():
for outsidecommitter in OutsideCommitter.objects.all():
yield {'pk': outsidecommitter.id}


def get_all_outsideprojects():
for outsideproject in OutsideProject.objects.all():
yield {'pk': outsideproject.id}


def get_all_affiliatedcommitters():
for affiliatedcommitter in AffiliatedCommitter.objects.all():
yield {'pk': affiliatedcommitter.id}


def get_organization():
for organization in Organization.objects.all():
yield {'pk': organization.id}


urlpatterns = [
distill_url(
r'^$', HomePageView.as_view(),
@@ -120,78 +75,6 @@ def get_organization():
distill_func=get_index,
distill_file='static/inactive-issues.json',
),
distill_url(
r'openhub/$', openhub_index,
name='community-openhub',
distill_func=get_index,
distill_file='openhub/index.html',
),
distill_url(
r'model/$', model_index,
name='community-model',
distill_func=get_index,
distill_file='model/index.html',
),
distill_url(
r'model/openhub/outside_committers/$',
OutsideCommitterListView.as_view(),
name='outsidecommitters',
distill_func=get_index,
),
distill_url(
r'model/openhub/outside_committer/(?P<pk>\d+)/$',
OutsideCommitterDetailView.as_view(),
name='outsidecommitter-detail',
distill_func=get_all_outsidecommitters,
),
distill_url(
r'model/openhub/outside_projects/$',
OutsideProjectListView.as_view(),
name='outsideprojects',
distill_func=get_index,
),
distill_url(
r'model/openhub/outside_project/(?P<pk>\d+)/$',
OutsideProjectDetailView.as_view(),
name='outsideproject-detail',
distill_func=get_all_outsideprojects,
),
distill_url(
r'model/openhub/affiliated_committers/$',
AffiliatedCommitterListView.as_view(),
name='affiliatedcommitters',
distill_func=get_index,
),
distill_url(
r'model/openhub/affiliated_committer/(?P<pk>\d+)/$',
AffiliatedCommitterDetailView.as_view(),
name='affiliatedcommitter-detail',
distill_func=get_all_affiliatedcommitters,
),
distill_url(
r'model/openhub/portfolio_projects/$',
PortfolioProjectListView.as_view(),
name='portfolioprojects',
distill_func=get_index,
),
distill_url(
r'model/openhub/portfolio_project/(?P<pk>\d+)/$',
PortfolioProjectDetailView.as_view(),
name='portfolioproject-detail',
distill_func=get_all_portfolioprojects,
),
distill_url(
r'model/openhub/organization/$',
OrganizationListView.as_view(),
name='organization',
distill_func=get_index,
),
distill_url(
r'model/openhub/org/(?P<pk>\d+)/$',
OrganizationDetailView.as_view(),
name='org-detail',
distill_func=get_organization,
),
distill_url(
r'static/unassigned-issues.json', unassigned_issues_activity_json,
name='unassigned_issues_activity_json',
@@ -204,4 +87,5 @@ def get_organization():
distill_func=get_index,
distill_file='gamification/index.html',
),
url(r'openhub/', include('openhub.urls'))
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
126 changes: 126 additions & 0 deletions openhub/urls.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
"""
OpenHub-Django URL configuration.
"""

from django_distill import distill_url

from openhub_django.models import (
PortfolioProject,
OutsideCommitter,
AffiliatedCommitter,
OutsideProject,
Organization,
)
from .views import (
Homepage,
PortfolioProjectListView,
PortfolioProjectDetailView,
AffiliatedCommitterListView,
AffiliatedCommitterDetailView,
OrganizationListView,
OrganizationDetailView,
OutsideProjectListView,
OutsideProjectDetailView,
OutsideCommitterListView,
OutsideCommitterDetailView,
)


def get_index():
# The index URI regex, ^$, contains no parameters, named or otherwise.
# You can simply just return nothing here.
return None


def get_all_portfolioprojects():
for portfolioproject in PortfolioProject.objects.all():
yield {'pk': portfolioproject.id}


def get_all_outsidecommitters():
for outsidecommitter in OutsideCommitter.objects.all():
yield {'pk': outsidecommitter.id}


def get_all_outsideprojects():
for outsideproject in OutsideProject.objects.all():
yield {'pk': outsideproject.id}


def get_all_affiliatedcommitters():
for affiliatedcommitter in AffiliatedCommitter.objects.all():
yield {'pk': affiliatedcommitter.id}


def get_organization():
for organization in Organization.objects.all():
yield {'pk': organization.id}


urlpatterns = [
distill_url(
r'^$', Homepage.as_view(),
name='community-openhub',
distill_func=get_index,
),
distill_url(
r'outside_committers/$',
OutsideCommitterListView.as_view(),
name='outsidecommitters',
distill_func=get_index,
),
distill_url(
r'outside_committer/(?P<pk>\d+)/$',
OutsideCommitterDetailView.as_view(),
name='outsidecommitter-detail',
distill_func=get_all_outsidecommitters,
),
distill_url(
r'outside_projects/$',
OutsideProjectListView.as_view(),
name='outsideprojects',
distill_func=get_index,
),
distill_url(
r'outside_project/(?P<pk>\d+)/$',
OutsideProjectDetailView.as_view(),
name='outsideproject-detail',
distill_func=get_all_outsideprojects,
),
distill_url(
r'affiliated_committers/$',
AffiliatedCommitterListView.as_view(),
name='affiliatedcommitters',
distill_func=get_index,
),
distill_url(
r'affiliated_committer/(?P<pk>\d+)/$',
AffiliatedCommitterDetailView.as_view(),
name='affiliatedcommitter-detail',
distill_func=get_all_affiliatedcommitters,
),
distill_url(
r'portfolio_projects/$',
PortfolioProjectListView.as_view(),
name='portfolioprojects',
distill_func=get_index,
),
distill_url(
r'portfolio_project/(?P<pk>\d+)/$',
PortfolioProjectDetailView.as_view(),
name='portfolioproject-detail',
distill_func=get_all_portfolioprojects,
),
distill_url(
r'organization/$',
OrganizationListView.as_view(),
name='organization',
distill_func=get_index,
),
distill_url(
r'org/(?P<pk>\d+)/$',
OrganizationDetailView.as_view(),
name='org-detail',
distill_func=get_organization,
),
]
129 changes: 129 additions & 0 deletions openhub/views.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
from django.views import generic

from community.views import get_header_and_footer
from openhub_django.models import (
PortfolioProject,
OutsideProject,
OutsideCommitter,
AffiliatedCommitter,
Organization,
)


class Homepage(generic.TemplateView):
template_name = 'openhub_django/index.html'

def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
context = get_header_and_footer(context)
context['portfolioprojects'] = 'portfolio_projects'
context['outsidecommitters'] = 'outside_committers'
context['affiliatedcommitters'] = 'affiliated_committers'
context['outsideprojects'] = 'outside_projects'
context['organization'] = 'organization'
return context


class PortfolioProjectListView(generic.ListView):
model = PortfolioProject
context_object_name = 'portfolio_project_list'
template_name = 'openhub_django/portfolioproject_list.html'

def get_context_data(self, *, object_list=None, **kwargs):
context = super().get_context_data(**kwargs)
context = get_header_and_footer(context)
return context


class PortfolioProjectDetailView(generic.DetailView):
model = PortfolioProject
template_name = 'openhub_django/portfolioproject_detail.html'

def get_context_data(self, *, object_list=None, **kwargs):
context = super().get_context_data(**kwargs)
context = get_header_and_footer(context)
return context


class OutsideProjectListView(generic.ListView):
model = OutsideProject
context_object_name = 'outside_project_list'
template_name = 'openhub_django/outsideproject_list.html'

def get_context_data(self, *, object_list=None, **kwargs):
context = super().get_context_data(**kwargs)
context = get_header_and_footer(context)
return context


class OutsideProjectDetailView(generic.DetailView):
model = OutsideProject
template_name = 'openhub_django/outsideproject_detail.html'

def get_context_data(self, *, object_list=None, **kwargs):
context = super().get_context_data(**kwargs)
context = get_header_and_footer(context)
return context


class OutsideCommitterListView(generic.ListView):
model = OutsideCommitter
context_object_name = 'outside_committer_list'
template_name = 'openhub_django/outsidecommitter_list.html'

def get_context_data(self, *, object_list=None, **kwargs):
context = super().get_context_data(**kwargs)
context = get_header_and_footer(context)
return context


class OutsideCommitterDetailView(generic.DetailView):
model = OutsideCommitter
template_name = 'openhub_django/outsidecommitter_detail.html'

def get_context_data(self, *, object_list=None, **kwargs):
context = super().get_context_data(**kwargs)
context = get_header_and_footer(context)
return context


class AffiliatedCommitterListView(generic.ListView):
model = AffiliatedCommitter
context_object_name = 'affiliated_committer_list'
template_name = 'openhub_django/affiliatedcommitter_list.html'

def get_context_data(self, *, object_list=None, **kwargs):
context = super().get_context_data(**kwargs)
context = get_header_and_footer(context)
return context


class AffiliatedCommitterDetailView(generic.DetailView):
model = AffiliatedCommitter
template_name = 'openhub_django/affiliatedcommitter_detail.html'

def get_context_data(self, *, object_list=None, **kwargs):
context = super().get_context_data(**kwargs)
context = get_header_and_footer(context)
return context


class OrganizationListView(generic.ListView):
model = Organization
context_object_name = 'organization_list'
template_name = 'openhub_django/organization_list.html'

def get_context_data(self, *, object_list=None, **kwargs):
context = super().get_context_data(**kwargs)
context = get_header_and_footer(context)
return context


class OrganizationDetailView(generic.DetailView):
model = Organization
template_name = 'openhub_django/organization_detail.html'

def get_context_data(self, *, object_list=None, **kwargs):
context = super().get_context_data(**kwargs)
context = get_header_and_footer(context)
return context
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -7,6 +7,7 @@ django-eventtools
git+https://gitlab.com/gitmate/open-source/IGitt.git@1fa5a0a21ea4fb8739d467c06972f748717adbdc
requests
git+https://github.com/andrewda/trav.git@ce805d12d3d1db0a51b1aa26bba9cd9ecc0d96b8
openhub-django~=0.1.0
python-dateutil
pillow
ruamel.yaml
3 changes: 0 additions & 3 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -16,7 +16,6 @@ testpaths =
gamification
ci_build
meta_review
model
unassigned_issues

python_files = test_*.py
@@ -71,7 +70,6 @@ source =
gamification
ci_build
meta_review
model
unassigned_issues

omit =
@@ -82,7 +80,6 @@ omit =
gsoc/*.py
ci_build/*.py
meta_review/handler.py
openhub/*.py
inactive_issues/inactive_issues_scraper.py
unassigned_issues/unassigned_issues_scraper.py
*/migrations/*.py
1 change: 0 additions & 1 deletion templates/base.html
Original file line number Diff line number Diff line change
@@ -86,7 +86,6 @@

<ul id="openhub-dropdown" class="dropdown-content">
<li><a href="{% url 'community-openhub' %}">Org. Portfolio Projects</a></li>
<li><a href="{% url 'community-model' %}">Imported data</a></li>
</ul>

<ul id="forms-dropdown" class="dropdown-content">