I have declared two of my models this way:
class EmailAddress(models.Model):
customer = models.ForeignKey(Customer)
email_address = models.CharField(max_length=200)
def __unicode__(self):
return self.email_address
class Customer(models.Model):
.
.
.
email_address = models.ForeignKey(EmailAddress)
def __unicode__(self):
...
I need magic tool, that helps me to understand where one my problem variable is changed in the code.
I know about perfect tool:
pdb.set_trace()
and I need something similar format, but about only one variable changing history.
For example, my current problem is strange value of context['request'] variable inside Django's tag templa...
Hi,
I`m thinking of creating an admin action-like behaviour outside the admin. Thus the user should be able to select objects with a checkbox and after selecting an action with the dropdown the selected action is conducted on all selected objects.
I thought of the following approach.
Create a checkbox for each object in the .html temp...
Hi,
I'm using a custom MM/YY field and widget based on this example. I want to iterate over the individual month and year options defined in the widget class in order to apply "selected='selected'" to the MM/YY value that corresponds with the MM/YY value stored in the database. This seems like such a messy way of doing this, so if you...
Hi,
I have an application located in one folder, and templates for it in another one...
I have added translation strings to the templates (which are stored in temaplates directory, I have one directory for all templates in my application)
When I go to the application folder and run a script there:
silver:articles oleg$ django-admi...
Hi,
I have a form looking like this:
class MarketingActionForm(forms.ModelForm):
contact = ManyToManyByLetter(Contact, field_name="first_name")
#contact = AjaxManyToManyField(Contact, DICT_LOOKUP)
class Meta:
model = MarketingAction
exclude = ('created_by',)
class Media:
js = (
...
I have problem storing a big queryset in the session. This queryset is from a search and I need to store it for paginate inside every result. This is the code in my view:
c = queryset.order_by('-order')
request.session['query_search'] = c
You can see an example in my site: http://www.lukmi.com/classifieds/chicas/escorts/barcelona/
Th...
Is it good practice to treat individual app views as a blocks of HTML that can be pieced together to form a larger site? If not, what is the best way to reuse app views from project to project, assuming each one uses a different set of templates?
...
Hi,
how do you use model formset in Django? When you do this:
from django.forms.models import modelformset_factory
OrderFormset = modelformset_factory(Order)
formset = OrderFormset()
formset has all Orders from DB...
How do I limit them for example to profile.orders (Profila is connected to Order with FK)?
Thanks in advance,
Etam.
...
I'm still a complete beginner in the field of web development and I'm trying to set up the Django environment. I'm reading "the definitive guide to django" to start my practice.
I'm running Snow Leopard (10.6.2) on a macbook 2.1GHz. It came with Python 2.6.1. Since Snow Leopard cam with Python 2.6.1 preinstalled, so I didn't do any ext...
does anybody know any gui builder of django models?
...
I do html/css by trade, and I have been working on and off django projects as a template designer. I'm currently working on a site that uses Jinja2, which I have been using for about 2 weeks. I just found out through reading the documentation that Jinja2 doesn't support multiple level template inheritance, as in you can't do more than on...
First, I did look at this question, but its over a year old. Surely now there is a good way in Django 1.1.1 to carry filter selection forward after a user clicks the save button in the Admin.
In a table with thousands of records, filtering is essential. And if a user makes several filter choices that effort shouldn't have to be repeat...
I have this:
class OrderForm(ModelForm):
class Meta:
model = Order
exclude = ('number',)
def __init__(self, *args, **kwargs):
super(OrderForm, self).__init__(*args, **kwargs)
if self.initial.get('account', None):
self.fields['customer'].queryset = Customer.objects.filter(account=self....
Hi guys, im developing a personal proyect, well my project is "finished", but now i want to add a social app, i think pinax is ready for this task... but now i would like to know something....
i can use pinax into my project like a django app? or i need to work again my project but using pinax?
Sorry with my English
Thanks guys.
...
Okay I will try to be as descriptive as possible here,
I am using Python-Django server and the pyFacebook helper.
I have this callback url on the facebook edit application page:
http://panome.eyesee360.com:8000/panomeFbProject/fbLandingPage/
In my project urls.py:
urlpatterns = patterns('',
(r'^panomeFbProject/', include('panomeF...
hi,
I actually want to accomplish the same thing a user in
http://stackoverflow.com/questions/365757/remembering-checked-checkboxes-across-pages-whats-the-best-way
asked. But not for php, I want it for django. Since django is just great :-)
I`m using pagination and want to remember the checked checkbox while the user is navigating o...
Hi,
I have three models: Product, Category and Place.
Product has ManyToMany relation with Category and Place.
I need to get a list of categories with at least on product matching a specific place.
For example I might need to get all the categories that has at least one product from Boston.
I have 100 categories, 500 places and 100,000...
Here's a simple python function that checks if a given url is valid:
from httplib import HTTP
from urlparse import urlparse
def checkURL(url):
p = urlparse(url)
h = HTTP(p[1])
h.putrequest('HEAD', p[2])
h.endheaders()
if h.getreply()[0] == 200:
return 1
else: return 0
This works for most sites, but wit...
I'm receiving HEAD requests in my application, and wondering on the best way to handle them. Options are:
convert them to GETs, process GET normally, then:
strip the body (though I'm not sure how - response.content = '' doesn't seem to do it.
it seems app engine auto-strips the body, giving a warning "Dropping unexpected body in respo...