Didn’t write for awhile. Want…

Didn’t write for awhile. Want to test and see how this site/templates work.



My goal for today was to:

  1. Start the new kidsintown project, based on the django tutorial (mysite). Namely to turn all the poll models and views into events.
  2. Find a package that will help me with recurring events


Moving from mysite to kidsintown

  • It took me a lot of time to transition from the poll app to the events. The main issue was around urls and naming of views (that will be a reccuring theme…)
  • This didn’t take long to figure out, but I django yelled at me that I need to add the events app to the INSTALLED_APPS in my setting.py. But I didn’t have to do it with the django tutorial project… I still don’t understand what’s the different between the two projects.

Implementing django-recurrence

  • Implemented the django-reccuring package. I had an issue with getting it to work with my simple Event model, because I kept getting errors when trying to make a migration. Here’s how my model was looking like, according to the documentation:
from recurrence.fields import RecurrenceField

class Course(models.Model):
    title = models.CharField(max_length=200)
    recurrences = RecurrenceField()

I kept getting an error saying that I try to create a non-nullable field (recurrences) with a null value. After looking for code examples in github, I found one that worked:

class Event(models.Model):

    event_name = models.CharField(max_length=200)
    event_time = models.DateField()
    recurrence = RecurrenceField(blank=True, null=True)

    def __str__(self):
        return self.event_name
  • Documentation for packages in general, and that one in particular, isn’t good. There is now step-by-step tutorials, and you should figure out how the fragments of code integrating into your project. I found that looking for code examples in gitgub was helpful.
  • I had hard time implementing the form for creating recurrance in my templates. For example, in the documentation to the package, it is said that you should create a form like that:
from django import forms
from .models import Course

class EventForm(forms.ModelForm):
   class Meta:
      model = Event
      fields = ('event_name', 'recurrences',)

That didn’t work, and returned an error. After more github searches, I found that decleration that worked:

from django import forms
from .models import Event

class EventForm(forms.ModelForm):

    class Meta:
        model = Event
        exclude = []

Again, the documentation just show limited code examples, and I was left to figure some new concepts, such as forms. Fortunatly I found this great tutorial about creating forms a to z.

  • While the above tutorial was great, I still had issues – the redirect from the event creation to an event detail page after creation didn’t work. After many trails and errors, I found that the way I need to call a view accross the project is not only using it name, but also the app name, in the form of :.
  • Now to be honest, there is a section in the django tutorial that speaks into that previous point…

Accepting, merging and deploying a pull request

Checklist for merging a push request and deploying to heroku:
1. Accept the PR request
2. Merge PR request into master
3. Pull the version to my local:
~/path/to/project(master)$ git pull [remote] master

This will override my local with the current version in the remote (either GitHub or bitbucket).

  1. Push master to heroku:
    ~/path/to/project(master)$ git push heroku master

Many times I need to…

Many times I need to suggest times when I’m available. What I then need to do is go to my calendar, see what slots are available and manually get the dates and times and put it together in a reply. Very often I’m making a mistake, getting the date or the time wrong.

I want to be able to see my calendar, click on a certain time slot, and have it ready in my clipboard, so I can paste it wherever I want.

I would like to be able to do it in Python.

There’s a workflow in the workflows app, called “share availability”, that’s doing something similar. I might be able to use it as reference.


Hello there. This is going…

Hello there. This is going to be my developer logs, ie dlog.

Using pyenv with virtualenv and pip cheat sheet

I need to remember this checklist…


I made some notes on how to use a specific python version with pyenv and using virtualenv to manage packages.

using pyenv



$ git clone https://github.com/yyuu/pyenv.git ~/.pyenv


$ export PYENV_ROOT="$HOME/.pyenv"
$ export PATH="$PYENV_ROOT/bin:$PATH"
$ eval "$(pyenv init -)"

use command completion

$ source ~/.pyenv/completions/pyenv.bash

(homebrew on mac)

$ mkdir ~/pyenv/completions
$ cp /usr/local/Cellar/pyenv/20150601/completions/pyenv.bash ~/.pyenv/completions/pyenv.bash

use pyenv to install python versions

$ pyenv install 2.7.10
$ pyenv install 3.4.3

choose a python version with pyenv

$ pyenv shell PYENV_VERSION=2.7.10

upgrade pyenv

$ cd ~/.pyenv; git pull

(homebrew on mac)

$ brew upgrade pyenv

run `pyenv rehash` when you install a new python or binary package

$ pyenv rehash

install pyenv-pip-rehash to rehash automatically when you use pip

(as pyenv plugin)

$ git clone https://github.com/yyuu/pyenv-pip-rehash.git ~/.pyenv/plugins/pyenv-pip-rehash

(homebrew on mac)

$ brew install homebrew/boneyard/pyenv-pip-rehash

install pyenv-virtualenv

$ git clone https://github.com/yyuu/pyenv-virtualenv.git ~/.pyenv/plugins/pyenv-virtualenv

intialize pyenv-virtualenv

$ eval "$(pyenv virtualenv-init -)"

(homebrew on…

View original post 39 more words