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
0
97
Help a cause by building a donation system
DjangoGirls Vienna April 2017 lightning talk
Dražen Lučanin
April 29, 2017
Tweet
Share
More Decks by Dražen Lučanin
See All by Dražen Lučanin
Digitalisation for Citizen Empowerment
metakermit
0
49
Crowdfunding Python (& other IT) projects
metakermit
0
110
Pokreni posao: Freelancing
metakermit
1
230
Efficiently deploying Django
metakermit
1
190
Home office on a budget
metakermit
0
140
How to start freelancing
metakermit
0
250
From freelancing to incorporating
metakermit
0
240
Running a company as an e-Resident in Croatia
metakermit
0
710
CSS Animations
metakermit
0
370
Other Decks in Programming
See All in Programming
MDN Web Docs に日本語翻訳でコントリビュート
ohmori_yusuke
0
610
Implementation Patterns
denyspoltorak
0
270
開発者から情シスまで - 多様なユーザー層に届けるAPI提供戦略 / Postman API Night Okinawa 2026 Winter
tasshi
0
160
AIによるイベントストーミング図からのコード生成 / AI-powered code generation from Event Storming diagrams
nrslib
2
1.7k
ZJIT: The Ruby 4 JIT Compiler / Ruby Release 30th Anniversary Party
k0kubun
1
390
Oxlintはいいぞ
yug1224
5
1.1k
実は歴史的なアップデートだと思う AWS Interconnect - multicloud
maroon1st
0
360
[AI Engineering Summit Tokyo 2025] LLMは計画業務のゲームチェンジャーか? 最適化業務における活⽤の可能性と限界
terryu16
2
520
Automatic Grammar Agreementと Markdown Extended Attributes について
kishikawakatsumi
0
170
ELYZA_Findy AI Engineering Summit登壇資料_AIコーディング時代に「ちゃんと」やること_toB LLMプロダクト開発舞台裏_20251216
elyza
2
1.3k
Honoを使ったリモートMCPサーバでAIツールとの連携を加速させる!
tosuri13
1
170
インターン生でもAuth0で認証基盤刷新が出来るのか
taku271
0
190
Featured
See All Featured
RailsConf 2023
tenderlove
30
1.3k
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
49
3.3k
Redefining SEO in the New Era of Traffic Generation
szymonslowik
1
200
Why Mistakes Are the Best Teachers: Turning Failure into a Pathway for Growth
auna
0
47
Avoiding the “Bad Training, Faster” Trap in the Age of AI
tmiket
0
63
Darren the Foodie - Storyboard
khoart
PRO
2
2.3k
How to Talk to Developers About Accessibility
jct
1
110
Jamie Indigo - Trashchat’s Guide to Black Boxes: Technical SEO Tactics for LLMs
techseoconnect
PRO
0
52
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
35
3.3k
Google's AI Overviews - The New Search
badams
0
890
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
133
19k
Taking LLMs out of the black box: A practical guide to human-in-the-loop distillation
inesmontani
PRO
3
2k
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 :)