Will & Skill Developers

Will & Skill Developers


Thoughts, snippets and ideas from the team at Will & Skill AB, Stockholm.

Mohammed Hammoud
Author

Mohammed Hammoud

Webdeveloper @ Will & Skill

Django Rest Framework, Many-To-Many and Multipart

If you are using Django, you have or will probably create a model that includes both a ManyToManyField and a File/ImageField. And if you're using Django Rest Framework and want to created a new object with both a file and m2m values you may encounter the following error: questions: ["Incorrect type. Expected pk value, received unicode.”]…

Mohammed HammoudMohammed Hammoud

How to submit package to PyPi

Hi there. So we meet again. I just created a simple django package (django-session-notifier) and submitted it to PyPI. Therefore I want to share me experience on how you submit your python package to PyPI. Structure Let's say that our package has the name "awesome_pypi_package" and that it contains of a "utils.py" file. The structure of w…

Mohammed HammoudMohammed Hammoud

Unique and slugify Django filename

utils.py from django.utils.text import slugify import time import os class UniqueFilenameUtil: def __init__(self, directory): self.directory = directory def unique_filename(self, instance, filename): epoch_time = int(time.time()) slugify_filename = slugify(filename) new_filename = u'{}-{}'.format(ep…

Mohammed HammoudMohammed Hammoud

How to deploy a firebase project

Navigate to your project directory and install firebase-tools: npm install firebase-tools --save Authenticate to firebase firebase login Initialize as firebase project firebase init Deploy to firebase firebase deploy When prompt select the following: ? What Firebase do you want to use? (*Select your project*) ? What directory should be th…

Mohammed HammoudMohammed Hammoud

How to install latest stable ruby version and compass

I encountered a problem earlier today when I tried to install ruby 2.2 on my Ubuntu machine. I tried the default installation guides at https://www.ruby-lang.org/en/documentation/installation/, but as of writing, the ruby-full package provides Ruby 1.9.3, which is an old stable release, on Debian and Ubuntu. There's a lot of ways to insta…

Mohammed HammoudMohammed Hammoud