Giter Site home page Giter Site logo

django / djangosnippets.org Goto Github PK

View Code? Open in Web Editor NEW
411.0 411.0 87.0 1.09 MB

The code that powers djangosnippets.org, it allows users to post and share useful "snippets" of code.

Home Page: https://djangosnippets.org

License: BSD 3-Clause "New" or "Revised" License

Python 44.46% JavaScript 22.84% HTML 26.03% Ruby 0.27% CSS 2.23% Dockerfile 0.11% SCSS 3.95% Shell 0.10% Procfile 0.02%

djangosnippets.org's Introduction

Django

Django is a high-level Python web framework that encourages rapid development and clean, pragmatic design. Thanks for checking it out.

All documentation is in the "docs" directory and online at https://docs.djangoproject.com/en/stable/. If you're just getting started, here's how we recommend you read the docs:

  • First, read docs/intro/install.txt for instructions on installing Django.
  • Next, work through the tutorials in order (docs/intro/tutorial01.txt, docs/intro/tutorial02.txt, etc.).
  • If you want to set up an actual deployment server, read docs/howto/deployment/index.txt for instructions.
  • You'll probably want to read through the topical guides (in docs/topics) next; from there you can jump to the HOWTOs (in docs/howto) for specific problems, and check out the reference (docs/ref) for gory details.
  • See docs/README for instructions on building an HTML version of the docs.

Docs are updated rigorously. If you find any problems in the docs, or think they should be clarified in any way, please take 30 seconds to fill out a ticket here: https://code.djangoproject.com/newticket

To get more help:

To contribute to Django:

To run Django's test suite:

Supporting the Development of Django

Django's development depends on your contributions.

If you depend on Django, remember to support the Django Software Foundation: https://www.djangoproject.com/fundraising/

djangosnippets.org's People

Contributors

alexander-ae avatar barttc avatar brylie avatar carltongibson avatar chriswedgwood avatar coleifer avatar daniboygg avatar dependabot-preview[bot] avatar dependabot[bot] avatar dplanella avatar felixxm avatar gostich avatar hashlash avatar jefftriplett avatar jezdez avatar lucassd avatar manaswinidas avatar markush avatar ppmdo avatar rixx avatar santos22 avatar sijanonly avatar stephrdev avatar timgraham avatar vivekthedev avatar zerok avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

djangosnippets.org's Issues

Flag button doesn't work

Yesterday, a lot of spam showed up in the RSS feed. After logging in I cannot flag it as spam (that is what I assume the triangle does, it could use a help text). The error that I get is:
Invalid form submission
(the error message could use some CSS to make it clearer, I didn't see it at first)

Voting the snippet down results in a 500 error.

No fixtures available for snippets when onboarded

As a developer when I get onboarded I would like to have a fixture that sets up 20+ meaningful sample snippets
with varied languages and versions that gives me a sense of how the site operates and I don't have to manually create any.

View Snippets Error [snippet_detail.html]

Hi, I have spent some time now configuring Django-cab to work with a new website I am developing. So far I have gotten the site mostly functional, with auth logins, and I have used the admin to create a snippet. However I have an issue with viewing the Hello World snippet.

TemplateSyntaxError at /snippets/1/
Caught UnboundLocalError while rendering: local variable 'searcher' referenced before assignment

n template /home/matteius/shared_projects/api_website/api_website/cab/templates/cab/snippet_detail.html, error at line 17
Caught UnboundLocalError while rendering: local variable 'searcher' referenced before assignment7 {% block title %}{{ object.title }}{% endblock %}
8
9 {% block content_header %}{{ object.title }}{% endblock %}
10
11 {% block content %}
12 {{ object.highlighted_code|safe }}
13


14

More like this


15 {% cache 600 mlt object.pk %}
16

    17 {% for related in object|more_like_this:5 %}
    18
  1. {{ related.object.title }} by {{ related.object.author.username }}
    19 {{ related.object.pub_date|timesince }} ago
    20

  2. 21 {% endfor %}
    22

23 {% endcache %}
24

25 {% endblock %}
26
27 {% block sidebar %}

/home/matteius/.virtualenvs/api_website/src/haystack/haystack/backends/whoosh_backend.py in more_like_this
searcher.close()

I did have another issue too when I removed the offending code in the template, however just now I checked and it was resolved, possibly due to specifying a different version of the django tagit depedency, or perhaps it was missing all together. Well this is my current issue has to do with haystack search, and if I remove the offending code the snippet doesn't show up at all?!?

Increase in spam in the past few weeks

It seems as if there is a lot of new spam coming in from people using Twitter (IIUC) to sign up for djangosnippets. I would suggest to increase the bar for submission by

  1. adding recaptcha
  2. allowing signup only for users with verified email addresses

@carltongibson @felixxm @stephrdev Does anyone have some spare cycles to take a look at this?

More like this

More like this doesn't seem to be working on my cloned version of your site. Your comment on my first more like this post on this subject suggests that more like this depends on solr. http://charlesleifer.com/blog/search-on-djangosnippetsorg/ suggests the same.

Can more like this be made to work without solr? How? (create a cachetable? add middleware clasess? something else?)

"Internal error" when I try to create account

I want to leave a comment on a Django Snippet on djangosnippets.org, which requires logging in. I don't currently have an account, but as I don't see a button for creating an account, I tried the log in buttons. Here's what happened with the various log in methods:

  • BitBucket: "Social Network Login Failure. An error occurred while attempting to login via your social network account."
  • GitHub: "There's been an internal error on the server; it probably wasn't anything you did, so don't worry too much about it. The site administrators have been emailed with the details, and they'll probably get it fixed real soon."
  • Reset password with my email address which currently doesn't have an account: "There's been an internal error on the server; it probably wasn't anything you did, so don't worry too much about it. The site administrators have been emailed with the details, and they'll probably get it fixed real soon."
  • Logging in with my email (which hasn't been registered) and a random keyboard mash password returns me to the login page without even a message like "log in failed"
  • I haven't tried Twitter yet.

I have not received any emails from Django Snippets after these registration attempts.

If it is intentional that you can't create an account, it would probably be good to clarify this and make the error messages more informative.

The FAQ says "I've done my best to make signing up as easy as possible", linking to https://djangosnippets.org/accounts/register/, but that is a dead link.

About setup

Can you Update some docs to describe the setup steps.Thanks a lot

Creating a snippet sometimes leads to a 'can't pickle function object' error

Our local installation has shown some strange behaviour when creating a snippet for the HTML/template language. After filling in all the forms, the following stack trace occurs:

Environment:


Request Method: POST
Request URL: https://[local.djangosnippets]/snippets/add/

Django Version: 1.5.4
Python Version: 2.7.6
Installed Applications:
('django.contrib.auth',
 'django.contrib.admin',
 'django.contrib.comments',
 'django.contrib.contenttypes',
 'django.contrib.flatpages',
 'django.contrib.markup',
 'django.contrib.messages',
 'django.contrib.sessions',
 'django.contrib.staticfiles',
 'django.contrib.sites',
 'cab',
 'cab.comments',
 'comments_spamfighter',
 'haystack',
 'pagination',
 'ratings',
 'registration',
 'south',
 'taggit',
 'captcha',
 'ecstatic')
Installed Middleware:
('django.middleware.cache.UpdateCacheMiddleware',
 'django.middleware.common.CommonMiddleware',
 'django.middleware.cache.FetchFromCacheMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware',
 'django.contrib.flatpages.middleware.FlatpageFallbackMiddleware',
 'pagination.middleware.PaginationMiddleware')


Traceback:
File "/var/lib/wwwrun/.virtualenvs/djangosnippets/lib/python2.7/site-packages/django/core/handlers/base.py" in get_response
  115.                         response = callback(request, *callback_args, **callback_kwargs)
File "/var/lib/wwwrun/.virtualenvs/djangosnippets/lib/python2.7/site-packages/django/contrib/auth/decorators.py" in _wrapped_view
  25.                 return view_func(request, *args, **kwargs)
File "/var/lib/wwwrun/.virtualenvs/djangosnippets/src/cab/cab/views/snippets.py" in edit_snippet
  80.             snippet = form.save()
File "/var/lib/wwwrun/.virtualenvs/djangosnippets/lib/python2.7/site-packages/django/forms/models.py" in save
  370.                              fail_message, commit, construct=False)
File "/var/lib/wwwrun/.virtualenvs/djangosnippets/lib/python2.7/site-packages/django/forms/models.py" in save_instance
  87.         instance.save()
File "/var/lib/wwwrun/.virtualenvs/djangosnippets/src/cab/cab/models.py" in save
  96.         super(Snippet, self).save(*args, **kwargs)
File "/var/lib/wwwrun/.virtualenvs/djangosnippets/lib/python2.7/site-packages/django/db/models/base.py" in save
  546.                        force_update=force_update, update_fields=update_fields)
File "/var/lib/wwwrun/.virtualenvs/djangosnippets/lib/python2.7/site-packages/django/db/models/base.py" in save_base
  664.                                    update_fields=update_fields, raw=raw, using=using)
File "/var/lib/wwwrun/.virtualenvs/djangosnippets/lib/python2.7/site-packages/django/dispatch/dispatcher.py" in send
  170.             response = receiver(signal=self, sender=sender, **named)
File "/var/lib/wwwrun/.virtualenvs/djangosnippets/lib/python2.7/site-packages/haystack/signals.py" in handle_save
  48.                 index.update_object(instance, using=using)
File "/var/lib/wwwrun/.virtualenvs/djangosnippets/lib/python2.7/site-packages/haystack/indexes.py" in update_object
  274.                 backend.update(self, [instance])
File "/var/lib/wwwrun/.virtualenvs/djangosnippets/lib/python2.7/site-packages/haystack/backends/whoosh_backend.py" in update
  208.             writer.commit()
File "/var/lib/wwwrun/.virtualenvs/djangosnippets/lib/python2.7/site-packages/whoosh/writing.py" in commit
  1040.             self.writer.commit(*args, **kwargs)
File "/var/lib/wwwrun/.virtualenvs/djangosnippets/lib/python2.7/site-packages/whoosh/writing.py" in commit
  935.         self._commit_toc(finalsegments)
File "/var/lib/wwwrun/.virtualenvs/djangosnippets/lib/python2.7/site-packages/whoosh/writing.py" in _commit_toc
  882.         toc.write(self.storage, self.indexname)
File "/var/lib/wwwrun/.virtualenvs/djangosnippets/lib/python2.7/site-packages/whoosh/index.py" in write
  693.                     pickle.dumps(field)
File "/usr/lib64/python2.7/copy_reg.py" in _reduce_ex
  70.             raise TypeError, "can't pickle %s objects" % base.__name__

Exception Type: TypeError at /snippets/add/
Exception Value: can't pickle function objects

After some code-digging and debug-output parsing, it seems that it's trying to pickle the following schema:


schema  
<Schema: ['author', 'bookmark_count', u'django_ct', u'django_id', u'id', 'language', 'pub_date', 'rating_score', 'tag_list', 'tags', 'text', 'title', 'url', 'version']>

... and fails at the 'author' field. Since fixing or doing more research would extend beyond the scope of our need for the tool, we simply monkeypatched the write function of the TOC class at whoosh.index.TOC to not raise the exception when it happens and continue as if nothing happened. So far, the fix works as expected:

#[Line 687 in whoosh/index.py]
        try:
            stream.write_string(pickle.dumps(schema, -1))
        except pickle.PicklingError:
            # Try to narrow down the error to a single field
            for fieldname, field in schema.items():
                try:
                    pickle.dumps(field)
                except pickle.PicklingError:
                    e = sys.exc_info()[1]
                    raise pickle.PicklingError("%s %s=%r" % (e, fieldname, field))
            # Otherwise, re-raise the original exception
            raise

In case you look into it and need more info, don't hesitate to contact me!

feeds by tag

Another feature not working in django 1.2.4:

tag feeds

I've investigated a little but it's not making much sense to me.

cab.feeds.SnippetsByTagFeed contains this method

def items(self, obj):
    return Snippet.objects.matches_tag(obj.slug)[:15]

Going up the chain I found that 1.2.4 defines

class QuerySet(object):
    """
    Represents a lazy database lookup for a set of objects.
    """
    def __init__(self, model=None, query=None, using=None):
        self.model = model
        # EmptyQuerySet instantiates QuerySet with model as None
        self._db = using
        self.query = query or sql.Query(self.model)
        self._result_cache = None
        self._iter = None
        self._sticky_filter = False
        self._for_write = False

etc.

while an older version defines

class QuerySet(object):
    """
    Represents a lazy database lookup for a set of objects.
    """
    def __init__(self, model=None, query=None):
        self.model = model
        self.query = query or sql.Query(self.model, connection)
        self._result_cache = None
        self._iter = None
        self._sticky_filter = False

etc.

Notice self._db = using is defined...I suspect this value is required for the objects.matches_tag to work, but the I can't fathom what the value might be.

Suggestions?

Comment captchas are hard to read

It took some attempts for me to recognize that there's a math question being asked, but even then it's quite hard to read the numbers.

Add an api

I'm working on the Repos.io site, which allow users to search for and manage repositories, and i would add a backend for django-snippets, which is very usefull.

I could write it myself and add a pull-request but i currently have no time for it (lot of code to do for Repos.io), i just add it as a reminder or if someone has time :)

This api should handle registration (via oauth ?), and at least read access for various objects, and bookmarks (idealy it should allow to add/remove bookmarks)

All of this can be done with piston (never did it but i heard about it)

Project framing

Hey Charlie, maybe this project should be framed more as the source code for djangosnippets.org rather than a reusable app. Just my two cents :)
thanks for your work on this.

Rest User

Hi,

could you please reset my user account guettli

I created a snippet several years ago: https://djangosnippets.org/snippets/646/

I would like to update the text to:


You can use the pytest-django setting FAIL_INVALID_TEMPLATE_VARS

The invaild vars get checked if pytest executes the code.

[pytest]
DJANGO_SETTINGS_MODULE = mysite.settings
FAIL_INVALID_TEMPLATE_VARS = True

My old email-address [email protected] does not exist any more.

Undescribed snippet_text.txt

In the install notes and in the git repo, I don't see any reference to snippet_text.txt or more precisely:

templates/search/indexes/cab/snippet_text.txt

which seems to be required for haystack. I went ahead and created that template so haystack indexing runs now, but I don't know what the contents of that file should be. Can you help?

Note that I created a fork of your repo so that I could update the templates to suite our site. In that fork I have added various further updates to the install process. See

https://github.com/qgis/qgis-snippets/blob/master/README.rst

Thanks!

Regards

Tim

Master brach now failing [ AttributeError: 'ParsedRequirement' object has no attribute 'req']

The master build is now failing on travis during requirements installation but has not changed for some time
and it was green before.

Collecting python-akismet==0.4.1
Downloading python-akismet-0.4.1.tar.gz (9.8 kB)
ERROR: Command errored out with exit status 1:
command: /home/travis/virtualenv/python3.7.1/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-r3yi32yh/python-akismet/setup.py'"'"'; file='"'"'/tmp/pip-install-r3yi32yh/python-akismet/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-g7h787s2
cwd: /tmp/pip-install-r3yi32yh/python-akismet/
Complete output (7 lines):
Traceback (most recent call last):
File "", line 1, in
File "/tmp/pip-install-r3yi32yh/python-akismet/setup.py", line 186, in
install_requires = [str(ir.req) for ir in requirements]
File "/tmp/pip-install-r3yi32yh/python-akismet/setup.py", line 186, in
install_requires = [str(ir.req) for ir in requirements]
AttributeError: 'ParsedRequirement' object has no attribute 'req'

Search always empty

The search field on the site always gives "No matching snippets found.".

Even if I search for generic terms like class or enumeration or something I copy from the snippets listed on the homepage.

More like this

After looking at a couple of dozen snippets at djangosnippets.org, I noticed that nothing shows up under the More Like This heading directly below the snippet. I would expect a list of snippets of some kind there.

Flag Form should be accessible via GET

Right now you can only flag a snippet from within the details page using a POST request. If the user requests the flag URL via GET a form should be rendered.

ported over from django-cab repo

Use Postgres search instead of elastic search

I think dropping elasticsearch would be a nice optimisation. (The main pro of ES is ingest rate: it’s much faster than postgres at pulling in new records: but we’re nowhere near needing that.)

Carlton Gibson

duplicated snippets because of internal error

I got this error
"There's been an internal error on the server; it probably wasn't anything you did, so don't worry too much about it. The site administrators have been emailed with the details, and they'll probably get it fixed real soon."

So I retried the operation

The result is I have multiple duplicated snippets
But I can't remove the duplicates

https://djangosnippets.org/users/depaolim/

Please remove the duplicates and possibly add a remove-button available to the user

Cannot upload new snippets

You cannot upload new snippets - it just says "Please correct the errors below:" but then lists no errors below.

I haven't done anything fancy with my input that would be an obvious cause of failure. The only thing I can think of is that I have left the "Version" as "Not specified", because 1.9 isn't an available option, and I left "Tags" blank.

snippet_detail.html

Django 1.2.4 found errors in snippet_detail.html. Two occurences of request.user in snippet_detail.html had to be replaced with user.

{% if object|is_bookmarked:request.user %}

{% with object|rating_score:request.user as rating_score %}

had to be changed to

{% if object|is_bookmarked:user %}

{% with object|rating_score:user as rating_score %}

Registration fails

I registered (as 'earthspike') and immediately received the activation email. Clicking on the URL gave:

Your account was not activated

There was an error creating this account. Perhaps your registration key expired, in which case please re-register.


I attempted to re-register as 'earthspike' only to be told that the username was now taken. I then repeated the exercise with the username 'earthspike1' and got the same result (activation link supplied but would not activate the account). I also attempted cutting/pasting the link from Thunderbird to Firefox but with the same results.

Both attempts were made around 0120 UTC on 14 Apr 12.

How to install a complete version of http://djangosnippets.org/?

Hi, I have a complete newbie question:
After following the installation instruction in the Readme file, the Django snippets is running on my laptop now. However, "Log in", "register", "about" "search" etc are not functional.
I added one line to the urls.py of my project:
" (r'.*', include('cab.urls.snippets')), "

I cheched cab/urls/snippets.py and didn't find any pattern match "/accounts/login/" or "/about/"
Did I doing something wrong? If I want to have a website identical to http://djangosnippets.org/ what should I do?

old snippet of mine only accessible through direct link (and causes other weird issues)

About a year ago, I uploaded a snippet to the site. I wanted to find it today to use for a project, but couldn't find it through the search. So I logged in (it required confirmation again - which was weird, but reasonable considering I haven't visited in a long while). I couldn't find it. I kept looking and nothing.

Luckily, I had saved the link somewhere, so I fished it out. Here it is:
https://djangosnippets.org/snippets/3019/

So the snippet does exist! However, trying to bookmark it (for example) returns an error. I'm guessing other operations won't work either.

Django 1.5 Support?

I'm getting my site ready for Django 1.5 and djangosnippets is out of date. Is anybody working on this?

Comments – bad sanitization

djangosnippets puts <p> tags as a text, even though comment doesn't contain them. And doesn't preserve line breaks, all content is put in one line:
zrzut ekranu z 2016-09-14 o 09 22 41

Would you like help?

Hi I just listened to the Django Chat podcast and would like to get involved in some kore open source work.
I would be happy to give this project some time. Is there anything that you would like done or a new piece of functionality added?

AttributeError at /

Commit ID: b3b07f3

Djangosnippets is giving Attribute error when trying over access at port 8000 even after following all the instructions in the Readme.

Full trace is listed here

Environment:


Request Method: GET
Request URL: http://localhost:8000/

Django Version: 1.8.15
Python Version: 2.7.6
Installed Applications:
('django.contrib.auth',
 'django.contrib.admin',
 'django_comments',
 'django.contrib.contenttypes',
 'django.contrib.flatpages',
 'django.contrib.messages',
 'django.contrib.sessions',
 'django.contrib.staticfiles',
 'django.contrib.sites',
 'allauth',
 'allauth.account',
 'allauth.socialaccount',
 'allauth.socialaccount.providers.bitbucket',
 'allauth.socialaccount.providers.github',
 'allauth.socialaccount.providers.twitter',
 'cab',
 'comments_spamfighter',
 'haystack',
 'pagination',
 'ratings',
 'taggit',
 'captcha')
Installed Middleware:
('django.middleware.security.SecurityMiddleware',
 'django.middleware.common.CommonMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware',
 'django.contrib.flatpages.middleware.FlatpageFallbackMiddleware',
 'pagination.middleware.PaginationMiddleware',
 'ratelimitbackend.middleware.RateLimitMiddleware',
 'django.contrib.auth.middleware.SessionAuthenticationMiddleware')


Template error:
In template /opt/djangosnippets.org/djangosnippets/templates/homepage.html, error at line 14
   'SafeText' object has no attribute '_default_manager'

   4 : {% block bodyclass %}frontpage{% endblock %}



   5 : {% block head_title %}Welcome{% endblock %}



   6 : 



   7 : {% block content_header %}Welcome{% endblock %}



   8 : 



   9 : {% block sidebar %}



   10 :   {% load cache %}



   11 :   {% cache 600 homepage %}



   12 :   <h2>Latest snippets posted:</h2>



   13 :   <ul>



   14 :    {% for snippet in "cab.snippet"|latest:5 %} 



   15 :     <li><a href="{{ snippet.get_absolute_url }}">{{ snippet.title }}</a> (<a href="{{ snippet.language.get_absolute_url }}">{{ snippet.language.name }}</a>) by <a href="{{ snippet.author.get_absolute_url }}">{{ snippet.author.username }}</a> {{ snippet.pub_date|timesince }} ago</li>



   16 :   {% endfor %}



   17 :   </ul>



   18 : 



   19 :   <h2>Top-rated snippets:</h2>



   20 :   <ol>



   21 :   {% for snippet in "cab.snippet"|call_manager:"top_rated"|slice:":5" %}



   22 :     <li><a href="{{ snippet.get_absolute_url }}">{{ snippet.title }}</a> (<a href="{{ snippet.language.get_absolute_url }}">{{ snippet.language.name }}</a>) by <a href="{{ snippet.author.get_absolute_url }}">{{ snippet.author.username }}</a></li>



   23 :   {% endfor %}



   24 :   </ol>


Traceback:
File "/opt/virts/snippets/local/lib/python2.7/site-packages/django/core/handlers/base.py" in get_response
  132.                     response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/opt/djangosnippets.org/djangosnippets/urls.py" in <lambda>
  19.     url(r'^$', lambda request: render(request, 'homepage.html'), name='home'),
File "/opt/virts/snippets/local/lib/python2.7/site-packages/django/shortcuts.py" in render
  67.             template_name, context, request=request, using=using)
File "/opt/virts/snippets/local/lib/python2.7/site-packages/django/template/loader.py" in render_to_string
  99.         return template.render(context, request)
File "/opt/virts/snippets/local/lib/python2.7/site-packages/django/template/backends/django.py" in render
  74.         return self.template.render(context)
File "/opt/virts/snippets/local/lib/python2.7/site-packages/django/template/base.py" in render
  210.                     return self._render(context)
File "/opt/virts/snippets/local/lib/python2.7/site-packages/django/template/base.py" in _render
  202.         return self.nodelist.render(context)
File "/opt/virts/snippets/local/lib/python2.7/site-packages/django/template/base.py" in render
  905.                 bit = self.render_node(node, context)
File "/opt/virts/snippets/local/lib/python2.7/site-packages/django/template/debug.py" in render_node
  79.             return node.render(context)
File "/opt/virts/snippets/local/lib/python2.7/site-packages/django/template/loader_tags.py" in render
  135.         return compiled_parent._render(context)
File "/opt/virts/snippets/local/lib/python2.7/site-packages/django/template/base.py" in _render
  202.         return self.nodelist.render(context)
File "/opt/virts/snippets/local/lib/python2.7/site-packages/django/template/base.py" in render
  905.                 bit = self.render_node(node, context)
File "/opt/virts/snippets/local/lib/python2.7/site-packages/django/template/debug.py" in render_node
  79.             return node.render(context)
File "/opt/virts/snippets/local/lib/python2.7/site-packages/django/template/loader_tags.py" in render
  65.                 result = block.nodelist.render(context)
File "/opt/virts/snippets/local/lib/python2.7/site-packages/django/template/base.py" in render
  905.                 bit = self.render_node(node, context)
File "/opt/virts/snippets/local/lib/python2.7/site-packages/django/template/debug.py" in render_node
  79.             return node.render(context)
File "/opt/virts/snippets/local/lib/python2.7/site-packages/django/templatetags/cache.py" in render
  48.             value = self.nodelist.render(context)
File "/opt/virts/snippets/local/lib/python2.7/site-packages/django/template/base.py" in render
  905.                 bit = self.render_node(node, context)
File "/opt/virts/snippets/local/lib/python2.7/site-packages/django/template/debug.py" in render_node
  79.             return node.render(context)
File "/opt/virts/snippets/local/lib/python2.7/site-packages/django/template/defaulttags.py" in render
  155.                 values = self.sequence.resolve(context, True)
File "/opt/virts/snippets/local/lib/python2.7/site-packages/django/template/base.py" in resolve
  675.                 new_obj = func(obj, *arg_vals)
File "/opt/djangosnippets.org/cab/templatetags/core_tags.py" in latest
  20.         manager = model_or_obj._default_manager

Exception Type: AttributeError at /
Exception Value: 'SafeText' object has no attribute '_default_manager'

Installation procedure issue

I kept notes on where I had to do things not listed in your readme which I attach as a diff below.

I am still getting an unresolved error (see below) which I dont have a solution for yet and would appreciate any hints. Will write back if I figure it out myself.

Regards

Tim

========================= DIFF =========================

diff --git a/README.rst b/README.rst
index 2f08222..7699378 100644
--- a/README.rst
+++ b/README.rst
@@ -49,7 +49,7 @@ from somewhere on your Python path::
 
 Then add ``cab`` to the ``INSTALLED_APPS`` setting of your Django
 project, run ``manage.py syncdb``, and either put a call to
-``include('cab.urls')`` somewhere inn your root URLConf or copy over
+``include('cab.urls.snippets')`` somewhere inn your root URLConf or copy over
 the URL patterns from Cab that you want to use.
 
 Note that the ``get_absolute_url`` methods of the ``Language``,
@@ -65,6 +65,20 @@ them with Django's ``ABSOLUTE_URL_OVERRIDES`` setting.
 .. _django-haystack: http://github.com/toastdriven/django-haystack/
 .. _django-amazon-resources: http://github.com/coleifer/django-amazon-resources/
 
+For search support you need to set up a search engine and configure haystack:
+
+``HAYSTACK_SITECONF = 'search_sites'``
+``HAYSTACK_SEARCH_ENGINE = 'whoosh'``
+``# Place where search indexes are stored for snippets - should be non web accessible``
+``HAYSTACK_WHOOSH_PATH = '/some-path/search-index'``
+
+And you should add a file called ``search_sites.py`` to your project with the 
+following lines:
+
+``import haystack``
+``haystack.autodiscover()``
+
+
 
 Templates
 =========

================== UNRESOLVED ERROR ===================

TemplateSyntaxError at /snippets/2/

'ratings_tags' is not a valid tag library: Template library ratings_tags not found, tried django.templatetags.ratings_tags,django.contrib.admin.templatetags.ratings_tags,django_sorting.templatetags.ratings_tags,pagination.templatetags.ratings_tags,django.contrib.humanize.templatetags.ratings_tags,django.contrib.comments.templatetags.ratings_tags,django.contrib.markup.templatetags.ratings_tags,cab.templatetags.ratings_tags

Request Method:     GET
Request URL:    http://qgis-django.localhost/snippets/2/
Django Version:     1.2.3
Exception Type:     TemplateSyntaxError
Exception Value:    

'ratings_tags' is not a valid tag library: Template library ratings_tags not found, tried django.templatetags.ratings_tags,django.contrib.admin.templatetags.ratings_tags,django_sorting.templatetags.ratings_tags,pagination.templatetags.ratings_tags,django.contrib.humanize.templatetags.ratings_tags,django.contrib.comments.templatetags.ratings_tags,django.contrib.markup.templatetags.ratings_tags,cab.templatetags.ratings_tags

Exception Location:     /home/web/qgis-django/python/lib/python2.6/site-packages/django/template/defaulttags.py in load, line 928
Python Executable:  /usr/bin/python
Python Version:     2.6.6
Python Path:    ['/home/web/qgis-django/python/lib/python2.6/site-packages/distribute-0.6.10-py2.6.egg', '/home/web/qgis-django/python/lib/python2.6/site-packages/pip-0.7.2-py2.6.egg', '/home/web/qgis-django/python/lib/python2.6/site-packages/django_amazon_resources-0.1.0-py2.6.egg', '/home/web/qgis-django/python/lib/python2.6/site-packages/cab-0.2.0-py2.6.egg', '/home/web/qgis-django/python/lib/python2.6/site-packages', '/home/web/qgis-django/python/lib/python2.6/site-packages/PIL', '/usr/lib/python2.6', '/usr/lib/python2.6/plat-linux2', '/usr/lib/python2.6/lib-tk', '/usr/lib/python2.6/lib-old', '/usr/lib/python2.6/lib-dynload', '/usr/lib/python2.6/dist-packages', '/usr/lib/python2.6/dist-packages/PIL', '/usr/lib/python2.6/dist-packages/gst-0.10', '/usr/lib/pymodules/python2.6', '/usr/lib/python2.6/dist-packages/gtk-2.0', '/usr/lib/pymodules/python2.6/gtk-2.0', '/usr/lib/python2.6/dist-packages/wx-2.8-gtk2-unicode', '/home/web/qgis-django', '/home/web/qgis-django/qgis']
Server time:    Sat, 11 Dec 2010 06:39:09 -0600

NAVBAR and Background

HI
I have some suggestions regarding navbar and background.

  1. Currently, the navbar is quite small, It should be changed.It should be made a bit more long (height++). We can use icons to make it look good. It should have a color code that depicts message visually
    • RED COLOR NAVBAR means you are currently not logged in
    • GREEN COLOR NAVBAR means you are logged in
    • USERNAME logo can also be used for this purpose.If logo is without tick, it means you are not logged in and if tick, means l
      logged in
      2)We can improve background to make it user friendly. WE can create a theme toggling button , or simply create a javascript that detects user's timezone and according to it, changes theme to light or dark,

Implementing these changes will make website look better adding to user experience.
I would like to work on there issues ( if allowed )

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.