veni vidi Scripsi

Oh no! I've Forgotten my Django Admin Password!

And here's how to reset it if you can still reach the in­stal­la­tion via SSH or similar.

Start a Django shell:

python shell

Use the following code to change the password:

from django.contrib.auth.models import User
u = User.objects.get(username__exact='[username]')
u.set_password('[fill in new password here]')

That's all!


TinyMCE in one of multiple Textarea fields in Admin

When I was working with Django the other day I had a model which contained 3 textareas (models.TextField()). I only wanted 2 of the 3 to use TinyMCE for mark-up in the Admin. I worked out how to achieve this and here’s a quick guide.

  1. Install TinyMCE as explained in an earlier post.

  2. Make sure the tiny_mce folder, the one you downloaded from, is also in your site-media javascript folder (/[site­me­di­a]/js/tiny_mce/) or change TINYM­CE_JS_URL in your to the correct folder.

  3. In your define what you want the default tinymce to look like, for example: