Install Wagtail – Linux Dependencies

I was trying to install wagtail which gets annoying if you are using something ike a Vagrant Box or Linux machine. Follow the following steps :

  1. Install pip
  2. Install  libjpeg-dev
  3. Install  zlib1g-dev
  4. Install  python-dev (if not 2 and 3  and 2 and 3 are in 4, still try just 2 and 3)
  5. Install pillow
  6. 6. Install wagtail

If you do not want to follow all the steps every time you set up an environment, make a vagrant box with these preinstalled and share it.

Matching DateTime objects in test cases with Django Rest Framework

If your model has a date_created or modified etc. kind of object(s) probably you will face a datetime object mismatch issue while asserting equality of your dictionary object with the rendered response dictionary. So, I have created a small function which will help you resolve it.

 

DATETIMEHELPER = lambda x : str(x.isoformat().split('.')[0])+'Z'

 

Now, you can call your data object as :

data = {...,"date_created":DATETIMEHELPER(self.model_name.date_created),...}
response.render()
self.AssertEqual(json.dumps(response.content), data)