Dylan Verheul

  • Archive
  • RSS

A ModelAdmin for a slightly customized Django User model

This ModelAdmin will add your extra fields to the bottom of the page:

from __future__ import unicode_literals

from django.contrib import admin
from django.contrib.auth.admin import UserAdmin
from django.contrib.auth.models import AbstractUser
from django.utils.translation import ugettext_lazy as _

from .models import User


class UserAdminWithExtraFields(UserAdmin):

    def __init__(self, *args, **kwargs):
        super(UserAdminWithExtraFields, self).__init__(*args, **kwargs)

        abstract_fields = [field.name for field in AbstractUser._meta.fields]
        user_fields = [field.name for field in self.model._meta.fields]

        self.fieldsets = self.fieldsets + (
            (_('Extra fields'), {
                'fields': [field for field in user_fields if field not in abstract_fields and field != self.model._meta.pk.name],
            }),
        )


admin.site.register(User, UserAdminWithExtraFields)
    • #django
  • 1 week ago
  • Comments
  • Permalink
Share

Short URL

TwitterFacebookPinterestGoogle+

Sublime Text 2 and Markdown: Tips, Tricks, and Links

    • #sublime
  • 2 months ago
  • Comments
  • Permalink
Share

Short URL

TwitterFacebookPinterestGoogle+

Exit Posterous, Enter Tumblr

Since Posterous is shutting down, I’m moving to Tumblr. It’s virtually impossible to move the old content from Posterous over here, so it looks like a fresh start is the best way to go. The url http://blog.dyve.net will point to this location soon.

  • 3 months ago
  • Comments
  • Permalink
Share

Short URL

TwitterFacebookPinterestGoogle+

josh mcarthur - Sublime Text 2: Do not reopen files

go to ‘Preferences’ -> ‘Settings - User’, and add the following keys:

"hot_exit": false,
"remember_open_files": false

If you haven’t already added any user settings, these two lines will need to be surrounded by curly braces - { and }.

via joshmcarthur.com

Excellent tip. And I agree with Josh that automatically reopening all files it closed with is bad practice for a text editor.

    • #JustMigrate
    • #sublime
  • 3 months ago
  • Comments
  • Permalink
Share

Short URL

TwitterFacebookPinterestGoogle+

Django Context Processors Best Practice

Add this at the top of your settings.py file:

import django.conf.global_settings as DEFAULT_SETTINGS

Then extend the default context processors:

TEMPLATE_CONTEXT_PROCESSORS = DEFAULT_SETTINGS.TEMPLATE_CONTEXT_PROCESSORS + (
"myapp.context_processors.example",
"myapp.context_processors.other_example",
# etc...
)
via blog.madpython.com
    • #JustMigrate
    • #django
  • 4 months ago
  • Comments
  • Permalink
Share

Short URL

TwitterFacebookPinterestGoogle+

Use MacHeist bundle for your existing Evernote account

After asking aorund on Twitter how this would work, I found this information, which explains that you can use the codes from MacHeist to fund your existing Evernote Premium account. Here’s how:

  • Go to http://evernote.com/partner/retail/
  • Enter your code
  • A button “Existing Account: will appear, click it and log in
  • Press “Go Premium”
  • Repeat the process for the second code.

It worked for me, and it should work for you. $29 for 15 months of Evernote Premium alone is a sweet deal, and since 25% of the MacHeist bundle price goes to charity, what are you waiting for?

    • #JustMigrate
    • #evernote
    • #macheist
  • 7 months ago
  • Comments
  • Permalink
Share

Short URL

TwitterFacebookPinterestGoogle+

Transfer Chat History From Lion to Mountain Lion Messages

If you are seeing empty chat history in Mountain Lion Messages, this may help you out:

  1. Close Messages
  2. Open Finder
  3. Navigate to ~/Documents/iChats
  4. Select all (cmd-A), Copy (cmd-C)
  5. Navigate to ~/Library/Messages/Archive (you may need to use Shift-Cmd-G)
  6. Paste (cmd-V)
  7. Start Messages and see your history
      • #JustMigrate
      • #chat
      • #lion
      • #mac
      • #messages
      • #mountain lion
    • 9 months ago
    • Comments
    • Permalink
    Share

    Short URL

    TwitterFacebookPinterestGoogle+

    Uninstalling Picasa Web Albums iPhoto Plugin

    Google used to publish a plugin for iPhoto that added an export option to Picasaweb. Since I don’t use that service anymore, I wanted to delete the plugin. However, the instructions to remove it did not work. Apparently, the plugin changed locations somewhere between Tiger and Mountain Lion.

    A little investigating revealed the correct location in Mountain Lion, to remove the Picasa Web Albums Exporter, follow these steps:
    1. Close iPhoto 
    2. sudo rm /Library/Application Support/iPhoto/PlugIns/PicasaWebAlbums.iPhotoExporter 
    3. Start iPhoto 

    Done!

      • #JustMigrate
      • #google
      • #iphoto
      • #mac
      • #picasa
    • 9 months ago
    • Comments
    • Permalink
    Share

    Short URL

    TwitterFacebookPinterestGoogle+

    Fixing Python, virtualenv and pip on Mountain Lion

    If you are a developer on OS X using Python, pip, or virtualenv, you will probably see errors after the upgrade to Mountain Lion. Here’s a fix:
    1. Install or reinstall Command Line Tools
    Some people report that using the direct download works better than installing via Xcode. I don’t use Xcode so I went for the aforementioned link.
    2. Install or reinstall pip and virtualenv
    Start terminal and type:
    sudo easy_install pip
    sudo pip install virtualenv
    sudo pip install virtualenvwrapper

    This worked for me. Some people report more trouble. If you aren’t up and running after this, please look at this longer blog post by Martin Brochhaus.

      • #JustMigrate
      • #mac
      • #pip
      • #programming
      • #python
      • #virtualenv
    • 9 months ago
    • Comments
    • Permalink
    Share

    Short URL

    TwitterFacebookPinterestGoogle+

    Sparrow for iPhone on sale

    Sparrow will be $0.99 for 2 days. On Tuesday & Wednesday.

    It will then go up to $1.99 on Thursday

    Before getting back to its original price of $2.99 on Friday


    Grab your copy now

    via blog.sparrowmailapp.com

      • #JustMigrate
    • 11 months ago
    • Comments
    • Permalink
    Share

    Short URL

    TwitterFacebookPinterestGoogle+
    Page 1 of 20
    ← Newer • Older →

    Logo

    About

    Co-creator of a website that gathers over 10 million nature observations per year. Open source author and contributor.

    Find Me On

    • @dyve on Twitter
    • Facebook Profile
    • dyve on Flickr
    • Linkedin Profile
    • dyve on github

    Twitter

    loading tweets…

    • RSS
    • Random
    • Archive
    • Mobile
    Effector Theme by Pixel Union