Skip to content

Instantly share code, notes, and snippets.

@sounak98
Last active March 31, 2019 17:40
Show Gist options
  • Save sounak98/bcccca304628d872aea4b86983b449b2 to your computer and use it in GitHub Desktop.
Save sounak98/bcccca304628d872aea4b86983b449b2 to your computer and use it in GitHub Desktop.
Proposal for Python-GSoC @ PSF, 2019

Python GSoC: Build a multi-user Blogging Platform

About Me

  1. Name: Sounak Pradhan
  2. Nickname: sounak98 (on irc, github, and most other platforms)
  3. Contact Info: sounak.98@gmail.com, +91-8900-697-914
  4. Timezone: India Standard Time (GMT +0530)
  5. Resume: Link

Code Contribution

I have been working on the project from middle of January and have substantial contribution in it by now. I have made a total of 12 pull requests out of which 11 have been merged till now. All of them can be found on this link. Some major ones are also listed below out of which the first two were priority issues.

  • #79 Permission setup for student blogs
  • #45 Extended the toolbar of ckeditor in djangocms-text-ckeditor to include plugins that embed YouTube videos and insert, drag and resize images
  • #32 Added a management command runcron for running scheduled tasks (like sending emails, irc messages, etc.)
  • #20 Added an IRC Bot which can PM commands to different other bots
  • #18 Added a filter which selects the migrations according to the set database, thus only applying the correct migrations to a database

Project Information

Sub-Org Name: Python-GSoC
Mentors: Botanic, dotgourav, Meflin, Warthog9

Project Abstract

Every year more than 100 students apply for GSoC under the umbrella organization PSF. Currently there is a multi-user blogging website using WordPress CMS hosted for the students to publish their weekly blogs and a static landing page for reaching out to people for more information about this program.

This project aims to build a platform which allows smooth management of the GSoC program at PSF every year and also ties everyone associated with it to PSF, so that their work or they themselves can help out others in future.

Project Goals

  • The admins should be able to add new Sub-Orgs and elect admins for each Sub-Org
  • The Sub-Org admins should be able to manage Sub-Org activities like approving a mentor and assigning them to a project, handling project requests and approving a project for the GSoC program
  • Mentors should be able to apply for mentorship, approve student proposals, review weekly reports and also handle evaluations
  • Students should be able to publish and edit their blogs, submit their proposals, weekly reports and evaluation reports
  • Static pages should be hosted for reaching out to interested mentors and students with various information about the application and the whole process
  • Reminders should be given to all users for upcoming deadlines for different tasks

Implementation

The plan is to build a Content Management System (CMS) which will allow students to write and publish their own blog posts. We plan on using django to build this app, which is a high-level Python framework. We are using django CMS for building the CMS, and for the blogging platform we are using a plugin on top of django CMS called aldryn-newsblog. Currently, the app uses SQLite for managing the database. Administration is managed by django CMS admin, and a minimal front-end is built using django templates and a lightweight CSS framework known as pure.css.

We are planning the development of this application with the timeline of the GSoC program for this year. In this way the GSoC students of this year working under the umbrella org PSF will be able to use it simultaneously while we are developing it. This will allow us to get active feedback from the students using it, helping us make the application more robust.

A user can have multiple UserProfiles. One UserProfile ties a user to a particular year’s PSF GSoC program and a Sub-Org. The different roles through which a user can be tied to a PSF GSoC are Sub-Org Admin, Mentor or Student. There will also be admins who have superuser access to the whole platform. According to the different roles, a user will have different tasks to perform. For example, a user who is tied to this year’s PSF GSoC as a student under the Sub-Org PSF GSoC Team will have to upload reports and write blogs in a timely fashion.

class UserProfile(models.Model):
    ROLES = (
        (0, 'Others'),
        (1, 'Suborg Admin'),
        (2, 'Mentor'),
        (3, 'Student')
    )

    user = models.ForeignKey(User, on_delete=models.CASCADE)
    role = models.IntegerField(name='role', choices=ROLES, default=0)
    gsoc_year = models.ForeignKey(GsocYear, on_delete=models.CASCADE, null=True, blank=False)
    suborg_full_name = models.ForeignKey(SubOrg, on_delete=models.CASCADE, null=True, blank=False)
    accepted_proposal_pdf = models.FileField(blank=True, null=True)

They will also be notified about upcoming deadlines for submission of reports and blogs. Sending these notifications through mails and IRC will be taken care by a Scheduler which will be used to schedule non-time sensitive or async tasks (ex: sending mails, irc messages, among other things). Along with the notifications being sent on mails and over IRC, users would also be notified on their profile page. This will be taken care of by the Notification model.

Aldryn-newsblog doesn’t have a lot of features that we would ideally need. For example, one of them is handling permissions for a multi-user blogging site. We are planning to implement these features by overriding the necessary functions like user_has_add_permission and populate.

def user_has_add_permission(self, user, **kwargs):
    """
    Return True if the current user has permission to add an article.
    :param user: The current user
    :param kwargs: Ignored here
    :return: True if user has add permission, else False
    """
def populate(self):
    """
    Populates the different buttons in the toolbar according
    to permissions
    """

Django provides base classes for writing unit tests and integration tests (ex: SimpleTestCase for writing unit tests which gives us options to isolate apps while performing tests, manages db setup, teardown and more). We will be using these classes for writing unit tests. We will also be using Selenium WebDriver for multi-browser intergration testing.

Timeline

  • Community Bonding Period

    • Finishing up the pending issues from the application period
    • Refactoring and cleaning up the code written by different applicants
  • Week 1 (May 27)

    • Creating the Notification model which will handle notifications for the users (ex: Reminders for submitting reports or writing blogs to students)
    • Creating a panel in the My Profile section which will display all the notifications according to their priorities
    • Creating a form for the admin to fill out different dates of the current GSoC program for sending out notifications to various users
  • Week 2 (Jun 3)

    • Adding comments and reactions to blogs using aldryn-disqus
    • Adding markdown support to CKEditor
    • Adding plugins to CKEditor for dragging and dropping images (currently only accepts URLs which is pretty inconvenient)
  • Week 3 (Jun 10)

    • Adding a page which lists all student blogs of the current GSoC with links to each of them
    • Creating an archive page which lists all blogs of the previous years
    • Moving the blogs to archive when the new GSoC program starts
    • Something more
  • Week 4 (Jun 17)

    • Creating a form for the student applicants where they can register themselves during/before the application period
    • Letting them upload their project ideas for mentors to review
    • Letting mentors approve/reject applicants and deleting the proposals of rejected applicants from the system and deactivating their user models
  • Week 5 (Jun 24)

    • Creating a report form where students can upload their reports for the current phase
    • Letting mentors view the reports and giving them an option to approve/reject the student for the next phase
  • Week 6 (Jul 1)

    • Creating a mentor application form where a mentor can apply for mentoring one of the available projects
    • Letting the Sub-Org admins approve/reject the mentor or directly add mentors, in which case they will be given registration links
  • Week 7 & 8 (Jul 8 & 15)

    • Building a clean and uniform UI for the whole site using pure.css, as the whole site will be built by now
    • Making proper styling classes for each type of element in the website and use them
  • Week 9 (Jul 22)

    • Writing unit-tests using django’s in-built testing platform to test all models, views and forms
    • Getting 100% code coverage
  • Week 10 (Jul 29)

    • Writing integration-tests using django’s StaticLiveServerTestCase base class and Selenium WebDriver
  • Week 11 (Aug 5)

    • Extending the Integration tests on multiple browsers
    • Performing Cross Browser Testing
    • Freezing the code
  • Week 12 (Aug 12)

    • Refactoring and cleaning up code
    • Fixing bugs
    • Updating documentation for using the application and also a styling guide for creating new landing pages
  • Final Week

    • Deployment Tasks
    • Maintenance
    • Submitting project

Apart from this, the plan also includes fixing bugs on a regular basis as and when they are posted by users and mentors.

Other Commitments

I have summer holidays in my university from May to July. So, I'll be able to devote most of my time to this project. Near the end of May, I'll be going home to meet my parents for a couple of week. That won't be a blocker by any means, but I'll probably be working a little less than usual in these two weeks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment