Skip to content

Commit b9fc74c

Browse files
committed
new updates
0 parents  commit b9fc74c

File tree

1,514 files changed

+311453
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,514 files changed

+311453
-0
lines changed

.gitignore

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
*.pyc
2+
*.pyo
3+
*.db
4+
.DS_Store
5+
.coverage
6+
local_settings.py
7+
/static
8+
secrets.py
9+
10+
11+
12+
# Environments
13+
.env
14+
.venv
15+
env/
16+
venv/
17+
ENV/
18+
env.bak/
19+
venv.bak/

CONTRIBUTING.md

+133
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
# Contributing
2+
3+
When contributing to this repository, please first discuss the change you wish to make via issue,
4+
email, or any other method with the owners of this repository before making a change.
5+
6+
Please note we have a code of conduct, please follow it in all your interactions with the project.
7+
8+
## Before creating a Merge Request
9+
10+
1. Make sure you have the most up to date code
11+
12+
If you haven't done so, please set upstream as described in [Gitlab Documentation](https://docs.gitlab.com/ce/workflow/forking_workflow.html)
13+
14+
Make sure you do not have any uncommitted changes and rebase master with latest changes from upstream:
15+
16+
```
17+
git fetch upstream
18+
git checkout master
19+
git rebase upstream/master
20+
```
21+
22+
Now you should rebase your branch with master, to receive the upstream changes
23+
24+
```
25+
git checkout branch
26+
git rebase master
27+
```
28+
29+
30+
In both cases, you can have conflicts:
31+
32+
```
33+
error: could not apply fa39187... something to add to patch A
34+
35+
When you have resolved this problem, run "git rebase --continue".
36+
If you prefer to skip this patch, run "git rebase --skip" instead.
37+
To check out the original branch and stop rebasing, run "git rebase --abort".
38+
Could not apply fa39187f3c3dfd2ab5faa38ac01cf3de7ce2e841... Change fake file
39+
```
40+
41+
Here, Git is telling you which commit is causing the conflict (fa39187). You're given three choices:
42+
43+
* You can run `git rebase --abort` to completely undo the rebase. Git will return you to your branch's state as it was before git rebase was called.
44+
* You can run `git rebase --skip` to completely skip the commit. That means that none of the changes introduced by the problematic commit will be included. It is very rare that you would choose this option.
45+
* You can fix the conflict.
46+
47+
To fix the conflict, you can follow [the standard procedures for resolving merge conflicts from the command line](https://help.github.com/articles/resolving-a-merge-conflict-from-the-command-line). When you're finished, you'll need to call `git rebase --continue` in order for Git to continue processing the rest of the rebase.
48+
## Merge Request Process
49+
50+
1. Ensure any install or build dependencies are removed before the end of the layer when doing a
51+
build.
52+
2. Update the [README.md](./README.md) with details of changes to the interface, this includes new environment
53+
variables, exposed ports, useful file locations and container parameters.
54+
3. Increase the version numbers in any examples files and the [README.md](./README.md) to the new version that this
55+
Merge Request would represent.
56+
4. You may merge the Merge Request in once you have the sign-off of two other developers, or if you
57+
do not have permission to do that, you may request the second reviewer to merge it for you.
58+
59+
## Code of Conduct
60+
61+
### Our Pledge
62+
63+
In the interest of fostering an open and welcoming environment, we as
64+
contributors and maintainers pledge to making participation in our project and
65+
our community a harassment-free experience for everyone, regardless of age, body
66+
size, disability, ethnicity, gender identity and expression, level of experience,
67+
nationality, personal appearance, race, religion, or sexual identity and
68+
orientation.
69+
70+
### Our Standards
71+
72+
Examples of behavior that contributes to creating a positive environment
73+
include:
74+
75+
* Using welcoming and inclusive language
76+
* Being respectful of differing viewpoints and experiences
77+
* Gracefully accepting constructive criticism
78+
* Focusing on what is best for the community
79+
* Showing empathy towards other community members
80+
81+
Examples of unacceptable behavior by participants include:
82+
83+
* The use of sexualized language or imagery and unwelcome sexual attention or
84+
advances
85+
* Trolling, insulting/derogatory comments, and personal or political attacks
86+
* Public or private harassment
87+
* Publishing others' private information, such as a physical or electronic
88+
address, without explicit permission
89+
* Other conduct which could reasonably be considered inappropriate in a
90+
professional setting
91+
92+
### Our Responsibilities
93+
94+
Project maintainers are responsible for clarifying the standards of acceptable
95+
behavior and are expected to take appropriate and fair corrective action in
96+
response to any instances of unacceptable behavior.
97+
98+
Project maintainers have the right and responsibility to remove, edit, or
99+
reject comments, commits, code, wiki edits, issues, and other contributions
100+
that are not aligned to this Code of Conduct, or to ban temporarily or
101+
permanently any contributor for other behaviors that they deem inappropriate,
102+
threatening, offensive, or harmful.
103+
104+
### Scope
105+
106+
This Code of Conduct applies both within project spaces and in public spaces
107+
when an individual is representing the project or its community. Examples of
108+
representing a project or community include using an official project e-mail
109+
address, posting via an official social media account, or acting as an appointed
110+
representative at an online or offline event. Representation of a project may be
111+
further defined and clarified by project maintainers.
112+
113+
### Enforcement
114+
115+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
116+
reported by contacting the project team at [INSERT EMAIL ADDRESS]. All
117+
complaints will be reviewed and investigated and will result in a response that
118+
is deemed necessary and appropriate to the circumstances. The project team is
119+
obligated to maintain confidentiality with regard to the reporter of an incident.
120+
Further details of specific enforcement policies may be posted separately.
121+
122+
Project maintainers who do not follow or enforce the Code of Conduct in good
123+
faith may face temporary or permanent repercussions as determined by other
124+
members of the project's leadership.
125+
126+
### Attribution
127+
128+
* This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
129+
available at [http://contributor-covenant.org/version/1/4][version]
130+
* The contribution guide is adapted from [Good-CONTRIBUTING](https://gist.github.com/PurpleBooth/b24679402957c63ec426)
131+
132+
[homepage]: http://contributor-covenant.org
133+
[version]: http://contributor-covenant.org/version/1/4/

README.md

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# [pyGhana](http://pythonghana.org/)
2+
3+
This is the source code for the http://pythonghana.org/ website.
4+
5+
# Running the site locally
6+
7+
## Requirments
8+
9+
* [Python 3.5](https://python.org)
10+
* [Django - python web framework](https://www.djangoproject.com/)
11+
* [Virtualenvwrapper](https://virtualenvwrapper.readthedocs.io)
12+
13+
## Installation
14+
15+
* [Follow the guide here](https://help.github.com/articles/fork-a-repo) on how to clone or fork a repo
16+
* [Follow the guide here](http://simononsoftware.com/virtualenv-tutorial/) on how to create virtualenv
17+
* Create a virtualenv (example _myvenv_) and activate it (see Code below).
18+
19+
```
20+
source virtualenvwrapper.sh
21+
22+
mkvirtualenv myvenv --python=/usr/bin/python3.5
23+
24+
(myvenv) $ pip install -r requirements.txt
25+
26+
(myvenv) $ python manage.py migrate
27+
28+
(myvenv) $ python manage.py makemigrations
29+
30+
(myvenv) $ python manage.py runserver
31+
```
32+
33+
* Copy the IP address provided once your server has completed building the site. (It will say something like >> Serving at 127.0.0.1....).
34+
* Open the address in the browser
35+
* `Note`: It is important that when you create your virtualenv, do not create it in the same folder as the code you downloaded.
36+
37+
# Contributing
38+
39+
Read our [Contributing Guide](./CONTRIBUTING.md) on how to contribute to the project.

about/__init__.py

Whitespace-only changes.

about/admin.py

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
from django.contrib import admin
2+
3+
# Register your models here.

about/apps.py

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
from __future__ import unicode_literals
2+
3+
from django.apps import AppConfig
4+
5+
6+
class AboutConfig(AppConfig):
7+
name = 'about'

about/migrations/__init__.py

Whitespace-only changes.

about/models.py

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
from __future__ import unicode_literals
2+
3+
from django.db import models
4+
5+
# Create your models here.

about/templates/about.html

+52
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
{% extends "base22.html" %}
2+
{% load static %}
3+
{% load i18n mezzanine_tags blog_tags staticfiles keyword_tags disqus_tags %}
4+
{% block meta_title %}{% if page %}{{ page.meta_title }}{% else %}{% trans "About" %}{% endif %}{% endblock %}
5+
6+
7+
{% block content %}
8+
9+
10+
11+
<!--=== Breadcrumbs ===-->
12+
<div class="breadcrumbs">
13+
<div class="container">
14+
<h1 class="pull-left"><strong>About</strong></h1>
15+
</div>
16+
</div><!--/breadcrumbs-->
17+
<!--=== End Breadcrumbs ===-->
18+
19+
<!--=== Parallax About Block ===-->
20+
<div class="parallax-bg parallaxBg1">
21+
<div class="container content parallax-about">
22+
<div class="row">
23+
<div>
24+
<div class="banner-info dark margin-bottom-10">
25+
<i class="rounded-x fa fa-info"></i>
26+
<div class="overflow-h">
27+
<h5>The Python Ghana Community (PyGhana) is a body that embraces all friends of the Python programming language in Ghana. We are a community of master programmers, intermediate and even absolute beginners, but one thing we all have in common is the love of Python.
28+
It encompasses all friends of the Python programming language in the Ghana.
29+
The community is open to everyone at all levels.<br><br> <p>So whether you are resident in Ghana or outside the country, an absolute beginner or a maestro, program in Python or other languages but have some interest in Python, our community will embrace you.
30+
We have an active Slack team, where we engage ourselves regularly. You can check out our Github page for blog we have or are working on.</p></h5>
31+
</div>
32+
</div>
33+
<div class="banner-info dark margin-bottom-10">
34+
<div class="overflow-h">
35+
<h3><strong>Our vision</strong></h3>
36+
<h5>PyGhana's mission is to promote the growth of a lively and dynamic community of users of the Python programming language and to promote the use of the latter.</h5>
37+
38+
<h5>PyGhana also aims to disseminate the Local Python knowledge to build a stronger developer community.</h5>
39+
40+
<h5>PyGhana promotes Free and Open Source Software, favors its adoption within the community, and collaborates with community players to achieve this goal.</h5>
41+
</div>
42+
</div>
43+
</div>
44+
45+
46+
</div>
47+
</div><!--/container-->
48+
</div>
49+
<!--=== End Parallax About Block ===-->
50+
51+
52+
{% endblock %}

about/tests.py

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
from django.test import TestCase
2+
3+
# Create your tests here.

about/urls.py

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#about url
2+
""" URL Configuration
3+
4+
The `urlpatterns` list routes URLs to views. For more information please see:
5+
https://docs.djangoproject.com/en/1.10/topics/http/urls/
6+
Examples:
7+
Function views
8+
1. Add an import: from my_app import views
9+
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
10+
Class-based views
11+
1. Add an import: from other_app.views import Home
12+
2. Add a URL to urlpatterns: url(r'^$', Home.as_view(), name='home')
13+
Including another URLconf
14+
1. Import the include() function: from django.conf.urls import url, include
15+
2. Add a URL to urlpatterns: url(r'^blog/', include('blog.urls'))
16+
"""
17+
18+
from django.conf.urls import url
19+
from django.conf import settings
20+
from django.conf.urls.static import static
21+
from . import views
22+
23+
urlpatterns = [
24+
url(r'^$', views.aboutpage, name='about'),
25+
] + static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
26+

about/views.py

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#about views
2+
from django.shortcuts import render
3+
4+
# Create your views here.
5+
6+
def aboutpage(request):
7+
context = {}
8+
template = "about.html"
9+
return render(request, template, context)

about/views.py~

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
from django.shortcuts import render
2+
3+
# Create your views here.

app/__init__.py

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
"""
2+
Package for the application.
3+
"""

app/admin.py

+55
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
#!/usr/bin/env python
2+
# -*- coding: utf-8 -*-
3+
import uuid
4+
import zipfile
5+
import pyghana.settings
6+
from datetime import datetime
7+
from zipfile import ZipFile
8+
9+
from django.contrib import admin
10+
from django.core.files.base import ContentFile
11+
12+
from PIL import Image
13+
14+
from app.models import Album, AlbumImage
15+
from app.forms import AlbumForm
16+
17+
@admin.register(Album)
18+
class AlbumModelAdmin(admin.ModelAdmin):
19+
form = AlbumForm
20+
prepopulated_fields = {'slug': ('title',)}
21+
list_display = ('title', 'thumb')
22+
list_filter = ('created',)
23+
24+
def save_model(self, request, obj, form, change):
25+
if form.is_valid():
26+
album = form.save(commit=False)
27+
album.modified = datetime.now()
28+
album.save()
29+
30+
if form.cleaned_data['zip'] != None:
31+
zip = zipfile.ZipFile(form.cleaned_data['zip'])
32+
for filename in sorted(zip.namelist()):
33+
data = zip.read(filename)
34+
contentfile = ContentFile(data)
35+
36+
img = AlbumImage()
37+
img.album = album
38+
img.alt = filename
39+
filename = '{0}{1}.jpg'.format(album.slug, str(uuid.uuid4())[-13:])
40+
img.image.save(filename, contentfile)
41+
42+
filepath = '{0}/albums/{1}'.format(pyghana.settings.MEDIA_ROOT, filename)
43+
with Image.open(filepath) as i:
44+
img.width, img.height = i.size
45+
46+
img.thumb.save('thumb-{0}'.format(filename), contentfile)
47+
img.save()
48+
zip.close()
49+
super(AlbumModelAdmin, self).save_model(request, obj, form, change)
50+
51+
# In case image should be removed from album.
52+
@admin.register(AlbumImage)
53+
class AlbumImageModelAdmin(admin.ModelAdmin):
54+
list_display = ('alt', 'album')
55+
list_filter = ('album', 'created')

app/forms.py

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/usr/bin/env python
2+
# -*- coding: utf-8 -*-
3+
from django import forms
4+
from app.models import Album
5+
6+
class AlbumForm(forms.ModelForm):
7+
class Meta:
8+
model = Album
9+
exclude = []
10+
11+
zip = forms.FileField(required=False)

0 commit comments

Comments
 (0)