RSSAmplifier

Blog

Blog | Bit of Pixels

Blog

bitofpixels.comRSS feed ↗14 posts

Latest posts

Upgrading to Mezzanine 4

_This post assumes your project is currently using Mezzanine 3.1.10 and up to date with South migrations._ To get started install Mezzanine 4 into a fresh virtualenv and create a Mezzanine 4 project. $ virtualenv MEZ4 $ source MEZ4/bin/active $ pip install mezzanine $ mezzanine-project mez4proj We will refer to `mez4proj` throughout the process of upgrading your project to Mezzanine 4. As I write…

Collecting additional information on a per product basis in Cartridge

I recently was working on a project in which I was making use of Cartridge and needed to collect extra info when users added particular products to their order. I wanted this to be toggleable via the backend so that certain products would require extra information and others wouldn't. My particular case was collecting a student ID, but these techniques should be applicable to many use cases. After…

Deploying Mezzanine to Digital Ocean using the included fabfile

## The process 1. Sign up for [Digital Ocean](https://www.digitalocean.com/?refcode=8b6cb2deb3cc) (that's a referral link which you are in no way obligated to use) 2. Create a droplet (I've added my SSH key to Digital Ocean so I assign that to the droplet). I used Debian 7 x64 3. Point your domain's A record at the IP address Digital Ocean assigns to your droplet. 4. Log into the vps as root,…

On SingletonAdmins and SitewideContent (editing sitewide content in Mezzanine's admin)

## The problem Recently while working on developing a Mezzanine powered site I was asked to make it possible to edit the footer in the Mezzanine admin. In this case the footer contained a block of text that was contact info and two blocks that were links, some within the site, some external. In the past I've created a `ContentBlock` model that is just a title and `RichTextField`. I then have…

MEZZaTHEMing Part 4: To the blog, and beyond

This is the fourth and final part of my tutorial series on creating Mezzanine themes. Throughout the tutorial I have been going over the process of taking static html and using it to develop a Mezzanine theme. I've been working with the html template that is available [here](http://www.templatescreme.com/free-website-jessica-white-free-bootstrap-website), but the methods I discuss could be used to…

MEZZaTHEMing Part 3: Pages, extra DRY

This is the third post in my series on creating themes for Mezzanine. [Part 1](/blog/mezzatheming-creating-mezzanine-themes-part-1-basehtml/) went over setting up base.html to provide a consistent header and footer across the whole site. [Part 2](/blog/mezzatheming-part-2-the-homepage/) covered adding your home page to Mezzanine's CMS. In this post I will describe the process that I use to style…

MEZZaTHEMing Part 2: The HomePage

This is the second post in a series of posts on how I create Mezzanine themes. These posts are a walkthrough of how I take an html template (the one I am using is freely available [here](http://www.templatescreme.com/free-website-jessica-white-free-bootstrap-website), and turn it into a fully functional Mezzanine site. I would recommend starting with the [first…

MEZZaTHEMing (creating Mezzanine themes) Part 1: base.html

This is the first part of a series of blog posts that describes the process that I use to create themes for Mezzanine. In this case you will be following along as I create the theme [Lucid](https://mezzathe.me/theme/lucid/), which you can purchase on [MEZZaTHEME](http://mezzathe.me). Lucid is based on the responsive Twitter Bootstrap template that you can find…

Accessing the model instance in a ModelForm's widget

I recently integrated [Django Sendfile][1] with a website to provide downloads that required authentication (even knowing the location of an authentication requiring file in the static directory will not allow you to download it thanks to some Apache conf magic). That was all well and good, but a result was that it was no longer possible to download those files through the admin interface using…

Disabling Mezzanine Comments

I was working on further developing a website that is built in Mezzanine and needed to completely disable the built in comments. As far as I know there is no setting that controls this so I wanted to figure out the easiest/most efficient way to do this. Obviously I could go through every template that used the comments_for template tag and remove it (removing the comment form from the associated…

Techniques for modifying Mezzanine

A question that often comes up on the Mezzanine mailing list is "how can I make Mezzanine do x". Modifying Mezzanine's code directly is an option but that will make upgrading Mezzanine painful. Below I discuss a number of techniques that can be used to modify Mezzanine without actually touching Mezzanine's codebase. ## Monkey Patching In case you are unfamiliar, Wikipedia defines a monkey patch as…

Update Mezzanine blog posts to allow being marked login required

I was working on developing a [Mezzanine](http://mezzanine.jupo.org) site where a desired feature was to allow marking BlogPosts as login required, the same way that Pages can be marked as login required. After implenting a solution I decided it would be nice to document it for myself, and anyone else who is interested. ## The code A prerequisite to the following code is creating a django app.…

Form and formset in one html form

I was recently working on a project that required combining a Django model and another model related to it via a ForeignKey in a single form. At first I considered generating fields for the related model in the ModelForm's init, the more I thought about it though, the more I realized that would be messy, brittle and not easy to make changes to in the future. ## The Solution Turns out you can put a…

Unique on CharField when blank=True

I recently ran into a situation where I wanted to make an EmailField unique. The problem was that the field had blank set to True so the field couldn't be unique because when testing uniqueness Django (and AFAIK the underlying databases) consider '' to match ''. This is differnet than when you have null=True as well because django and the underlying database do not consider None and None to be a…