Skip to content
Open
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
118 changes: 74 additions & 44 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,24 +1,4 @@
# UI/UX Code Challenge
## This challenge is due at 1800 HRS EAT on 12th September 2018

## Simple Unchanging Rules
The code challenge is and will always be judged using the following criteria:
- A Correct fork, branch and pull request
- Using the GitHub Pull Request Time Stamp and correct code quality & structure, the first developer whose code runs successfully wins
- Code quality and structure will be evaluated
- The order for pull requests will be followed, first come first win basis!
- Do not share any code that you cannot opensource on the Git Repository as its open source and Africa's Talking will not be liable for any breach of intellectual property (if any) once shared on the platform.

## Terms and Conditions
You can participate on as many challenges as you wish:
- Do not share any code that you cannot opensource on the Git Repository as its open source and Africa's Talking will not be liable for any breach of intellectual property (if any) once shared on the platform.
- Code Challenges are time bound - the time restriction is specified on the challenge
- Additional rules MAY be provided on the code challenge and will vary for each challenge
- You are free to use all manner of tools
- Successive interviews for projects MAY be run to satisfy participating Africa's Talking Partners

## Code Challenge Bounty:
- A chance to work with some of the most brilliant minds in the world!

## Task
In this code challenge you will be required to make an application that:
Expand All @@ -43,47 +23,97 @@ In this code challenge you will be required to make an application that:



# Working on the Code Challenge
1.Fork the code challenge repository provided.

2.Make a topic branch. In your github form, keep the master branch clean. When you create a branch, it essentially will be a copy of the master.
# [SOLUTION] AIRTIME PAP APP DOCUMENTATION

>Pull all changes, make sure your repository is up to date
## Deployed App

```sh
link: [Pesa Pap Online](http://airtimeapp.herokuapp.com/)

## Installation instructions

> Clone or Download the source files at the [project repository](https://github.com/zlyxero/UIUXCodeChallengeSeptember2018)

```sh
$ git clone https://github.com/zlyxero/UIUXCodeChallengeSeptember2018
```

> On the terminal, open the UIUXCodeChallengeSeptember2018 folder

```sh
$ cd UIUXCodeChallengeSeptember2018
$ git pull origin master
```

>Create a new branch as follows-> git checkout -b [your_phone_number], e.g.
> Switch to the 254711276275 branch

```sh
$ git checkout 254711276275
```

> Open the airtime_pap folder

```sh
$ git checkout -b 25472XXXXXXX master
```sh
$ cd airtime_pap
```

>See all branches created
> See the files inside

```sh
$ git branch
* 25472XXXXXXX
master
```sh
$ ls
airtime_app
airtime_project
manage.py
Pipfile
Pipfile.lock
```

>Push the new branch to github
> Create a virtual environment and install the application dependencies

```sh
$ git push origin -u 25472XXXXXXX
```sh
$ pipenv install
```

3.Make changes to the fork following the Code Challenge provided.
> Activate the virtual environment

```sh
$ pipenv shell
```

> Run the migrate command to set up the database

```sh
$ python manage.py migrate
```

> Run the development server

```sh
$ python manage.py runserver
```

> View the app in your browser at [local host](http://127.0.0.1:8000/)


## Navigating the app

1. Create an account

2. Add a contact

3. In a new browser tab, Open the Africa's Talking [Simulator](https://simulator.africastalking.com:1517/)

> Register your contact and click on the launch button

> Open the airtime menu option

4. Switch back to the app tab on your browser

5. On the app menu, select send airtime

4.Commit the changes to your fork.
6. select a checkbox next to your contact to send airtime. Enter amount and click on the send
airtime button

5.Make a pull request to the UIUXCodeChallengeSeptember2018
Repo.
7. Open the Africa's Talking Simulator tab in your browser to see the confirmation message


## Get Support from Africa's Talking
In case you have any questions, reach out [Roina Ochieng](mailto:[email protected]) or [Anthony Kiplimo](mailto:[email protected])

## Submissions later than 1800 HRS EAT on 12th September 2018 will not be considered
1 change: 1 addition & 0 deletions airtime_pap/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__pycache__/
21 changes: 21 additions & 0 deletions airtime_pap/Pipfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
[[source]]

url = "https://pypi.python.org/simple"
verify_ssl = true
name = "pypi"


[dev-packages]



[packages]

django = "*"
africastalking = "*"
django-phonenumber-field = "*"


[requires]

python_version = "3.5"
116 changes: 116 additions & 0 deletions airtime_pap/Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions airtime_pap/airtime_app/admin.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
from django.contrib import admin
from .models import Contact
# Register your models here.
admin.site.register(Contact)
5 changes: 5 additions & 0 deletions airtime_pap/airtime_app/apps.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
from django.apps import AppConfig


class AirtimeAppConfig(AppConfig):
name = 'airtime_app'
24 changes: 24 additions & 0 deletions airtime_pap/airtime_app/forms.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
from django.forms import ModelForm
from django import forms
from .models import Contact


class CreateContactForm(ModelForm):
''' creates a new contact '''

class Meta:
model = Contact
fields = ['first_name', 'last_name', 'phone_number']
labels = {
'first_name': 'First Name',
'last_name': 'Last Name',
'phone_number': 'Phone'
}

widgets = {
'first_name': forms.TextInput(attrs={'placeholder': 'first name'}),
'last_name': forms.TextInput(attrs={'placeholder': 'last name'}),
'phone_number': forms.TextInput(attrs={'placeholder': 'phone number e.g +2547xxx12345'}),
}


27 changes: 27 additions & 0 deletions airtime_pap/airtime_app/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Generated by Django 2.1.1 on 2018-09-14 11:52

from django.conf import settings
from django.db import migrations, models
import phonenumber_field.modelfields


class Migration(migrations.Migration):

initial = True

dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]

operations = [
migrations.CreateModel(
name='Contact',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('first_name', models.CharField(max_length=100)),
('last_name', models.CharField(max_length=100)),
('phone_number', phonenumber_field.modelfields.PhoneNumberField(max_length=128, unique=True)),
('owner', models.ManyToManyField(to=settings.AUTH_USER_MODEL)),
],
),
]
Empty file.
27 changes: 27 additions & 0 deletions airtime_pap/airtime_app/models.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
from django.db import models
from django.contrib.auth.models import User
from phonenumber_field.modelfields import PhoneNumberField


# Create your models here.

class Contact(models.Model):
'''
defines a contact entry in the phonebook.
A contact is associated with a user
'''

first_name = models.CharField(max_length = 100)
last_name = models.CharField(max_length = 100)
phone_number = PhoneNumberField(unique=True)

owner = models.ManyToManyField(User)

def __str__(self):
person = self.first_name + ' ' + self.last_name
return person





Large diffs are not rendered by default.

Loading