Hello - 2 questions...
If I manually set my app_label, is there a way to set it to all caps? I am using an acronym for the app name and is a little confusing to not have it in all caps.
If I set the app_label on a new project, were I have no users or data, what kind of issues should I look when setting up user permissions and database...
Hi, This is my first post here, and I'd like to describe what I want to do as specific as possible.
I'd like to make a model that is 'selectable.'
for example,
class SimpleModel(models.Model):
property = models.CharField(max_length=255)
value = GeneralField()
GeneralField can be "CharField", "URLField", "TextField" so that ...
I am familiarizing my self with django.
I have succesfully installed and tested a demo site. I now want to switch on the admin module, to see what happens.
This is the steps I took (granted, some were unnecessary, but I just wanted to make sure I was starting from a clean slate):
Edited mysite/settings.py to enable admin
Edited mysit...
How to make entry.category to be instance of CategoryProxy? See code for details:
class Category(models.Model): pass
class Entry(models.Model):
category = models.ForeignKey(Category)
class EntryProxy(Entry):
class Meta:
proxy = True
class CategoryProxy(Category):
class Meta:
proxy = True
entry = EntryProx...
I'm trying to get a query from a specific model. I'm having trouble getting it to filter the data correctly.
I've already fixed one bug where it was returning other users data but now its returning duplicates of one row of data in the model.
events = Event.objects.filter(club=user.get_profile().main_club) | Event.objects.filter(invclu...
I have a Django model, shown below, that I use to keep track of which ip addresses visit my site and when.
class Visit(models.Model):
created = models.DateTimeField(default=datetime.utcnow)
ip = models.IPAddressField(editable=False)
I'd like to write a method on this model that returns the number of days i...
I am relatively new to Django/Pinax & I am faced with this peculiar situation.
Say I have a model "Vehicle". Now each instance of "Vehicle" has some attributes pertaining to the "vehicle" but it also has a reference to instance of one of automobiles class, where "automobiles" can be one of the many models like "car", "boat", "plane" etc...
Hey guys,
Maybe i am missing something, but according to the django docs (1.2), i have setup my URLS, models exactly as specified to ensure i am not hard-coding urls returned for get_absolute_url.
Here's what i have:
in urls.py
urlpatterns = patterns('django.views.generic.list_detail',
url(r'^$','object_list',
{ 'que...
I have a model Category, and I want its objects to always be displayed in a navigation menu in my base.html template (which all of my other templates extend).
I want to learn best-practices so would like to know what the correct/accepted way of providing this data to the template is.
...
I'm working on a video management application where each video clip is associated with a single program-name and a single category-name, but programs and categories can be associated with multiple different videos. (This part is straight forward.)
What's different is that the choices for category-names vary on a per program basis.
For ...
I'm pretty new to relational databases and this may be why I'm having this problem but I have a model - Post.
I want it to have variable number of URLs, however Django only seems to have the OneToManyField which requires a model (not a field - which URLField is).
...
I'm attempting to construct a Django application that models an existing set of tables. These tables all have the same fields, plus custom fields per table. What I'm wanting to do is model this structure, and have records save to a particular table based on what table model they are attached to.
These tables can be created quite often,...
I am looking to find a way to annotate a queryset with the counts of a subset of related items. Below is a subset of my models:
class Person(models.Model):
Name = models.CharField(max_length = 255)
PracticeAttended = models.ManyToManyField('Practice',
through = 'PracticeRecord')
cl...
Hello,
I wonder if is it possible to add some conditional fields in django.
Say I have a category model which has an ID, name and description fields.
What I would like is to add a many-to-many field in my Product model that links it with the Category ID model... and as a helping reference show what the name of that Category would be.
I k...
I've got a django model which contains, among other things, a DateField() attribute:
class Table():
date = models.DateField()
value = models.FloatField()
I'm writing a view that groups this data by week, month Quarter and year.
I've hardcoded a calculation that gets my monthly value simply enough - by adding up all the values ...
This is an extremely naive question. As you can tell, it comes from someone who doesn't know much about either databases or Django.
What are the advantages of using ForeignKeys in Django?
Maybe an example will help me understand better. I have tables like this already:
City:
id = IntegerField() # e.g. 15
name = CharField() # ...
Howdy,
I am trying to figure out how to use proxy classes in Django. I want to receive a queryset where each object belongs to a proxy class of a common super class so that I can run custom sub-classed methods with the same name and my controller logic doesn't need to know or care about which kind of Proxy model it is working with. One ...
I have a django model (A) which has a ManyToManyField (types) to another model (B). Conceptually the field in A is an 'optionally limit this object to these values'. I have set blank=null and null=True on the ManyToManyField. I have created an object from this model, and set types to some values. All is good.
I want to set it to 'null',...
I am wondering if is there a way to compute a field in the admin site based on a concatenation of multiple fields.
Basically I have a Product model with different fields associated to various attributes
(colour, size, length etc).
I would like to compute the code value to be a concatenation of the values of the various attribute field...
For example If I have the following models, views and code in a template...
class news(models.Model):
type = models.ForeignKey(----) (charfield)
title = models.CharField(max_length=100)
published = models.DateTimeField(default=datetime.now)
summary = models.CharField(max_length=200)
def ----():
items = news.objects...