Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Help a cause by building a donation system
Search
Dražen Lučanin
April 29, 2017
Programming
99
0
Share
Help a cause by building a donation system
DjangoGirls Vienna April 2017 lightning talk
Dražen Lučanin
April 29, 2017
More Decks by Dražen Lučanin
See All by Dražen Lučanin
Digitalisation for Citizen Empowerment
metakermit
0
55
Crowdfunding Python (& other IT) projects
metakermit
0
120
Pokreni posao: Freelancing
metakermit
1
230
Efficiently deploying Django
metakermit
1
200
Home office on a budget
metakermit
0
140
How to start freelancing
metakermit
0
250
From freelancing to incorporating
metakermit
0
250
Running a company as an e-Resident in Croatia
metakermit
0
710
CSS Animations
metakermit
0
380
Other Decks in Programming
See All in Programming
Agentic Elixir
whatyouhide
0
450
Symfony AI in Action - SymfonyLive Berlin 2026
chr_hertel
1
150
検索設計から 推論設計への重心移動と Recall-First Retrieval
po3rin
5
1.7k
Are We Really Coding 10× Faster with AI?
kohzas
0
170
The Past, Present, and Future of Enterprise Java
ivargrimstad
0
340
SkillsをS3 Filesに置く時のあれこれ
watany
3
1.6k
Programming with a DJ Controller — not vibe coding
m_seki
3
850
「なんか〇〇ライブラリで脆弱性あるみたいなんだけど。。。」から始める脆弱性対応 / First Steps in Vulnerability Response
mackey0225
2
120
Back to the roots of date
jinroq
0
840
Road to RubyKaigi: Play Hard(ware)
makicamel
1
570
cloudnative conference 2026 flyle
azihsoyn
0
180
なぜあなたのコードには「コシ」がないのか?〜AI時代に問う、最後まで美味しい設計と戦略〜 #phpconkagawa / phpconkagawa2026
shogogg
0
200
Featured
See All Featured
Tell your own story through comics
letsgokoyo
1
920
Fashionably flexible responsive web design (full day workshop)
malarkey
408
66k
Organizational Design Perspectives: An Ontology of Organizational Design Elements
kimpetersen
PRO
1
690
sira's awesome portfolio website redesign presentation
elsirapls
0
240
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
35
2.4k
Stop Working from a Prison Cell
hatefulcrawdad
274
21k
Conquering PDFs: document understanding beyond plain text
inesmontani
PRO
4
2.7k
Reflections from 52 weeks, 52 projects
jeffersonlam
356
21k
Building AI with AI
inesmontani
PRO
1
990
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
35
3.5k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
122
21k
What Being in a Rock Band Can Teach Us About Real World SEO
427marketing
0
230
Transcript
Help a cause by building a donation system Dražen Lučanin
@metakermit
• Helping a young green party run for local elections
in Zagreb • Inspiration for applying your Django skills :) Background
Functionality • Donation form with field validation • Talking to
an external API to generate a scannable 2D barcode • Email the payment information • Admin interface ◦ confirming payments ◦ exporting reports
Model class Donation(models.Model): uuid = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False) submitted_time =
models.DateTimeField(auto_now_add=True) OIB = models.CharField(max_length=11, validators=[oib_validator]) name = models.CharField(max_length=30, validators=[utf8_30_validator]) email = models.EmailField() street = models.CharField(max_length=27, validators=[utf8_27_validator]) place = models.CharField(max_length=27, validators=[utf8_27_validator]) phone = models.CharField(max_length=30, blank=True) # optional physical_person = models.BooleanField(default=True) amount = models.PositiveIntegerField() paid = models.BooleanField(default=False) barcode = models.ImageField(blank=True, upload_to='barcodes/%Y/%m/%d') invoice_image = models.ImageField(blank=True, upload_to='invoices/%Y/%m/%d')
None
Talking to an external API – requests hub3_args = {
"renderer": "image", "data": { "amount": self.amount, "sender": { "name": self.name, }, "receiver": { "iban": settings.DONATIONS_RECIPIENT_IBAN, } } } response = requests.post( 'https://hub3.bigfish.software/api/v1/barcode', json=hub3_args )
We even got a bit fancy using PIL… img =
Image.open(blank_invoice_path) draw = ImageDraw.Draw(img) draw.text((749, 132), settings.DONATIONS_RECIPIENT_IBAN, text_color, font=font)
Popular payment services • Stripe • BrainTree
Email the payment info – django-anymail + Mailgun msg =
EmailMultiAlternatives( subject="Uplatnica za donaciju", body=text_content, to=[f"{donation.name} <{donation.email}>"] ) msg.attach('uplatnica.jpg', invoice_file.getvalue(), 'image/jpeg') msg.attach('barcode.png', barcode_file.getvalue(), 'image/png') # Send it: msg.send()
And it works… • http://www.zagrebjenas.hr/doniraj/
Thanks! • Now go build your own project :)