This is starting bug me: whenever I use the django admin to add or edit a record, I hit save and expect a confirmation page, but the result is a page that tells me the website is experiencing an error (it's not a Django page with a traceback, just a default view in my browser). If I hit reload or back in the browser, it takes me back to ...
I'm sure I've seen this question on Stack Overflow before, but I couldn't find it by my life, so here goes nothing.
I have a normal Django menu which uses the {% url %} tag and static names for the menu items. Now I want to have a different style for the menu item which has been selected. But the menu is being rendered in the base templ...
Suppose you're running Django on Linux, and you've got a view, and you want that view to return the data from a subprocess called cmd that operates on a file that the view creates, for example likeso:
def call_subprocess(request):
response = HttpResponse()
with tempfile.NamedTemporaryFile("W") as f:
f.write(request....
Hi
This is taken directly from my Django template:
{% for day in days %}
<!-- {% cycle 'day' 'day' 'day last' as cls %} -->
{% rounded "black" cls %} {# Custom tag giving me rounded borders. #}
...
{% endrounded %}
{% endfor %}
I have commented out the {% cycle %} because I only use it to set "cls" to "day last" every third i...
I'm not sure I 100% understand what the database does. If I just have some misconception, please point it out.
Let's say I have a function that wants to create 100 new entry in the database with has 100,000 entries.
It seems a lot faster when those 100 entries get create and the commit is made after the last entry is created.
Now, if ...
What is the best way to store an array of integers in a django database?
...
I'm trying to convert some of my django views over from function based views to class based views and I've run into a small problem.
My OO is kind of weak and I think the problem is that I've lost track of where things are going.
I have a custom login decorator that I need on the views so I have...
First I have the View class from thi...
Hi guys, im working category and subcategories with the DataModel, all is fine in this part, but i need to use my category and subcategories in my Menu Nav, im try to use this Jquery menu , and im rendering my menu with subcategories, but im lost with rendering the subcategories in the way:
<ul>
<li>
<a href="#">Category</a>
...
The problem is best explained by example, consider the following two models:
class Topping(models.Model):
name = models.CharField(max_length=100)
class Pizza(models.Model):
name = models.CharField(max_length=100)
toppings = models.ManyToManyField(Toppping)
My data looks like the following:
Pizza and Topping tables joined...
Hi all
Im new to GIT and dont know yet how much it will fit my needs, but it looks impressive.
I have a single webapp that i use for differents customers (django+javascript)
I plan to use GIT to handle these differents customers version as branches. Each customer can have custom files, folders and settings, improved versions... but th...
Hi, I need help of javascript / jquery experts to solve the next problem:
---- 1. this javascript alerts the id of a selected option in a select html tag:
$(function(){
$("#id_productos_list").change(
function(){
var op = $(this).selectedValues()
alert(op);
}
);
});
----2. this javascript clone html code: ...
I'm running Django, and I'm creating threads that run in parallel while Django runs. Those threads sometimes run external processes that block while waiting for external input.
When I restart Django, those threads that are blocking while awaiting external input sometimes persist through the restart, and further they have and keep open P...
Hello,
I'm defining a ChoiceField based on a model's datas.
field = forms.ChoiceField(choices=[[r.id, r.name] for r in Model.objects.all()])
However I'd like to prepend my options with an empty one to select "no" objects.
But I can't find a nice way to prepend that.
All my tests like :
field = forms.ChoiceField(choices=[[0, '------...
Hi,
I am trying to display Django source code from a Django template.. However, I cannot find a tag similar to HTML's pre or xmp.
Can someone point me to the right direction. Thanks
EDIT
Heres the code
Also, I have a block with the same name.. which springs the error
...
Hi Guys,
I am quite new to Django, I'm having few problems with validation
forms in Admin module, more specifically with raising exceptions in the
ModelForm. I can validate and manipulate data in clean methods but
cannot seem to raise any errors. Whenever I include any raise
statement I get this error "'NoneType' object has no attribute...
Hi
I'm new at Django and have a few problems getting my mind around manytomany relatiosnhips and Manytoone (i.e Foreign key).
My setup is this.
I have class A, Class B, Class C
Every Class B object must belong to a Class A object. They cannot belong to more than one Class A object. A more practical example could be if Class A is a Mus...
I am trying to dymamically render an SVG image from matplotlib and insert it into the HTML document.
I am using Cairo.SVG as the matplotlib backend.
Now whenever I try to insert it into the
<img src="/url_to_graph" />
//or
<object data="/url_to_graph" />
I either get nothing or the "Missing Plugins" error from Firefox.
FYI I am ...
Hello,
I am a primarily a PHP guy. How would I handle forms in django? I managed to create a form, model and a view. Now I want to save my data into the database.
#forms.py
from django import forms
import datetime
class CommentForm(forms.Form):
name = forms.CharField(initial='Your name')
comment = forms.CharField(initial='You ...
Let's say I have the following table:
Employee
name start_date end_date
John 2009-10-10 2009-12-31
Joe 2009-12-01 2010-05-10
I also have a curr_date = '2009-11-01'. If I want to get all employees where curr_date should be between an employee's start_date and end_date inclusive, the corresponding SQL...
I apologize in advance for my noobness. I tried to create a new project with "django-admin.py startproject blah" and I got an error saying "startproject" is an unknown option for django-admin.py. This can't be normal. I then did "django-admin.py help" and viewed the possible arguments, and they were the same as the arguments for manage.p...