Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Help a cause by building a donation system
Search
Dražen Lučanin
April 29, 2017
Programming
110
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
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
65
Crowdfunding Python (& other IT) projects
metakermit
0
140
Pokreni posao: Freelancing
metakermit
1
240
Efficiently deploying Django
metakermit
1
220
Home office on a budget
metakermit
0
150
How to start freelancing
metakermit
0
260
From freelancing to incorporating
metakermit
0
250
Running a company as an e-Resident in Croatia
metakermit
0
730
CSS Animations
metakermit
0
400
Other Decks in Programming
See All in Programming
Zero-Tap Sign-In対応、結局何をすればいいの?
mitohato14
0
360
Web Framework Benchmark Battle 2026, Any%
a_matsuda
2
2.8k
AWS CDKのカスタムリソースでContinuum(旧Security Agent)を実装した話 | Implementing Continuum (formerly Security Agent) via AWS CDK Custom Resource
akihisaikeda
2
160
コードレビューのボトルネックを"する側"と"される側"の両面から解消する
yub0n
2
1.7k
contenteditable と日本語入力に向き合う
colorful12
0
210
조합이폭발하는디자인시스템이걸눈으로도테스트하라고요
giljongyu
0
220
Long Living Tokens, Die, Die, Die! (or: The One Ring is Banned in Modern)
sylph01
0
350
AIで開発が速くなった先で、開発チームは何を目指すか
shihochan
1
1.7k
個人開発者よ、Honoを使え(おじさんver)
tanahiro2010
2
270
Domain-Driven Transformation
hschwentner
2
2.3k
Simple Storage Service(S3) is not simple
iwatsukayura
0
310
Unity6 URPによる海底をテーマにしたVJシステムの解説 | Unity Shader 完全に理解した 勉強会
gam0022
0
370
Featured
See All Featured
Automating Front-end Workflow
addyosmani
1369
210k
GitHub's CSS Performance
jonrohan
1033
470k
Fantastic passwords and where to find them - at NoRuKo
philnash
53
4k
Kristin Tynski - Automating Marketing Tasks With AI
techseoconnect
PRO
0
550
Deep Space Network (abreviated)
tonyrice
0
380
How to train your dragon (web standard)
notwaldorf
96
6.9k
Intergalactic Javascript Robots from Outer Space
tanoku
273
28k
30 Presentation Tips
portentint
PRO
1
430
The Curse of the Amulet
leimatthew05
3
16k
Winning Ecommerce Organic Search in an AI Era - #searchnstuff2025
aleyda
2
2.2k
First, design no harm
axbom
PRO
2
1.3k
No one is an island. Learnings from fostering a developers community.
thoeni
21
3.9k
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 :)