This API service written in Django manages database for Czech theatre improvisation festival called Improtřesk.
- Django 1.10
- Python 3.5
Frontend for this app is written in React / Redux. You can see it in separate repository: improtresk-web.
API service for Improtřesk festival website, Czech theatre improvisation festival
This API service written in Django manages database for Czech theatre improvisation festival called Improtřesk.
Frontend for this app is written in React / Redux. You can see it in separate repository: improtresk-web.
Order is quite confusing, because it can mean sequence as well as order of workshop. It is also translated by Django as "pořadí". We need some more unambiguous name.
We could use MarkdownField
from django_markdown, so that we have pretty editor in admin and the field contents is guarded for acceptable values.
Je dobrým zvykem jednotlivé parametry v modelu pojmenovat trochu uživatelsky přívětivě pomocí parametru verbose_name
, případně i dovysvětlit pomocí help_text
. Například:
bank_code = models.CharField(
verbose_name=_("Code of bank"),
help_text=_("Code of bank from which money was received"),
max_length=30,
blank=True,
)
Field order
is shown in admin as Pořadí
, while it should be translated as Objednávka
. Add at least translation of this field to the locale messages.
Set up LDAP integration for django admin users.
It is insecure to keep secret key in git repository despite it is just a development key. We need to find a way to hide this piece of configuration from repository and read production configuration.
As user I need to be able to figure out how much I'm going to pay for signup on workshop. As organizer of festival, I need to be able to define different price for each workshop, Year
and period of time.
Workshop
model will have many (usually two) WorkshopPrice
s.WorkshopPrice
model will belong to Workshop
and PriceLevel
PriceLevel
model will belong to a Year
PriceLevel will carry a date of start - e.g. User will pay this much from this period of time.
In Django is built-in model auth.User which has properties first_name, last_name, email, password and others. We could use it as one-to-one to Signup and omit duplicate fields there.
The main benefit of using this is, that we could use standart Django authentification backends.
MealReservation
Payment
Year
Rules
should contain year
in description (could be independent on created_at
)As organizer, I need to print a list of all participants for current year that are paid and assigned to a workshop. I need endpoint that returns this information.
As organizer, I need to see how many people have shown active interest in the festival by watching database stats. I need to see:
Signup.team
should be made by ForegnKey
if we want to use it for things like listing signups from one team or gym assignment.
As garant of the festival, I don't know when signups will be started. We need to make the field null initially.
As a participant I want to be able to see a list of offered accomodation for current year including the price, capacity, remaining places, photos and address.
Order.birthday
should be DateField
if we want to get useful information from that.
As a participant I need to be able to see a list of workshops for current year to pick one before singning up. I need to be able to reference a lector with the lector endpoint and see list of photos assigned to the workshop.
As a participant I need to see all Lectors of the workshop including musicians. Create following models and relations:
LectorRole
contains all different roles lector can have on workshop. Needs a slug.WorkshopLector
belongs to Workshop
, Lector
role and Lector
Fields are required (blank=False
, null=False
) by default in Django. Some fields like Signup.birthday
or Order.food
should probably not be required.
As participant, I need to see place where the workshop will be. As admin, I need to generate number of meals I need to deliver from HQ place.
Location
name
, stringdesc
, textaddress
, textLocationPhoto
caption
, string, not requiredimage
, image fieldLocation
As an admin I need to store photos on a different machine than the on running the application because it can be nuked at any time. Preferable choice is AWS S3. It needs to be configurable by environment variables so it does not slow down development. Default store should point to local machine.
As organizer, I need to see how many foods I need to preorder for lunch. Please create endpoint that will return per-FoodTime
list of meals and their orders.
[
{
"name": "Obědy",
"date": "2016-05-01",
"order": [
{
"name": "Česnečka",
"count": 88
},
{
"name": "Pečené kuře s bramborovou kaší",
"count": 92
}
]
}
]
As user I need to see some static informational texts with occasional photos such as rules on cancelling signups, howtos, page lead descriptions. This model might be later extended or reused for tips, terms and conditions.
Text
name
, stringslug
, string, uniquetext
, text (markdown)TextPhoto
caption
, stringimage
, image fieldAs a participant I need to be able to list previous years of Improtřesk to browse it for reference. I should also be able to see if the year is current. It should be admin choice if the year is displayed on the frontend website.
Created_at a updated není potřeba řešit pomocí modifikace metody save, stačí tam přidat parametr auto_now_add a auto_now: https://docs.djangoproject.com/en/1.10/ref/models/fields/#django.db.models.DateField
As a participant I need to see all the rules, terms and conditions there are in current festival year. I also need to see current and previous versions to compare what has changed.
Conditions
model belongs to year, has name and text (in markdown).
As user I want to see some interesting facts that are along the way to the city of festival. Create model TravelTips
and TravelTipPhoto
to store them.
TravelTip
has a name, text formatted in markdown and many TravelTipPhoto
s.TravelTip
As a participant I need to be able to browse a list of lectors to know what workshop is lead by which lector. I also need to see photos of lector to be able to recognize him later.
As administrator, I need to categorize workshops by difficulty. Create following models and relations:
WorkshopDifficulty
- carries name (and description?)Workshop
belongs to WorkshopDifficulty
As server admin I need to receive a single file containing both code ready to run and all static files and dependencies to deploy the application on staging and production server as fast as possible.
Create a model that will hold information about festival years: Topic, Year (SlugField), Start Date, End Date, Start Date of signups and (Bool) Is it current year(?).
Extend the django.contrib.auth.user model to Participant that will hold information about participants for current Year and provide means to authenticat. Participants and users must be in separate tables.
As pointed out in PR #70, we need to find proper webserver for production.
As tester, I need to be able to test application with real data on staging environment.
Question is, should it clone participants data as well? Tester should be allowed to test the e-mailing capability as well without affecting real life users.
As organizer, admin or lector I need to see what people are going to which workshop. Create participants endpoint to workshop that lists names of participants on a workshop.
More Djangonautic approach is to separate project into more simple reusable apps. I would consider following apps: workshops, accomodation/food, signups, (transportation)
Payment
type
, enum (card payment, account transfer, cash)As administrator I need to see log from payment gateway. Save all status changes into CardPaymentLog model.
As future participant, I want to see list of all teams that are going to the festival with number of people who signed up and are paid. For example: "Poločas nápadu, 15 people signed up, 10 people assigned".
At least until we decide on how should the client contact API.
As a participant I need to be able to reserve accomodation.
We need to decide whether we need to leave users with first, second and third workshop choice or we are able to secure that the workshop the user chooses first is reserved for him.
In first case, there should be through model (https://docs.djangoproject.com/en/1.10/ref/models/fields/#django.db.models.ManyToManyField.through) for workshops
parameter of Signup
holding the order.
In second case, there would simply be workshop
foreign key for Signup
, but we need to ensure, that the signup is limited in time.
As developers, we need to automatically backup the database when deploying to production before migrations because we are not sure if the migrations will succeed.
Make price, participant and reservation read only in django Orders admin.
As a participant, I need to be able to reserve spot on workshop for current year to be given some time to pay it. Create following models and relations:
Order
price
, numberpaid
, boolcanceled
, boolPayment
type
, enum (card payment, account transfer, cash)Reservation
endsAt
, a date when the reservation becomes invalidParticipant
, WorkshopPrice
, ReservationFoodTime
, Order
ReservationFoodTime
Reservation
and FoodTime
Food
FoodTime
Food
s and ReservationFoodTime
sFood
name
, stringcourse
, enum(soup, main)FoodTime
As organizer, I don't know when will the complete list of meals for lunch be available. As accountant or participant I need to know how much do I need to pay for signup. We've discussed it and we need to create following models and relations:
FoodTime
carries date, name and price as for "5th May, Lunch, 90 CZK" (Price is for lunch)Food
as for specific menu item on time. Belongs to FoodTime
At http://localhost:8000/admin/api/payment/add/ I get following error:
get_readonly_fields() takes from 2 to 3 positional arguments but 4 were given
As admin, I find it confusing to pick from two price levels connected to different years with same names.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.