Get email and push on couchdb - utils
Check email and save
- couchdb
- couchdbkit
- imap
Check email and save
view/admin.py ` def reactor(request): context = { 'email': read_mailbox() } return render_to_response(_lookup_template('dashboard'), context, context_instance=RequestContext(request)) ` **_Design all.js** ` function (doc) { if (doc.doc_type == 'MailArchive') { emit(doc._id, doc); } } ` **reduce.js** `_count`
This is the code we use on bandtastic.me to build a html that sends users to dineromail to pay with. This code builds a form thats ready to send multiple items.
I use this snippet to save images to my imagefields on django models. This uses the very awesome requests library, so install it first pip install requests You probably want to have this be done on a celery queu, if the image is big enough.
This is in my opinion a better way to have flat pages in a project. In the example with the url patterns settings: / will render -> /pages/welcome.html /contact will render -> /pages/contact.html /products/ will render -> /pages/products/index.html /products/pricing will render -> /pages/products/pricing.html
Function and usage in views and template with django-paypal to have encrypted paypal buttons with a cart(adding multiple elements). All credits go to Jon Atkinson, http://jonatkinson.co.uk/paypal-encrypted-buttons-django/ I just added it here with a complete implementation using a cart(his example didnt include it). I know there is some redundancy in the data passed to the dict and the submit form, i'm just not sure what can i take out, the paypal docs are not clear about it, if you test this code without some of the data and it works, please tell me. The key parts are the cmd _s-xclick and again the cmd '_cart' both are needed.
The problem with Django's default Radio button widget is that it puts the buttons in a vertical format and the documentation is somewhat silent on how to make them horizontal. If you are dealing with a long list of buttons then veritical is probably the way to go but if you are dealing with "YES/NO" situation or any other boolean choice then you will probably want them horizontal. Basically I just took the code and even the explanation from here: https://wikis.utexas.edu/display/~bm6432/Django-Modifying+RadioSelect+Widget+to+have+horizontal+buttons
If you read the docstring and the example you should get a clue what this Code does. I didn't want a big function everytime that handles every specific form, formset combinations so this how i can add/edit Models with specific Forms given to the magic_handle_inlineformsets function. It also works for Forms without innline_formsets.
This custom test suite runner will record all of the URLs accessed during your test suite. It will compare it to the list of all URLs you have configured for your site and produce a report of any URLs missed. It requires that all URLs are named (using the ``name=`` parameter). To use is, set the ``TEST_RUNNER`` variable in your configuration to this class. You can also define ignored URLs. For example, to filter out the admin URLs, you can use: IGNORED_COVERAGE_URLS = ['^admin/', '^admin/doc/']
This code is for set one register on admin if exist more than 1 register you can not delete it or add more. Only set mymodel
Management command to update a primary key and update all child-tables with a foreign key to this table.
This function downloads selected rows to CSV file. The snippet is based on snippet 1697 and 2020. This function downloads all columns given in the list_display, including callable items.
1) Install django-extensions (requires werkzeug) 2) Paste snippet into settings.py 3) manage.py runserver_plus Now you should be able to open files in textmate by clicking the file links in the werkzeug error pages. It will also take you to the correct line number and highlight files that are in your project directory in a different color.
Whoops just an alternative implementation of UpdateView
Multiple database router that allows setting the target database for each model by setting the `in_db` field in its `Meta` class.
2955 snippets posted so far.