Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Dynamic plans

313 views

Published on

The steps for building an API and serving dynamic content to mobile clients

Published in: Software
  • Be the first to comment

Dynamic plans

  1. 1. Dynamic Plans Connecting backend and mobile Stockholm Python Meetup Jun 16, 2016
  2. 2. About me Ilian Iliev Platform Engineer ilian@lifesum.com www.ilian.io
  3. 3. Plans - the next step towards healthy life
  4. 4. Feature requirements ● Multilingual support ● Different images based on the screen density ● Color fields ● Serialization ● Caching ● Administration
  5. 5. Multilingual support Django Parler class Plan(TranslatableModel): detail_image = ScreenDensityImageField(upload_to='plans/detail_images') translations = TranslatedFields( title=models.CharField(max_length=255), short_description=models.TextField(), description=models.TextField(), )
  6. 6. Different images based on screen density ● Our screen sizes : 1x, 1.5x, 2x, 3x ● Pixel perfect design ● Django Multiupload
  7. 7. Color fields Django Colorful class Plan(TranslatableModel): start_color = RGBColorField() end_color = RGBColorField() content_color = RGBColorField()
  8. 8. Serialization ● DRF Serializers ● Different fields for list and detail class PlanSerializer(ShortListSerializerMixin, serializers.ModelSerializer): class Meta: model = Plan list_fields = ['id', 'title', 'short_description'] fields = list_fields + ['description']
  9. 9. Caching ● Per object caching ● Key attributes ○ Language ○ Screen Density ● Redis HSET ● Easy to invalidate
  10. 10. { "plan_list_20" : {...}, "plan_list_14": {...}, "plan_detail_8": { "en-3": "{"key": "value"}", "de-2": "...", "en-2": "...", "sv-2": "...", "sv-1": "...", }
  11. 11. Administration
  12. 12. Questions?

×