If I write {{some_time|date:"h:i A T"}} in a django template, it outputs "12:00 AM Eastern Daylight Time". I would prefer the short timezone format "EDT". Any way you can do this?
...
so i'm trying to do a data migration where i take the "listings" from a realestate app into a new "listings" app that i've created.
i did startmigration like this:
python manage.py startmigration listings migrate_listings --freeze realestate
created a blank migration, which i populated with this:
def forwards(self, orm):
"Wr...
I'm hoping someone can help me here. I can't get make a successful ajax call using django, jquery and the jquery form validation plugin. I'm trying to pass a form email address to a view method to see if it exists in db. But server response is 404 on ajax request. In Firebug i can see the request being sent appears to be formatted proper...
I am trying to use different open source apps in my project. Problem is that there is a same Model name used by two different apps with their own model definition.
I tried using:
class Meta:
db_table = "db_name"
but it didn't work. I am still getting field name clash error at syncdb. Any suggestions.
Update
I am actual...
When I try to use the tiered shipping module in my store, I get the following error:
TypeError at /shop/checkout/dummy/
object.__init__() takes no parameters
Request Method: GET
Request URL: http://127.0.0.1:8000/shop/checkout/dummy/
Exception Type: TypeError
Exception Value:
object.__init__() takes no parameters
...
Maybe I should first give an idea of what I want to accomplish as there might be a much better solution.
I have a web application using Django that manages media (Recorded TV, movies, etc). The web app allows you to add meta data to the media such as what you have watched on a per user basis and allows you to perform searches and synchr...
I'm trying to test my Django apps which run on a postgis database, by following this doc:
http://docs.djangoproject.com/en/dev/topics/testing/
Normally I create a new database by copying a template:
(as user postgres)
createdb -T template_postgis -O lizard test_geodjango2
When I run ./manage.py test, I get the following mess...
Hi
I have 2 models
I use this models to show the avatar in comments.
django_comments:
user_id
comment
.....
myapp_profile
user_id
image_path
......
Actually i´m doing a raw query with cursor.execute(), to get this data
------- ---------- -------
'user_id' 'image_path' 'comment'
------- ---------- -------
...
Hi
I have a many-to-many relationship in my django application where I use the "add" method of the manager pretty heavily (ie album.photos.add() ).
I find myself needing to store some data about the many-to-many relationship now, but I don't want to lose the add method. Can I just set a default value for all the additional fields on th...
So here's a question for a Django wizard. I am inheriting an object Manager something along the lines as follows:
class MyObjManager(models.Manager):
def total_values(self, myobj_id):
return 49
def what_the_heck(self, poll_id):
return 48
class TestMe():
def what_the_heck(self, poll_id...
I have a simple Django Form:
class testForm(forms.Form):
list = forms.CharField()
def getItems(self):
#How do I do this? Access the data stored in list.
return self.list.split(",") #This doesn't work
The list form field stores a csv data value. From an external instance of testForm in a view, I want to be able to look a...
Hi all :)
I'm currently developing a Blog project using Post model, which will be used by multiple authors.
I want to make an admin/control-panel interface where each author of the Post can view the Post list the author created (so he won't see the Post created by the other authors), edit, and multiple-delete them.
http://stackoverflo...
class EditAdminForm(forms.ModelForm):
password = username.CharField(widget=forms.TextInput())
password = forms.CharField(widget=forms.PasswordInput())
password_confirm = forms.CharField(widget=forms.PasswordInput(), initial=???)
You can see what I'm trying to do here. How would I go about pre-populating the pasword_confirm ...
I'm working on a django site, which I want the authentication part to work exactly like how Stack Overflow works. A new user comes to the site, they click on "create new account", choose their OpenID provider, get validated, then an account is created for them with "openiduser4356" or something as the username. The user can then go into ...
I am writing a Django context processor which needs to access the name of the URL pattern that the request got successfully resolved against. Given the pattern,
url(r'^home/$', 'app.index', name='website.home')
and the request path /home, I want to get the value for name, which in this case is website.home.
I got this code from djan...
I'm setting up a django project for the first time and I want to use jQuery. Is the idea that I just create a media folder, stick jquery in it and then point MEDIA_ROOT to it? Any suggestions for a good standard location for the media folder?
...
Hi
I have a QuerySet, let's call it qs, which is ordered by some attribute which is irrelevant to this problem. Then I have an object, let's call it obj. Now I'd like to know at what index obj has in qs, as efficiently as possible. I know that I could use .index() from Python or possibly loop through qs comparing each object to obj, bu...
Suppose I have the following Event model:
from django.db import models
import datetime
class Event(models.Model):
date_start = models.DateField()
date_end = models.DateField()
def is_over(self):
return datetime.date.today() > self.date_end
I want to test Event.is_over() by creating an Event that ends in the futur...
So I have a django project I just created called 'coolprojectsite' the directory structure looks something as follows:
* media (dir)
* mytemplates (dir)
* * admin (dir)
* * coolprojects (dir)
* coolprojectsite (dir)
* * coolproject (dir)
* * * __init__.py
* * * admin.py
* * * models.py
* * * tests.py
* * * urls.py
* * * views.py
* * __i...
I have a django project, but for some reason basic jquery isn't working.
<html>
<head>
<link href="/site_media/css/poll.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="/site_media/js/jquery-1.3.2.js" />
<script type="text/javascript">
$(document).ready(function(){
...