I have a django queryset in my views whose values I pack before passing to my template. There is a problem when the queryset returns none since associated values are not unpacked. the quersyet is called comments.
Here is my views.py
def forums(request ):
post_list = list(forum.objects.filter(child='0')&forum.objects.filter(deleted=...
which framework helps in reducing the number of lines of code needed to create a web app?
ruby on rails?
php?
asp.net mvc?
jsp/servlet?
django/python?
I just don't like typing a lot of code especially if it's boilerplate. If I can write 10 lines of code versus 100 to get the same results, I think most people would prefer 10...right? ...
I'm trying to build a better/more powerful form class for Django. It's working well, except for these sub-forms. Actually, it works perfectly right after I re-start apache, but after I refresh the page a few times, my HTML output starts to look like this:
<input class="text" type="text" id="pickup_addr-pickup_addr-pickup_addr-id-pickup_...
I have a factory method that generates django form classes like so:
def get_indicator_form(indicator, patient):
class IndicatorForm(forms.Form):
#These don't work!
indicator_id = forms.IntegerField(initial=indicator.id, widget=forms.HiddenInput())
patient_id = forms.IntegerField(initial=patient.id, widget=for...
Hi folks,
I need to redirect a user to an external site though a POST request.
The only option I figured out is to do it submit a form through JavaScript.
Any ideas?
...
Hi folks,
I'm trying to build a small stress test script to test how quickly a set of requests gets done.
Need to measure speed for 100 requests.
Problem is that I wouldn't know how to implement it, as it would require parallel url requests to be called.
Any ideas?
...
Django's post_save signal behaves weirdly with models using multi-table inheritance
I am noticing an odd behavior in the way Django's post_save signal works when using a model that has multi-table inheritance.
I have these two models:
class Animal(models.Model):
category = models.CharField(max_length=20)
class Dog(Animal):
co...
I am having trouble doing a reverse URL lookup for Django-generated feeds.
I have the following setup in urls.py:
feeds = {
'latest': LatestEntries,
}
urlpatterns = patterns('',
# ...
# enable feeds (RSS)
url(r'^feeds/(?P<url>.*)/$', 'django.contrib.syndication.views.feed',
{'feed_dict': feeds}, name='feeds_vie...
{% for d in mydata %}
{{ d.title }}
{% endfor %}
However, I would like the first one to be bolded. How can I use the loop to say...if the d is the first one, then bold it?
...
how to explicitly set django_langauge in django session?
Thanks a lot...
...
Guys i would like to use Django as my backend framework and qooxdoo as the frontend framework.
Is it practical to do this?
Has anyone tried to do this?
How did they do it?
Links and pointers would nice.
Gath
...
Hi !
I'm currently doing a firewall management application for Django, here's the (simplified) model :
class Port(models.Model):
number = models.PositiveIntegerField(primary_key=True)
application = models.CharField(max_length=16, blank=True)
class Rule(models.Model):
port = models.ForeignKey(Port)
ip_source = models.IPA...
In Rails ERB, you can suppress newlines by adding a trailing hyphen to tags:
<ul>
<% for @item in @items -%>
<li><%= @item %></li>
<% end -%>
</ul>
becomes:
<ul>
<li>apple</li>
<li>banana</li>
<li>cacao</li>
</ul>
Is there a way to do this in Django? (Disclosure: I'm generating a csv file with Django)
Edit: Cla...
D:\zjm_code\basic_project>python manage.py syncdb
Error: One or more models did not validate:
topics.topic: Accessor for field 'content_type' clashes with related field 'Cont
entType.topic_set'. Add a related_name argument to the definition for 'content_t
ype'.
topics.topic: Accessor for field 'creator' clashes with related field 'User.c...
I'm using jQuery validation system for client-side validation. The backend works with django.
jQuery use an interesting set of rules in JSON format.
Does exists something to use the same rules on django side or I need to code it myself?
...
I need to get an App Engine app talking to and sharing data with an external database,
The best option i can come up with is outputting the external database data to an xml file and then processing this in my app engine app and storing it inside the datastore,
although the data being shared is sensitive data such as login details so ou...
How to query Employee to get all the address related to the employee, Employee.Add.all() does not work..
class Employee():
Add = models.ManyToManyField(Address)
parent = models.ManyToManyField(Parent, blank=True, null=True)
class Address(models.Model):
address_emp = models.CharField(max_length=512)
description = mo...
I'd like to construct a multipart request, with the following parameters: name (string), email (string), and fileupload (file). I'm using the Java code below (working in Android).
The httppost.getRequestLine() prints
POST http://www.myurl.com/upload HTTP/1.1
So everything looks good on the client site, but my server (Django/Apache)...
I am trying to capture the selected item in a Dijit Tree widget to render remaining part of the web page. Here is the code that captures the selected item and sends it to Django backend:
<div dojoType="dijit.Tree" id="leftTree" store="leftTreeStore" childrenAttr="folders" query="{type:'folder'}" label="Explorer">
<script typ...
/mysite/project4
class notes(models.Model):
created_by = models.ForeignKey(User)
detail = models.ForeignKey(Details)
Details and User are in the same module i.e,/mysite/project1
In project1 models i have defined
class User():
......
class Details():
......
When DB i synced there is an error saying
Error:...