Login

Snippets by nosrednakram

Snippet List

ContentType Form

When working with the ContentType model there are generally two issues. 1. Models are listed in the table but not imported. 2. Unicode only returns model not application so being able to select a a app/model is sometimes difficult when to applications have a model with the same name. This snippet gets a listing of imported models and creates a drop down for selection. I also included a function that uses the returned from to get and save the correct ContentType within the primary model.

  • form
  • contenttype
Read More

OracleAuthBackend

This code uses oracle as an authentication back end. It creates a new connection to the db and attempts to login. If successful it will then create an upper case User account with _ORACLE appended to the username. My urls.py call: from django.conf.urls.defaults import * urlpatterns = patterns('', (r'^accounts/login/$', 'django.contrib.auth.views.login', {'template_name': 'login.html'}), ) My setting.py specific settings: AUTHENTICATION_BACKENDS = ( 'oracleauth.views.OracleAuthBackend', ) LOGIN_URL = '/accounts/login/' ORACLE_CONNECT = 'database-host:1521/database' DEBUG=True

  • authentication
  • oracle
  • login
  • auth
  • backend
Read More

Media Wiki With mwlib

### Simple wiki with MediaWiki and Markdown Support Once you install the mwlib you can use mwit to convert Mediawiki markup to HTML. I am include the model that uses it to hopefully provide a good example. I maintain a version and only one copy of each wiki entry in the main table and archive replaced markup into another table, you will need to create the archive model or remove that section of code. The line ending changes in mwit are so that it will work with IE.

  • markup
  • markdown
  • mediawiki
  • wiki
  • archive
Read More

nosrednakram has posted 3 snippets.