VBoxManage clonevdi /Original.vdi /NewCopy.vdi
Once that is done be sure to re-attach the original vdi.
VBoxManage clonevdi /Original.vdi /NewCopy.vdi
User.add_to_class('new_field', models.BooleanField(default=False))
from django.contrib.auth.admin import UserAdminVoilĂ , with that done, you're new fields should show up in the auth user on the django admin page.
UserAdmin.list_display += ('new_field',)
UserAdmin.list_filter += ('new_field',)
UserAdmin.fieldsets[1][1]['fields'] = ('first_name','last_name','email','new_field')
A little background, all my projects are usually named 'backend', with the front end code (usually flash) in a separate directory 'frontend'. So for example in settings.py, I install apps in django by adding 'backend.app' to INSTALLED_APPS. Anyway, after commenting out huge chunks of code I eventually turned to one of the last things I could turn to to start commenting stuff out. So things Amongst the urlpatterns I found a line (r'^app/', include('backend.urls')). Some how, after the find-replace session, this line was setup to constantly reference the urls.py that it resided in, which resulted in the error stated above.
TemplateSyntaxError at /admin/ Caught an exception while rendering: maximum recursion depth exceeded
TypeError: not enough arguments for format string
"%s,%s,%s" % ('foo','bar')
"%s has 42% of the shares." % ('Bob')
regex1 = re.compile('%(?![\(])')I say roughly since if you're starting to run into these kinds of situations, you really need to start using a templating engine like jinja or mako. I'll switch to mako in the future.
regex2 = re.compile('%%+')
cooked_html = regex1.sub('%%', regex2.sub('%', raw_html))
;;; iterating over files in dired
;;; usage example - for-each-dired-marked-file returns a filename and path
;;; for each marked file, so this is what a function using it looks like
(defun view-stuff(filename)
"opens up the file and gets the length of it, then messages the result"
(let (fpath fname mybuffer len)
(setq fpath filename)
(setq fname (file-name-nondirectory fpath))
(setq mybuffer (find-file fpath))
(setq len (buffer-size))
(kill-buffer mybuffer)
(message "Buffer length %d %s" len (buffer-file-name mybuffer))))
; Usage example
(defun test-for-each-dired-marked-file()
(interactive)
(for-each-dired-marked-file 'view-stuff))
(defun for-each-dired-marked-file(fn)
"Do stuff for each marked file, only works in dired window"
(interactive)
(if (eq major-mode 'dired-mode)
(let ((filenames (dired-get-marked-files)))
(mapcar fn filenames))
(error (format "Not a Dired buffer \(%s\)" major-mode))))