I have these (simplified) models:
class Question(models.Model):
question = models.CharField(max_length=60)
class Choices(models.Model):
question = models.ForeignKey(Question)
text = models.CharField(max_length=60)
is_correct = models.BooleanField(default=False)
I've made Choices as an inline of Question (in admin). ...
Hi,
I have an application in several languages but I would like to keepthe admin site always in english.
What is the best way to do this?
Thanks in advance.
...
How do you override the admin model for Users? I thought this would work but it doesn't?
class UserAdmin(admin.ModelAdmin):
list_display = ('email', 'first_name', 'last_name')
list_filter = ('is_staff', 'is_superuser')
admin.site.register(User, UserAdmin)
I'm not looking to override the template, just change the displayed fie...
Hello. I'm totally new to django, and I'm using its documentation to get help on how to use it
but seems like something is missing. i installed django using setup.py install command
and i added the ( django/bin ) to system path variable but. i still cant start a new project
i use the following syntax to start a project :
django-admin....
Hello ,
I am doing internationalisation in django admin.I am able to convert all my text to the specific langauge.But i m not able to change the 'app' name
suppose
django-admin.py startapp test
this will create a app called test inside my project.Inside this app 'test' i can create many classes in my model.py file.But when i regist...
I wanted to add a StackOverflow-style tag input to a blog model of mine. This is a model that has a lot of data already in it.
class BlogPost(models.Model):
# my blog fields
try:
tagging.register(BlogPost)
except tagging.AlreadyRegistered:
pass
I thought that was all I needed so I went through my old database of blog post...
I have added and removed fields in my models.py file and then run manage.py syncdb. Usually I have to quit out of the shell and restart it before syncdb does anything. And then even after that, I am getting errors when trying to access the admin pages, it seems that certain new fields that I've added still don't show up in the model:
Ca...
Even after obj.save(), the obj still does not have an id,
so I cannot access or manipulate the m2m records. Just keep getting a "instance needs to have a primary key value before a many-to-many relationship can be used" error.
def save_model(self, request, obj, form, change):
obj.save() # this doesn't work
super(Table2Admin, sel...
I have two sites with different SITE_IDs, but I want to have only one admin interface for both sites.
I have a model, which is just an extended FlatPage:
# models.py
class SFlatPage(FlatPage):
currobjects = CurrentSiteManager('sites')
galleries = models.ManyToManyField(Gallery)
# etc
# admin.py
class SFlatPageAdmin(FlatPa...
I have a model name called StoreEntry. Django admin changes it to look like 'Store Entrys'. This is weird. If anything it should be Store entries. Any idea what's going on here and how to change it?
...
How do I change some models name from "Categorys" to "Categories" on admin site in the new dev django version?
In the old version (whithout admin sites and admin models) you could just do this;
http://www.the-dig.com/blog/post/customize-plural-name-django-admin/
However - now setting verbose_name_plural inside my modeladmin based class ...
Is it possible to let the users choose / change dynamically the columns displayed in a object list in Django administration ?
Things can surely be implemented "from scratch" by modifying the 'change_list.html' template but I was wondering if somebody has already had the same problem and/or if any django-pluggin can do that.
Thanks in a...
I suppose similar problem would have been discussed here, but I couldn't find it.
Let's suppose I have an Editor and a Supervisor. I want the Editor to be able to add new content (eg. a news post) but before publication it has to be acknowledged by Supervisor.
When Editor lists all items, I want to set some fields on the models (like a...
Hi
i've got MenuItem model :
MenuItem(models.Model)
name=models.CharField(max_length=50)
url = models.URLField()
position = models.IntegerField()
Class Meta:
ordering =['position']
then i'm retriving it by MenuItem.objects.all()
My question is how can i make any user friendly interface in admin panel to allow sorting MenuIte...
Let's say I have a site where Users can add Entries through admin panel. Each User has his own Category he is responsible for (each Category has an Editor assigned through ForeingKey/ManyToManyField).
When User adds Entry, I limit the choices by using EntryAdmin like this:
class EntryAdmin(admin.ModelAdmin):
(...)
def formfiel...
This question is connected to my other question but I changed the logic a bit.
I have models like this:
from django.contrib.auth.models import Group
class Category(models.Model):
(...)
editors = ForeignKey(Group)
class Entry(models.Model):
(...)
category = ForeignKey(Category)
Now let's say User logs into admin panel an...
I've looked at several questions here that looked similar, but none of them discussed the problem from the perspective of admin panel.
I need to check if user has permission to leave a field empty. I wanted to use request.user but I don't knot how to pass request from EntryAdmin to ModelForm. I wanted to do something like this:
class E...
Hi,
I'm working on creating a simple website for an exhibition. It's intended to use django with django CMS as much as possible - so Django admin site will be used.
Now I want to limit user's access to objects they can view/modify/delete.
There's going to be an Admin user, who can do all that admin can in django. But there are going t...
I'm programming on py with django. I have models:
class Product(mymodels.Base):
title = models.CharField()
price = models.ForeignKey(Price)
promoPrice = models.ForeignKey(Price, related_name="promo_price")
class Price(mymodels.Base):
value = models.DecimalField(max_digits=10, decimal_places=3)
taxValue = models.Deci...
I extended a ModelAdmin with a custom field "Download file", which is a link to a URL in my Django project, like:
http://www.myproject.com/downloads/1
There, I want to serve a file which is stored in a S3-bucket. The files in the bucket are not public readable, and the user may not have direct access to it. Now I want to
avoid that ...