parse json string
function to parse the string text into json format
- django
- json
- templatetags
- utils
- parser
function to parse the string text into json format
Django Template Filter that parse a tweet in plain text and turn it with working Urls Ceck it on [GitHub](https://github.com/VincentLoy/tweetparser-django-template-filter) # tweetParser Django Template Filter this is a port of [tweetParser.js](https://github.com/VincentLoy/tweetParser.js) to work as a Django template filter ## How does it work ? Once installed, just : ``` <p>{{ your_tweet|tweetparser }}</p> ``` ## Installation Take a look at the [Django Documentation](https://docs.djangoproject.com/en/1.8/howto/custom-template-tags/) #### You can change the classes given to each anchor tags ``` USER_CLASS = 'tweet_user' URL_CLASS = 'tweet_url' HASHTAG_CLASS = 'hashtag' ```
Позволяет получить типизированный словарь из входных параметров. Может быть использован, например, для дальнейшей передаче параметров в objects.filter(**rez).
This is a function based on django's urlize modified to show different media based on their url. It supports images, links, mp3/ogg links, youtube videos, vimeo videos and dailymotion videos. I added a switch called mini to have two modes to show things in different places. When mini is activated it will only parse the first url provided and discard the rest as well as limiting the height.
The default Django urlize filter does not work with html nicely so here I've used an HTML parser [BeautifulSoup](http://www.crummy.com/software/BeautifulSoup/) to quickly search through each text node and run the django urlize filter on it. Optimizations could be made to include a regex in the soup.findAll() method's text argument to only search those text nodes which matched a url pattern. You could also modify the method to convert the text to urls, such as using your own custom url filter.
This FloatField replacement allows users to enter math expressions, such as: 4/5 + sqrt(32) And will evaluate them safely when the field's clean() function is called. In the example above, it will evaluate to a float value of about 6.457. Reference: [http://lybniz2.sourceforge.net/safeeval.html](http://lybniz2.sourceforge.net/safeeval.html) The available functions are listed herein. Note that the from __future__ import division causes integer division expressions to be evaluated as floats. For example "1/2" evaluates as 0.5 when it would otherwise have evaluated to 0 (assuming Python 2.X).
This one uses - and is very similar to - http://www.djangosnippets.org/snippets/852/ It gets the data from a pledgie.com campaign and parses it.
7 snippets posted so far.