Set the permissions of all the files to 664 (current directory and all subdirectories)
find . -type f -exec chmod 664 {} +

Set the permissions of all the directories to 775 (same as above)
find . -type d -exec chmod 775 {} +

You can already find this process on other sites around the web, but it was only in a comment I found out that this only works with default forms (and not with custom made forms created by you). This is why you need to edit NewForm.aspx, DispForm.aspx or EditForm.aspx.

Also, to be able to use this you must be a Site Collection administrator.

This is done using prototype.js and SPUtility.

Click here to see the code.

To test only one condition, <xsl:if></xsl:if> is used.

<xsl:if test="price > 10">
        <td><xsl:value-of select="title"/></td>
        <td><xsl:value-of select="artist"/></td>

To express multiple conditional tests you should use a combination of <xsl:choose> and <xsl:when>.

    <xsl:when test="price>'10'">
        <td bgcolor="#ff00ff">
            <xsl:value-of select="artist"/>
            <xsl:value-of select="artist"/>

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>


<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.

Adding this code to LocalSettings.php will allow you to upload different filetypes to your wiki.

$wgFileExtensions = array_merge( $wgFileExtensions, array( 'pdf', 'ppt', 'doc', 'docx', 'xls', 'xlsx' ) );

To allow uploads you also need to change the owner of the folder to www-data.

# type in shell
chown -R www-data /var/www/wiki/images/


A short snippet that will delete records from the database. The deletion will occur when you visit the delete_id/somenumber/ url (defined inside, which will trigger the delete_view function (also defined inside, delete the record from the database ( and redirect to the /redirect-url/ (defined inside

Add an url:

url(r'^delete_id/(?P<id_to_delete>d+)$', 'delete_view'),

Create a view that will delete the record:

def delete_view(request, id_to_delete):
    return HttpResponseRedirect("/redirect-url/")


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):

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):

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

Create a view that will use the form and model:

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'])
            # or you just save the whole form
            region =
    # 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)


If you are going to use the auth module that Django provides, you will most likely want to let your users add additional information about them. In Django you do this by extending the Profile model and activating it in the settings file.

Extend the Profile model:

from django.contrib.auth.models import User
class Profile(models.Model):
    user       = models.ForeignKey(User, unique=True)
    address    = models.CharField(max_length=150)
    city       = models.ForeignKey(Cities)
    telephone  = models.CharField(max_length=100)
    birthday   = models.DateField()

Edit the Settings file:

AUTH_PROFILE_MODULE = "ApplicationName.Profile"

Add your new Views:

user_profile = request.user.get_profile()
    address = user_profile.address

Create a Template: profile.html

{{ user.get_profile.address }}
# if this doesn't work try 
# user.get_profile().address or 
# request.user.get_profile.address or
# request.user.get_profile().address


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:

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

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) = self.cleaned_data["email"]
        user.first_name = self.cleaned_data["first_name"]
        user.last_name = self.cleaned_data["last_name"]

    if commit:
        return user