Hello everyone,
I have some doubts regarding sitemap.xml generation and Django's sitemap framework particularly.
Let's say I have a blog application which has post_detail pages with each post's content and a bunch of 'helper' pages like 'view by tag', 'view by author', etc.
Is it mandatory to include each and every page in sitemap....
Hello !
I am obviously victim of some dark magic...
Here is a template that I render :
context = Context({'my_cube': c})
template = Template(
'{% load cube_templatetags %}'
'{{ my_cube|inspect }} {{ my_cube.measure }}'
)
Here is the implementation of the inspect filter :
def inspect_object(obj):
return obj.measure()
He...
Hi, I was wondering if there was a ternary operator (condition ? true-value : false-value) that could be used in a Django template. I see there is a python one (true-value if condition else false-value) but I'm unsure how to use that inside a Django template to display the html given by one of the values. Any ideas?
...
I need a Django Form Field to support US or International phone numbers. Does one exist? How could you validate US phone #'s or int'l ones.
...
I am working on creating a simple contest submission system using django. This is my first real django project. Basically each user can view a list of problems, submit a file, and view a results page.
Each problem can be associated with multiple contests, and different contests can use the same problem. Because of this, both problem and...
Question
Why does Django automatically load the initial_data.json fixture when it's located inside the project directory but not located in one of the three specified locations that Django searches for fixtures?
Configuration Information
I have not set the FIXTURE_DIRS setting in settings.py
Django 1.2.1
Django's Documentation Re...
How can i get file name from request.FILE in Django?
def upload(request):
if request.method == 'POST':
form = UploadForm(request.POST, request.FILES)
if form.is_valid():
upload = Upload()
upload.timestamp = datetime.datetime.now()
save_instance(form, upload)
I tied use this
i...
I am trying to use the YUI uploader to upload files to Django view.
However, I am getting a 403 error in CsrfViewMiddleware. I have determined that the problem is due to the flash uploader (that the YUI uploader uses) not sending the CSRF cookie in the file upload request.
The YUI uploader's uploadAll() function allows additional data...
I have a django (v1.1.1) on a server running Python 2.4. On my localhost/development computer the site works perfect. When I uploaded the files to the production server, it seemed to work fine, but after a page refresh I am receiving random TemplateDoesNotExist errors.
In the trace report I looked at the TEMPLATE_DIRS variable to make s...
I want to use git for the deployment of a django project as I have done before, but this time it would also be necessary to have production files (like uploaded files, sql db etc) somewhere in the repository, so that you can locally work easily with the same data as on the server; my idea would be to have three branches:
master (on whi...
I have a Django 1.1 Apache2 server running. There is a JSON get request at a fixed URL that returns "stale" data when accessed via iPad/iPhone/Safari/Chrome, but is always up to date from Firefox.
By stale data, I mean that as the data the JSON represents changes, the broken requests don't get updated, their responses are getting cache...
Django @login_required views for JSON data API's used from iPad/iPhone/Android?
In my Django webserver, I have built JSON data API's that I want to access from mobile devices: iPad/iPhone/Android. I'm using the iPad/iPhone ASIHttp Library. How do I login users from an iPad/iPhone so my data API's can use the @login_required decorator?...
I have a m2m field in a class, and a through table. I am not table to save the list of items from the through table.
if i have a multi select form, like below, and i want to be able to save all the selected items, how should i do it??
My model form looks like this:
class ClassroomForm(ModelForm):
class Meta:
model = Class...
class Material(models.Model):
products = ManyToManyField('Product', related_name='materials')
class Products(models.Model):
...
class ProductForm(forms.ModelForm):
class Meta:
model = Product
fields = ('materials', )
I want to do this.
I saw this discussion:
http://groups.google...
how I can accomplish this without losing data? someone know how to do that? thanks to all.
...
Hi, I have a time-consuming method with non-predefined number of iterations inside it that I need to test:
def testmethod():
objects = get_objects()
for objects in objects:
# Time-consuming iterations
do_something(object)
One iteration is sufficient to test for me. What is the best practice to test this method ...
I'm looking for an updated version of these Django SuperForms. Can't seem to get it to work in Django 1.2. In particular, I'd like it to work with ModelForms.
My use case is almost identical to his; I have an Address model that I'd like to use as a sub-form in various places. It's a pain to try and combine everything in the view func.
...
Hello world!
I'm testing a django app with selenium, and one of my pages uses the jquery ui tabs element. One of the tabs contains a simple table listing some users, and is loaded via ajax. When using the app, the tab works just fine, but when automating the test with selenium, the tab doesn't appear to load it's content!
I'm writing th...
My model:
class Order(models.Model):
property_a = models.CharField()
property_b = models.CharField()
property_c = models.CharField()
Many users will access a given record in a short time frame via admin change page, so I am having concurrency issues:
User 1 and 2 open the change page at the same time. Assume all values a...
I have found here on stackoverflow a solution to extend django-registration with new fields using signals. Here's the link : http://dmitko.ru/?p=546 .
I have created extended profile model, extended form, added required options to settings , defined urls and the proper form is displayed but only normal User (from auth module) is created....