Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
6 changes: 6 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[flake8]
ignore =
# A continuation line is under-indented for a visual indentation.
E128

max-line-length=80

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

..and moving it to separate dotfile is perfect!

13 changes: 13 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
exclude: '^$'
fail_fast: true
repos:
- repo: https://github.com/pre-commit/mirrors-yapf

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This does not seem to be v. actively used and maintained, what do you think about enabling without mirror?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This does not seem to be v. actively used and maintained

I am curious how did you decide this?

I see https://github.com/pre-commit/mirrors-yapf is updated whenever yapf(https://github.com/google/yapf/releases) is updated as you can see here https://github.com/pre-commit/mirrors-yapf/releases

what do you think about enabling without mirror

@tapaswenipathak tapaswenipathak Jan 1, 2018

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This does not seem to be v. actively used and maintained

I am curious how did you decide this?

I see https://github.com/pre-commit/mirrors-yapf is updated whenever yapf(https://github.com/google/yapf/releases) is updated as you can see here https://github.com/pre-commit/mirrors-yapf/releases

Thanks for linking this, my observation was 👎 skipped over 53 releases. 👍

what do you think about enabling without mirror

We need to provide git repository to enable pre-commit hooks (Ref: http://pre-commit.com/#plugins)
o w/ the number of releases they had, don't need this.

So What you mean by without mirror?

☝️ what you understood, a fork of our own or code to enable a pre-commit hook.

sha: v0.20.0
hooks:
- id: yapf
- repo: https://github.com/pre-commit/pre-commit-hooks
sha: v1.1.1
hooks:
- id: check-yaml
- id: check-added-large-files
- id: flake8
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ before_script:
- cd oshc/
- python manage.py migrate --noinput
- python manage.py collectstatic --noinput
- git diff-tree --no-commit-id --name-only -r $REVISION | xargs pre-commit run --files

script:
- flake8 . --ignore=E128
- coverage run --source='main' manage.py test --verbosity 2

after_success:
Expand Down
59 changes: 36 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,48 +9,61 @@ We are trying to create a medium where people who want to start with contributin
[Website](http://opensourcehelpcommunity.herokuapp.com/) [WIP]

## Deployement details

After every commit

1. The `predev` branch on GitHub is automatically deployed to [opensourcehelpcommunity-predev.herokuapp.com](http://opensourcehelpcommunity-predev.herokuapp.com/).
2. The `develop` branch on github is automatically deployed to [opensourcehelpcommunity-dev.herokuapp.com](http://opensourcehelpcommunity-dev.herokuapp.com/).
3. The `master` branch is automatically deployed [to opensourcehelpcommunity.herokuapp.com](http://opensourcehelpcommunity.herokuapp.com/) .
1. The `develop` branch on github is automatically deployed to [opensourcehelpcommunity-dev.herokuapp.com](http://opensourcehelpcommunity-dev.herokuapp.com/).
1. The `master` branch is automatically deployed [to opensourcehelpcommunity.herokuapp.com](http://opensourcehelpcommunity.herokuapp.com/) .

This is using [Django(1.11)](https://www.djangoproject.com/) and [Bootstrap](http://getbootstrap.com/)

## How to Contribute
This is an Open Source project and we would be happy to see contributors who report bugs and file feature requests submitting pull requests as well. This project adheres to the Collaborative [code of conduct](https://github.com/OpenSourceHelpCommunity/OpenSourceHelpCommunity.github.io/blob/develop/CODE_OF_CONDUCT.md). By participating, you expect to maintain the code of conduct. Before creating `New issue` and `Pull request`, please refer to the [template](docs).

This is an Open Source project and we would be happy to see contributors who report bugs and file feature requests submitting pull requests as well. This project adheres to the Collaborative [code of conduct](https://github.com/OpenSourceHelpCommunity/OpenSourceHelpCommunity.github.io/blob/develop/CODE_OF_CONDUCT.md). By participating, you expect to maintain the code of conduct. Before creating `New issue` and `Pull request`, please refer to the [template](docs).

All the development is done on `predev` branch and once we're ready for testing the deployment in real environment with databases we merge the `predev` branch with the `develop` branch. When we're ready for new release we merge `develop` with `master` to deploy it on our main website. **Please submit your pull request based on `predev` branch.**

## Installations

Run
```

```bash
pip install -r requirements.txt
```
to install everything required to run this project on heroku as well as on your local.

to install everything required to run this project on heroku as well as on your local.

## To run this in your local

1. Clone this repository using
```
git clone git@github.com:OpenSourceHelpCommunity/OpenSourceHelpCommunity.github.io.git
```

2. Go inside main Django app [Instructional video on installing Django](https://youtu.be/qgGIqRFvFFk)
```
cd oshc
```

3. Collectstatic files using
```
python manage.py collectstatic
```

4. Run the app
```
python manage.py runserver
```

```bash
git clone git@github.com:OpenSourceHelpCommunity/OpenSourceHelpCommunity.github.io.git
```

1. Go inside main Django app [Instructional video on installing Django](https://youtu.be/qgGIqRFvFFk)

```bash
cd oshc
```

1. Install [pre-commit](pre-commit.com) into your git hooks. [pre-commit](pre-commit.com) will now run on every commit. Every time you clone a project that is using [pre-commit](pre-commit.com) running [pre-commit](pre-commit.com) install should always be the first thing you do after installing requirements.

@tapaswenipathak tapaswenipathak Jan 1, 2018

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in markdown it takes relative path if not put w/ the protocol, need a correction here.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh, I missed protocol in URL somehow during copy-paste or maybe my editor removed them.

It seems you fixed it after merging, thanks.


```bash
pre-commit install
```

1. Collectstatic files using

```bash
python manage.py collectstatic
```

1. Run the app
```bash

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for this cleanup! 🎉 I was planning to do this from quite a while but didn't.

python manage.py runserver
```

To run the web app in Debug mode set the DEBUG environment variable.
In Linux, run the `export DEBUG=True` command in the terminal.
Expand Down
3 changes: 2 additions & 1 deletion oshc/authentication/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
urlpatterns = [
url(r'^accounts/', include('allauth.urls')),
url(r'^accounts/login/profile/', views.profile, name="profile"),
url(r'^ajax/validate_username/$', views.validate_username,
url(r'^ajax/validate_username/$',
views.validate_username,
name='validate_username'),
]
1 change: 1 addition & 0 deletions oshc/main/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ def approve_contest(self, request, queryset):
else:
message_bit = "{} contests were".format(contest_approved)
self.message_user(request, "{} approved.".format(message_bit))

approve_contest.short_description = "Approve"


Expand Down
52 changes: 30 additions & 22 deletions oshc/main/migrations/0001_initial.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,42 +9,50 @@ class Migration(migrations.Migration):

initial = True

dependencies = [
]
dependencies = []

operations = [
migrations.CreateModel(
name='chatSession',
fields=[
('id', models.AutoField(auto_created=True,
primary_key=True,
serialize=False, verbose_name='ID')),
('title', models.CharField(help_text='Session title',
max_length=128)),
('profile_name', models.CharField(
help_text="The person's name", max_length=128)),
('profile_url', models.URLField(
help_text="The Url of the person's website")),
('description', models.TextField(
help_text='Session details', max_length=512)),
('id',
models.AutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name='ID')),
('title',
models.CharField(help_text='Session title', max_length=128)),
('profile_name',
models.CharField(
help_text="The person's name", max_length=128)),
('profile_url',
models.URLField(help_text="The Url of the person's website")),
('description',
models.TextField(help_text='Session details',
max_length=512)),
('start_date', models.DateTimeField()),
('end_date', models.DateTimeField()),
('register_url', models.URLField(
help_text='URL for the event registration')),
('register_url',
models.URLField(help_text='URL for the event registration')),
],
),
migrations.CreateModel(
name='Contest',
fields=[
('id', models.AutoField(auto_created=True,
primary_key=True,
serialize=False, verbose_name='ID')),
('name', models.CharField(help_text='Contest name',
max_length=128)),
('id',
models.AutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name='ID')),
('name',
models.CharField(help_text='Contest name', max_length=128)),
('link',
models.URLField(help_text="URL of the contest's website")),
('description', models.TextField(
help_text='Contest details', max_length=512, null=True)),
('description',
models.TextField(
help_text='Contest details', max_length=512, null=True)),
('start_date', models.DateField(null=True)),
('end_date', models.DateField(null=True)),
('approved', models.BooleanField(default=False)),
Expand Down
17 changes: 11 additions & 6 deletions oshc/main/migrations/0002_journey.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,17 @@ class Migration(migrations.Migration):
migrations.CreateModel(
name='Journey',
fields=[
('id', models.AutoField(auto_created=True,
primary_key=True, serialize=False, verbose_name='ID')),
('title', models.CharField(help_text='Journey title',
max_length=128)),
('description', models.TextField(help_text='Session details',
max_length=512)),
('id',
models.AutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name='ID')),
('title',
models.CharField(help_text='Journey title', max_length=128)),
('description',
models.TextField(help_text='Session details',
max_length=512)),
('start_date', models.DateTimeField()),
],
),
Expand Down
8 changes: 4 additions & 4 deletions oshc/main/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@

class chatSession(models.Model):
title = models.CharField(max_length=128, help_text="Session title")
profile_name = models.CharField(max_length=128,
help_text="The person's name")
profile_name = models.CharField(
max_length=128, help_text="The person's name")
profile_url = models.URLField(help_text="The Url of the person's website")
description = models.TextField(max_length=512, help_text="Session details")
start_date = models.DateTimeField()
Expand All @@ -21,8 +21,8 @@ def __str__(self):
class Contest(models.Model):
name = models.CharField(max_length=128, help_text="Contest name")
link = models.URLField(help_text="URL of the contest's website")
description = models.TextField(max_length=512,
help_text="Contest details", null=True)
description = models.TextField(
max_length=512, help_text="Contest details", null=True)
start_date = models.DateField(null=True)
end_date = models.DateField(null=True)
approved = models.BooleanField(default=False)
Expand Down
2 changes: 0 additions & 2 deletions oshc/main/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,12 @@


class HomeViewTests(TestCase):

def test_get_request(self):
response = self.client.get(reverse("home"))
self.assertEqual(response.status_code, 200)


class RequestSessionViewTests(SimpleTestCase):

def test_get_request(self):
response = self.client.get(reverse('request_session'))
self.assertEqual(response.status_code, 200)
9 changes: 5 additions & 4 deletions oshc/main/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,10 @@ def request_session(request):

def contests(request):
contest_list = Contest.objects.all()
return render(request, 'contests.html',
context={'contest_list': contest_list})
return render(
request, 'contests.html', context={
'contest_list': contest_list
})


def contest_new(request):
Expand All @@ -42,5 +44,4 @@ def submit_contest(request):

def journey(request):
journey_list = Journey.objects.order_by('start_date')
return render(request, 'journey.html',
context={'Journey': journey_list})
return render(request, 'journey.html', context={'Journey': journey_list})
35 changes: 18 additions & 17 deletions oshc/oshc/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,11 @@
ALLOWED_HOSTS = ['*']

# Tuple of people who get error notifications
ADMINS = [
('Tapasweni Pathak', 'tapaswenipathak@gmail.com'),
('Nikhita Raghunath', 'nikitaraghunath@gmail.com'),
('Ibrahim Jarif', 'jarifibrahim@gmail.com'),
('Amar Prakash Pandey', 'amar.om1994@gmail.com')
]
ADMINS = [('Tapasweni Pathak', 'tapaswenipathak@gmail.com'),
('Nikhita Raghunath', 'nikitaraghunath@gmail.com'),
('Ibrahim Jarif',
'jarifibrahim@gmail.com'), ('Amar Prakash Pandey',
'amar.om1994@gmail.com')]

# Application definition

Expand Down Expand Up @@ -95,20 +94,24 @@

AUTH_PASSWORD_VALIDATORS = [
{
'NAME': 'django.contrib.auth.password_validation.'
'UserAttributeSimilarityValidator',
'NAME':
'django.contrib.auth.password_validation.'
'UserAttributeSimilarityValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.'
'MinimumLengthValidator',
'NAME':
'django.contrib.auth.password_validation.'
'MinimumLengthValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.'
'CommonPasswordValidator',
'NAME':
'django.contrib.auth.password_validation.'
'CommonPasswordValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.'
'NumericPasswordValidator',
'NAME':
'django.contrib.auth.password_validation.'
'NumericPasswordValidator',
},
]

Expand Down Expand Up @@ -154,9 +157,7 @@
PROJECT_PATH = os.path.dirname(os.path.abspath(__file__))
STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles')

STATICFILES_DIRS = (
os.path.join(BASE_DIR, 'main/'),
)
STATICFILES_DIRS = (os.path.join(BASE_DIR, 'main/'), )

EMAIL_HOST = 'smtp.gmail.com'
EMAIL_HOST_USER = 'email'
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ whitenoise==3.3.1
django-allauth==0.33.0
django-crispy-forms==1.7.0
flake8==3.4.1
pre-commit==1.4.1