All you have to do is select the field you want to display as link and then change the code from:

<xsl:value-of select="@VariableName"></xsl:value-of>

to

<xsl:value-of select="@VariableName" display-output-escaping="yes"></xsl:value-of>

This works in SharePoint 2010, if you’re on 2013 you should use the following (notice the closing tag):

<xsl:value-of select="@AssignedTo" disable-output-escaping="yes" />

Thanks to Ryan Tate for pointing it out.

This code will generate a Form based on an already existing Model. In Django this is called ModelForm and is a useful feature if you want to quickly create a form that saves data into a database.

Create a model (database table): models.py

from django.db import models
class Regions(models.Model):
    region = models.CharField(max_length=50)
    ...
    def __unicode__(self):
        return self.region

Create a form from the model (ModelForm): forms.py

from ApplicationName.models import Regions
class AddRegionForm(forms.ModelForm):
    class Meta:
        model = Regions

Create a view that will use the form and model: views.py

def add_region(request):
    # if the form is submitted save the new item
    if request.method == 'POST':
        form = AddRegionForm(request.POST)
        if form.is_valid():
            # either you define the fields
            region = Regions(region=form.cleaned_data['region'])
            region.save()
            # or you just save the whole form
            region = form.save()
    # fetch all the regions from the table, ordered by name asc
    regions = Regions.objects.order_by('region')
    context = ({ 'regions': regions })
    # render the template
    return render(request, 'applicationname/regions.html', context)

References:
https://docs.djangoproject.com/en/dev/ref/forms/fields/
https://docs.djangoproject.com/en/dev/ref/request-response/
http://www.djangobook.com/en/2.0/chapter07.html

You are going to need this in case you want to allow users creating an account to input more than just their username and password.

Import everything you need: forms.py

from django.contrib.auth.forms import UserCreationForm
from django import forms
from django.contrib.auth.models import User

And your class that uses the UserCreationForm class (still in forms.py)

class RegisterForm(UserCreationForm):
    # declare the fields you will show
    username = forms.CharField(label="Your Username")
    # first password field
    password1 = forms.CharField(label="Your Password")
    # confirm password field
    password2 = forms.CharField(label="Repeat Your Password")
    email = forms.EmailField(label = "Email Address")
    first_name = forms.CharField(label = "Name")
    last_name = forms.CharField(label = "Surname")

    # this sets the order of the fields
    class Meta:
        model = User
        fields = ("first_name", "last_name", "email", "username", "password1", "password2", )

    # this redefines the save function to include the fields you added
    def save(self, commit=True):
        user = super(UserCreateForm, self).save(commit=False)
        user.email = self.cleaned_data["email"]
        user.first_name = self.cleaned_data["first_name"]
        user.last_name = self.cleaned_data["last_name"]

    if commit:
        user.save()
        return user