Django - Can't register a tag library
<p>Disclaimer: I'm a Django (and Python) beginner.</p>

<p>I've currently got a TemplateSyntaxError, where in order to use my Model's data in my template, I need to apparently register and load it first as a new tag. I've tried to do that in several ways but can never escape an error.</p>

<p>Here's my setup:</p>

<p>My folder structure:</p>

<ul>
<li>appapp

<ul>
<li>migrations</li>
<li>templates

<ul>
<li>index.html</li>
</ul></li>
<li>templatetags

<ul>
<li>__init__.py</li>
<li>invite.py</li>
</ul></li>
<li>__init__.py</li>
<li>admin, views, models, urls etc</li>
</ul></li>
</ul>

<p>urls.py</p>

<pre><code>urlpatterns = [
    url(r'^(?P&lt;code&gt;[0-9]+)/$', findCode, name='index'),
]
</code></pre>

<p>views.py</p>

<pre><code>def findCode(request, code):
    invite = get_object_or_404(Invite, code=code)
    temp = loader.get_template('appapp/index.html')
    context = {
        'invite': invite,
    }
    return HttpResponse(temp.render(context, request))
</code></pre>

<p>models.py</p>

<pre><code>class Invite(models.Model):
    code = models.CharField(max_length=6, default=code_generator(4))
    group_name = models.CharField(max_length=200)

    def __str__(self):
        return self.group_name
</code></pre>

<p>index.html</p>

<pre><code>{% if invite %}
    {% invite.group_name %}
{% endif %}
</code></pre>

<p>Any help would be hugely appreciated.</p>