I have the following in my model:
class info(models.Model):
add = models.CharField(max_length=255)
name = models.CharField(max_length=255)
An in the views when i say
info_l = info.objects.filter(id=1)
logging.debug(info_l.name)
i get an error saying name doesnt exist at debug statement.
'QuerySe...
I understand that, with a singleton situation, you can perform such an operation as:
spam == eggs
and if spam and eggs are instances of the same class with all the same attribute values, it will return True. In a Django model, this is natural because two separate instances of a model won't ever be the same unless they have the same ....
you can load geo-info via two way below:
var g = new GGeoXml("http://zjm1126.3322.org/mymedia/b.kml");
map.addOverlay(g);
or
var g = new GGeoXml("http://tagzania.com/rss/user/blogwatcher/7wonders%2Bnew/");
map.addOverlay(g);
if i want to saving the features(user made on google map,line and point) ,i have to make
a kml or make a ...
In a ModelForm, i have to test user permissions to let them filling the right fields :
It is defined like this:
class TitleForm(ModelForm):
def __init__(self, user, *args, **kwargs):
super(TitleForm,self).__init__(*args, **kwargs)
choices = ['','----------------']
# company
if use...
hi, i have two models:
class Project(models.Model):
categories = models.ManyToManyField(Category)
class Category(models.Model):
name = models.CharField()
now, i make some queryset:
query = Project.objects.filter(id__in=[1,2,3,4])
and i like to get list of all distinct categories in this queryset with count of projects with refer...
Hi all,
Could somebody give me a pointer on why I need to add my project root path to the python path as well as the application itself in my WSGI file?
Project base is called 'djapp', the application is called 'myapp'.
sys.path.append(os.path.dirname(os.path.abspath(__file__)) + '/..')
sys.path.append(os.path.dirname(os.path.abspath(...
Hi,
I want to use django.contrib.comments in a blogging application and customize the way the form is displayed. My problem is that I can't get the fields to display although displaying the hidden fields works just fine. I had a look at the docs and compared it with the regular way of displaying forms but honestly I don't know why the ...
I have this model in django:
class JournalsGeneral(models.Model):
jid = models.AutoField(primary_key=True)
code = models.CharField("Code", max_length=50)
name = models.CharField("Name", max_length=2000)
url = models.URLField("Journal Web Site", max_length=2000, blank=True)
online = models.BooleanField("Online?")
...
In one of my Django templates, I have a chunk of HTML which repeats at several places in the page. Is there a way I could use another template for this chunk alone and "instantiate" the template where required?
...
I'm having trouble getting only a part of an URL with the {% url %} tag.
The URL setup contains this:
url("^delete/(?P<uuid>[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12})/$",
deleteView,
name = "delete"),
which means to delete an item by its UUID (the view takes a parameter "uuid" as you can see). As I don't wa...
I'm new to django templates, and I'm trying to tweak the admin interface. Right now I'm editing tabular.html in order to control how inlines are displayed. However, I have no idea what variables are available via the context the admin app sends to this template. Is there any quick way to see all variables available?
I know it is possib...
Hi!
I have the following model:
class User:
name = models.CharField( max_length = 200 )
problem_user = models.BooleanField(default=False)
def points_total(self):
points_added = PointsAdded.objects.filter(user=self)
points_total = 0
for point in points_added:
points_total += point.points
...
Hello,
I have an ecommerce website that works in a classical way: people sign up, buy a product with their CC.
It uses the default Django auth system for users and registration and session framework.
Now I want to implement a referral system to my system where people can invite other people by giving their referral link (ie mysite.com/...
I created a database for a site i'm doing using Django as the admin backend. However because the server where the site is hosted on, won't be able to support Python, I find myself needing to do the front end in PHP and as such i've decided to use CodeIgniter along with Datamapper to map the models/relationship.
However DataMapper requi...
Setup: Multiple sites on Django on the same set of servers, being served by the same group of Apache processes. Some sites are Eastern TZ; some are Central. Database is PSQL running on a separate server.
When I started, I didn't put much thought into how the various sites would handle timezones; I guess I saw the TIMEZONE setting in Dja...
I have a Media Temple DV server hosting dev.example.com with django mounted at /. There is a legacy directory in my httpsdocs I need to continue to serve at /legacy. But for this directory I need to redirect anyone coming over http over to https, then prompt for http basic auth.
In the virtual host conf, I'm pointing the root to a djang...
First of all, sorry if this isn't an appropriate question for StackOverflow. I've tried to make it as generalisable as possible.
I want to create a database (MySQL, site running Django) that has users, who can be allocated a certain number of points for various types of action - it's a collaborative game. My requirements are to obtain:...
Hello.
My /train directory is aliased to a script in httpd.conf by:
WSGIScriptAlias /train /some-path/../django.wsgi
And it works well, except for one problem. If a user goes to /train (with no trailing slash) it will not redirect him to /train/, but will just give him the right page. This is a problem because this way the relative lin...
I want to use unique hashes for each model rather than ids.
I implemented the following function to use it across the board easily.
import random,hashlib
from base64 import urlsafe_b64encode
def set_unique_random_value(model_object,field_name='hash_uuid',length=5,use_sha=True,urlencode=False):
while 1:
uuid_number = str(ra...
I get the following error when attempting to use django-openid-auth OpenID discovery error: No usable OpenID services found for *******@gmail.com
I have followed the instructions that come with it, though it seems there is something I am missing. the installation is on my localhost.
...