Django: How can I put an <a> hyperlink in a django validation error from a forms clean() method? I want to raise a validation error, and in the error text have an <a href=""></a> hyperlink that has a link that would help the user correct the error. This is a validation error I'm raising in a clean method of a form. Is there a way to m...
Alright, this is probably a really silly question but I am new to Python/Django so I can't really wrap my head around its scoping concepts just yet. Right now I am writing a middleware class to handle some stuff, and I want to set 'global' variables that my views and templates can access. What is the "right" way of doing this? I consider...
So far, I've had great success using PyAMF to communicate between my Flex front-end and my Django back-end. However, I believe I've encountered a bug. The following example (emphasis on the word "example") demonstrates the (potential) bug:
My Flex app contains the following VO:
package myproject.model.vo
{
[Bindable]
[RemoteC...
I am debugging a problem in Django with Pydev.
I can set breakpoint in my django project code with out a problem.
However I can't set breakpoints in the Django library source code (in site-packages).
The PyDev debugger user interface in this case simply does nothing when I click to set the breakpoint and does not break at that locatio...
I need to create an inline formset which
a) excludes some fields from MyModel being displayed altogether
b) displays some some fields MyModel but prevents them from being editable.
I tried using the code below, using values() in order to filter the query set to just those values I wanted returned. However, this failed.
Anybody wit...
Alright, I have a Django view, like this:
@render_to('home/main.html')
def login(request):
# also tried Client.objects.select_related().all()
clients = Client.objects.all()
return {'clients':clients}
And I have a template, main.html, like this:
<ul>
{% for client in clients %}
<li>{{ client.full_name }}</li>
<ul>
...
I am trying to validate a form, such that if IP of user (request.META['REMOTE_ADDR']) is in a table BlockedIPs, it would fail validation. However I don't have access to request variable in Form. How do I do it? Thanks.
...
I need to retrieve institution name by going through an intermediate table. My view gets all the values except this one or at least it is not displaying in the template. Can someone please help with either revising my view or template statement?
http://dpaste.com/122204/
Thank you,
May
...
Hello, I'm in the progress of learning Django at the moment but I can't figure out how to solve this problem on my own. I'm reading the book Developers Library - Python Web Development With Django and in one chapter you build a simple CMS system with two models (Story and Category), some generic and custom views together with templates f...
Hello,
I am currently having the problem that when I use the login_required decorator from django.contrib.auth.decorators on any of my views, my POST parameters do not arrive at the protected view whenever the decorator did redirect (to the login page) and back again to the protected view. Suggestions about how to work around this (pre...
This question is somewhat linked to a question I asked previously:
http://stackoverflow.com/questions/477183/generating-and-submitting-a-dynamic-number-of-objects-in-a-form-with-django
I'm wondering, if I've got separate default values for each form within a formset, am I able to pre-populate the fields? For instance, a form requiring ...
I have a table of Students and a table of Courses that are connected through an intermediate table to create a many-to-many relationship (ie. a student can enroll in multiple courses and a course can have multiple students). The problem is that the client wants a unique student ID per course. For example:
rowid Course Student ID (c...
MODEL:
class Pathology(models.Model):
pathology = models.CharField(max_length=100)
class Publication(models.Model):
pubtitle = models.TextField()
class Pathpubcombo(models.Model):
pathology = models.ForeignKey(Pathology)
publication = models.ForeignKey(Publication)
List of pathology sent to HTML template as drop dow...
I am trying to debug a problem with a django view. When I run it on the command line.
I don't get any of these messages. However when I run the it in the PyDev debugger i get these error messages. I am running with the --noreload option.
What do these error messages mean?
Why do I not get them when I run it on the command line?
/Syste...
I'm in need of integrating a django application with a visually intuitive google-maps interface, for the purpose of radio dispatched security guards/emt's.
I'm already using GeoDjango, although it appears it may be a bit overkill for the specific use. At any rate it's already making the geospatial processing on the server as easy as ...
I'm building a support ticket tracking app and have a few models I'd like to create from one page. Tickets belong to a Customer via a ForeignKey. Notes belong to Tickets via a ForeignKey as well. I'd like to have the option of selecting a Customer (that's a whole separate project) OR creating a new Customer, then creating a Ticket and fi...
I have a Django my_forms.py like this:
class CarSearchForm(forms.Form):
# lots of fields like this
bodystyle = forms.ChoiceField(choices=bodystyle_choices())
Each choice is e.g. ("Saloon", "Saloon (15 cars)"). So the choices are computed by this function.
def bodystyle_choices():
return [(bodystyle.bodystyle_name, '%s...
I have a manytomany relationship between publication and pathology. Each publication can have many pathologies. When a publication appears in the admin template, I need to be able to see the many pathologies associated with that publication. Here is the model statement:
class Pathology(models.Model):
pathology = models.CharField(...
I want to show a title and description from a db query in each form, but I don't want it to be in a charfield, I want it to be html-formatted text.
sample template code:
{% for form, data in zipped_data %}
<div class="row">
<div class="first_col">
<span class="title">{{ data.0 }}</span>
<div class="desc">
...
I'm developing in Django on Windows XP using the manage.py runserver command to serve files. Apache isn't involved. When I login to the administration and try to delete a file I get a "SuspiciousOperation" error.
Here's the traceback:
http://dpaste.com/123112/
Here's my full model:
http://dpaste.com/hold/123110/
How can I get rid of ...