In Django, I've got a Checkout model, which is a ticket for somebody checking out equipment. I've also got an OrganizationalUnit model that the Checkout model relates to (via ForeignKey), as the person on the checkout belongs to an OrganizationalUnit on our campus.
The OrganizationalUnit has a self relation, so several OUs can be the ch...
I cannot find which part of code print the "+" that is close to every foreign key field.
In fieldset.html there is only the call to {{ field.field }}, but in the file django/forms/widgets.py the code that prints the select, doesn't contain that code, so I suppose that there is a piece of code that manage the foreign key: where is it?
...
I just migrated my dev environment from Ubuntu Linux to Mac OSX snow leopard. All of this was working on Linux. On both, I have used MySQL for Django's db.
Django's reset function is not issuing drop commands for all of my app's models. Here is my models.py (with the Forum and User object fields removed for brevity):
from django.db imp...
function ajaxCall(query){
$.ajax({
method:"get",
url:"/main/",
data:"q="+query,
beforeSend:function() {},
success:function(html){
$("#main").html(html);
}
});
};
This is the entire code that will populate #main:
<p>{{ num_results }}, you just searched for {{ query }}</p>
Suppose I have another div...
Struggling with an install of GAE-Patch and using my stylesheets. My settings.py has the following lines included already, but the media generator is not compiling and packaging it properly:
'combined-%(LANGUAGE_DIR)s.css': (
'global/look.css',
),
'combined-%(LANGUAGE_DIR)s.css': (
'global/base-%(LANGUAGE_DIR...
Anyway to make a field conditionally required based on whether or not another field in the same form has been filled out?
If field1 has no data, but field2 does
form is valid.
If field1 has no data and field2 has no data
form is invalid
Not looking for any javascript solutions. I feel as it should be solved with django for...
How do i set the html attribute "tabindex" on form fields?
My template currently looks like..
<div class="field text username">
<label>Email Address</label>
{{ form.email }}
</div>
...
All,
I have the following in my views.py
def getgradeform(request):
id1=request.user.get_pf().id
sc=Sc.objects.filter(id=id1)
logging.debug(sc)
logging.debug("++++")
dict={}
dict.update({'sc': sc})
return render_to_response('content/add.html',dict)
Logging.debug gives an output as [<sc: Robert>]
My question is t...
I have this line in my wsgi.conf file:
WSGIScriptAlias /trunk "c:/app/trunk/app.wsgi"
Inside of my django settings file, I need to know the alias "/trunk" to get LOGIN_URL to work properly. How can I retrieve this value from my apache settings?
Thanks!
Pete
...
I'm attempting to use django-mptt with very little luck. This is with Python2.5, windows, sqlite3, Django 1.2pre , django-mptt latest from svn.
The code:
model:
class Node(models.Model):
name = models.CharField(max_length=20, blank=True)
parent = models.ForeignKey('self', null=True, blank=True, related_name='children')
...
<a href={% url home %}></a>
i can't find {% url %} in django api
...
I'm trying to set up a custom backend that queries another database, for which I have created a model in the system. It uses its own rules (email instead of username, and a differently salted/hashed password) so I can't use built in authentication. I've set up a custom authentication backend like so:
class BlahBlahBackend:
def chec...
Have django serving different settings file & database based on subdomains. The virtual host entries are manually added to apache.
There are currently two subdomains with different databases. First one is working okay, the second one is not displaying any css/images.
Apache configuration is as, there are two of them
<VirtualHost *:8...
I've got a list of objects (properties for rent, in this case) that I am listing, the list needs to be filterable by a handful of criteria (max price, area, n_bedrooms ...) and I figured I could do it like this:
(r'^price:(?P<price_min>\d+)?-(?P<price_max>\d+)?/$', property_list)
This works, and allows urls like price:300-600/ to do t...
All,
This is the request from the template that i get
u'subjects': [u'7', u'4', u'5', u'3', u'2', u'1']
In my views how to extract the values like 7 4 5 3 2 1
How do i extract the above sequence from
new_subjects=request.POST.get('subjects')
Thanks.
...
I want to change the way that the "+" icon for the foreign key in the admin site is shown.
I found that the widget that prints the code is RelatedFieldWidgetWrapper that is in django/contrib/admin/widgets.py.
So I wrote my version of this class and I changed its render function.
But now how can I use it? I mean... in the definition of...
I have a django admin interface and in the model listing I want a custom column that will be a hyperlink using one of the fields values. Basically one of the models' fields is a url and i'd like the column to have that URL in a clickable hyperlink. This link will need to have additional URL prepended to it as its a relative path in the...
I have a haystack search which has the following SearchIndex:
class GrantIndex(indexes.SearchIndex):
"""
This provides the search index for the Grant application.
"""
text = indexes.CharField(document=True, use_template=True)
year = indexes.IntegerField(model_attr='year__year')
date = indexes.DateField(model_att...
Given a model
class Template(models.Model):
colour = models.CharField(default="red", blank = True, null=True)
How can I arrange it so that any access to colour either returns the value stored in the field, or if the field is blank/null then it returns red?
The default=red will put "red" in the field when it's first created, but i...
Hi All,
I have a models in Django that are something like this:
class Classification(models.Model):
name = models.CharField(choices=class_choices)
...
class Activity(models.Model):
name = models.CharField(max_length=300)
fee = models.ManyToManyField(Classification, through='Fee')
...
class Fee(models.Model):
activity = m...