I'm in the process of settings up a website (I'm using DJango) to begin selling some toys I build and need a way of calculating shipping costs for my customers.
Are there any (preferably free) shipping calculators which accept a customers address and return the cost for different delivery companies / delivery options?
It would be nice ...
How can I serialize a python Dictionary to JSON and pass back to javascript, which contains a string key, while the value is a List (i.e. [])
if request.is_ajax() and request.method == 'GET':
groupSet = GroupSet.objects.get(id=int(request.GET["groupSetId"]))
groups = groupSet.groups.all()
group_items = [] #list
groups_and_...
I have a model
class Article(models.Model):
.
.
language = models.ForeignKey(Language, help_text="Select the article's language")
parent_article = models.ForeignKey('self', null=True, blank=True)
If an article is an original article then 'parent_article=None'. If an article is a translation then 'parent_article' <> Non...
I have model with a Foreign Key to itself like this:
class Concept(models.Model):
name = models.CharField(max_length=200)
category = models.ForeignKey('self')
But I can't figure out how I can select all concepts that have nonzero children value. Is this possible with django QuerySet API or I must write custom SQL?
...
I'm building a form (not modelForm) where i'd like to use the SelectMultiple Widget to display choices based on a query done during the init of the form.
I can think of a few way to do this but I am not exactly clear on the right way to do it. I see different options.
I get the "choices" I should pass to the widget in the form init but...
We are currently installing the latest version of Django and Python on IIS6. We have followed the instructions on the following site:
http://code.djangoproject.com/wiki/DjangoOnWindowsWithIISAndSQLServer
We are receiving a 403 error when trying to access our Django application via the IIS server.
We have verified the python installati...
I have an app which works well live on AppEngine.
However, when I try to run it locally with the dev_appserver.py, it aborts within ~1 second with:
~/ dev_appserver.py --debug_imports myapp
/opt/local/share/google_appengine/google/appengine/api/datastore_file_stub.py:40: DeprecationWarning: the md5 module is deprecated; use hashlib ...
Hi Guys,
I've been finding my way around Django and jQuery. I've built a basic form in Django. On clicking submit, I'm using jQuey to make an AJAX request to the sever to post my data. This bit seems to work fine and I've managed to save the data. Django returns a ValidatioError when a form is invalid. Could anyone tell me how to retur...
Trying to solve a problem with templatetags.
I have two templatetags:
@register.inclusion_tag('directory/_alphabet.html')
def alphabet_list(names):
""" Return a list of letters that last names start with. """
return { 'letters': [name.last_name[0] for name in names] }
class NameNode(template.Node):
def __init__(self, lette...
I am having difficulties with forms, specifically ModelMultipleChoiceField.
I've pieced together this code from various examples, but it sadly doesn't work.
I would like to be able to:
Search for some Works on work_search.html
Display the results of the search, with checkboxes next to each result
Select the Works I want, via the che...
I am trying to get some test coverage for a Django-CMS implementation I'm working on and I'm unsure how to unit test plugins/extensions. Has anyone done this before, and if so, how? Some examples would be awesome.
...
Ok, I have a hardcoded string I declare like this
name = u"Par Catégorie"
I have a # -- coding: utf-8 -- magic header, so I am guessing it's converted to utf-8
Down the road it's outputted to xml through
xml_output.toprettyxml(indent='....', encoding='utf-8')
And I get a
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3...
A form will be spitting out an unknown number of questions to be answered. each question contains a prompt, a value field, and a unit field. The form is built at runtime in the formclass's init method.
edit: each questions receives a unique prompt to be used as a label, as well as a unique list of units for the select element.
this s...
So, I'm basing my code on Trey's solution on:
http://solutions.treypiepmeier.com/2009/12/10/using-jquery-autocomplete-with-django/
The script is:
<script>
$(function() {
$('#id_members').autocomplete('{{ object.get_absolute_url }}members/lookup', {
dataType: 'json',
width: 200,
...
i have an app in GAE, but i have no idea about how to use django session, although i know the app-engine-patch may be helpful. who can give me a demo how to use it for session? thank you!
...
I use django on webfaction, and I've got a "MySql query taking too long" message,
the sql is
SELECT (1) AS `a` FROM `main_userprofile` WHERE `main_userprofile`.`id` = 98
This is a rather simple sql, why the query taken too long?
here it is the 'create table':
main_userprofile | CREATE TABLE `main_userprofile` (
`id` int(11) NOT...
I've looked at several questions here that looked similar, but none of them discussed the problem from the perspective of admin panel.
I need to check if user has permission to leave a field empty. I wanted to use request.user but I don't knot how to pass request from EntryAdmin to ModelForm. I wanted to do something like this:
class E...
My initial question was here and was related to the postgres backend. http://stackoverflow.com/questions/2408965/postgres-subquery-ordering-by-subquery
Now my problem has moved onwards to the Django ORM layer. I essentially want to order a query by a postgres function ('idx', taken from the above stackoverflow work)
I've gone through t...
Hi,
I'm wondering what is the best time to register a font for use in reportlab. I added the following line into my settings.py:
pdfmetrics.registerFont(TTFont('Calibri', FONT_DIR + '/fonts/Calibri.ttf'))
After this call the font is available for pdf generation. But it occurs that after a few days the font is not available anymore an...
Hi,
How do I make syncdb execute SQL queries (for table creation) defined by me, rather then generating tables automatically.
I'm looking for this solution as some particular models in my app represent SQL-table-views for a legacy-database table.
So, I've created their SQL-views in my django-DB like this:
CREATE VIEW legacy_series AS S...