I'm using Django templating with Google App Engine. I'm trying unsuccessfully to print out a menu.
The controller:
menu_items = {'menu_items': [{'href': '/', 'name': 'Home'},
{'href': '/cart', 'name': 'Cart'}],
}
render('Views/menu.html', self, {'menu_items': menu_items})
# .....
I have some codes like this:
cats = Category.objects.filter(is_featured=True)
for cat in cats:
entries = Entry.objects.filter(score>=10, category=cat).order_by("-pub_date")[:10]
But, the results just show the last item of cats and also have problems with where ">=" in filter. Help me solve these problems. Thanks so much!
...
Is there any way to to list out the fields present in a table in django models
class Profile(models.Model):
user = models.ForeignKey(User, unique=True)
name = models.ForeignKey(School)
emp = models.ForeignKey(User, unique=True)
How to list out the filed names from the table Profile,(just like desc Profile; in mysql )
tha...
I want all the production data for my web-app to also flow through my testing environment. Essentially, I want to forward every http request for the production site to the test site (and also have the production website serve it!).
What is a good way to do this? My site is built with Django, and served by mod_wsgi. Is this best implem...
I use solr+django-haystack
I set settings.HAYSTACK_INCLUDE_SPELLING = True
and rebuild index
I'm trying to get any suggestion using:
SearchQuerySet().auto_query('tryng ani word
her').spelling_suggestion()
But I always get None
What should I do to get at least one working suggestion ? may be I
need add some configuration into solr con...
Is there any robust way of implementing Cassandra back end to a web application developed using Django web framework.
Thanks
...
Hello world!
Im trieng to build my own template tags
Im have no idea why I get the errors I get, im following the django doc's.
this is my file structure of my app:
pollquiz/
__init__.py
show_pollquiz.html
showpollquiz.py
This is showpollquiz.py:
from django import template
from pollquiz.models import PollQuiz, Choice
r...
There are many activities on an application that need things like:
Send email, Post to twitter
thumbnail an image, into several sizes
call a cron to find connected relationships
A good way to do these tasks is to write into an asynchronous queue on which operations are performed.
What django application can be used to implement such...
you can view full source code here dpaste.com/hold/167199
Error:
delete() takes exactly 2 arguments (1 given)
Copied from linked code:
index.html
............................................
<form method="POST" action="/customer/(?P<name>[a-z]*)/delete/">
<div style="float: right;
margin: 0px; padding: 05...
There u a lot of book teaching django, I just don't know which one is the best, so can anybody give me an answer
...
I'm writing a django app that communicates with remote service (on my VPN but not hosted locally). I can successfully communicate with the service via the django shell but when I try to call the exact same function, posting the information from a webform, the development server dies.
I would have thought the shell and the development se...
Hi
I have wrote a custom widget
class AutoCompleteWidget(widgets.TextInput):
"""
widget to show an autocomplete box which returns a list on nodes available to be tagged
"""
def render(self, name, value, attrs=None):
final_attrs = self.build_attrs(attrs, name=name)
if not self.attrs.has_key('id'):
final_attrs['id'] = 'id...
I'm using django-haystack and a xapian backend with real time indexing (haystack.indexes.RealTimeSearchIndexing) of model data and it works fine on my Ubuntu server. However, it causes django to hang upon data entry when I deployed the app on a RHEL5 server.
Everything is hunky dory if I switch to a standard SearchIndex.
Running ./ma...
I have a web application that I want to sync with Flickr. I don't want the users to have to log into Flickr so I plan to use a single login. I believe I'll need to do something like this:
import flickrapi
flickr = flickrapi.FlickrAPI(myKey, mySecret)
(token, frob) = flickr.get_token_part_one(perms='write', my_auth_callback)
flickr.get_t...
Hi,
in a Model I have a CharField with choices:
class MyModel(models.Model):
THE_CHOICES=(
('val',_(u'Value Description')),
)
...
myfield=models.CharField(max_length=3,choices=THE_CHOICES
Now in the template I access an instance of MyModel:
{{ my_instance.myfield }}
Of course the gives me val instead of Value ...
Why can't I do this?
from django import forms
from django.forms import widgets
class UserProfileConfig(forms.Form):
def __init__(self,*args,**kwargs):
super (UserProfileConfig,self).__init__(*args,**kwargs)
self.tester = 'asdf'
username = forms.CharField(label='Username',max_length=100,initial=self.tester)
Mo...
Hi,
I'm using the Windmill test system and have it running using test_windmill for Django which works fine for the Python tests. I'd like this to run a suite of Javascript tests also whilst the Django test server is running. I've used the run_js_tests call from the Windmill shell which works fine but I can't find a way to have this run ...
I'm looking to create a dynamic way to parse xml files and convert them into a different format as easy as possible..
Here is my fixture.xml
<Orders>
<Order number="" queue="true" getTax="true">
<Customer>
<Email><![CDATA[[email protected]]]></Email>
</Customer>
</Order>
</Orders>
...
I am calling a form as follows, then passing it to a template:
f = UserProfileConfig(request)
I need to be able to access the request.session within the form... so first I tried this:
class UserProfileConfig(forms.Form):
def __init__(self,request,*args,**kwargs):
super (UserProfileConfig,self).__init__(*args,**kwargs)
...
Short version:
I have a Django project under development & testing (not yet into production) which is slowly getting “not-so-small”, and lately I've been wondering about splitting things up to keep it manageable.
Project layout:
The project comprises various reusable applications not developed by me, such as avatar, django_evolution, co...