This is a follow-up to this question. How do I display properties defined on a child model in an inline on the parent? To illustrate, I have this model:
class UserProfile(models.Model):
user = models.ForeignKey(User, unique=True, primary_key=True, related_name='profile')
...
@property
def age(self):
if self.birth...
Hi folks,
is it possible to mark some fields/rows red in django admin interface if they achieve a expression?
For example, if there is a model "Group" with members and capacity, how can I visualize when they are full or crowded?
...
Hi,
When I am creating a user through django admin site,the password is being stored as plain text.I don't know why it's happening.I created superuser from command,and password is stored as hash.So,what could be the reason for this to happen? Now,since password is being stored as plain text,the user cannot login using the credentials.
...
Hi all,
I'd like to make some aspects of django admin interface a bit more fluid without refreshes.
For example, I have this ReportAdmin(admin.ModelAdmin) class, which has a list_editable property that will allow user to edit the specific fields right on the list of reports view rather than clicking into each report and edit it there....
I have a model:
class Foo(models.Model):
poster = models.ImageField(u"Poster", upload_to='img')
I'm using the admin to upload posters and save Foo objects. I now need to find a way to lowercase the filename before save. For instance POSTER.png or Poster.png or poster.PNG should be lowercased to poster.png.
What would be the easie...
With a normal ModelAdmin class I can set the ordering with:
ordering = ("field_name",)
There seems to be no option to set ordering for InlineModelAdmin. Is there a way to get the inline elements to sort by a particular field?
...
I have a data model with a bitfield defined something like this:
alter table MemberFlags add column title varchar(50) not null default '';
alter table MemberFlags add column value integer( 3) not null default 0;
insert into MemberFlags (title, value) values
("Blacklisted", 1),
("Special Guest", 2),
("A...
Hi guys, how i'll exclude a field in django admin if the users are not super admin?
thanks
...
Hi all,
I'm trying to show the content of a manytomanyfield in the admin interface. I have the following code:
class Member(models.Model):
group = models.ManyToManyField('Group')
def group_gp_name(self):
return self.group.gp_name
def __unicode__(self):
return u'%s' % (self.id)
class Group(models.Model):
...
Hi All,
I have a custom TagField form field.
class TagField(forms.CharField):
def __init__(self, *args, **kwargs):
super(TagField, self).__init__(*args, **kwargs)
self.widget = forms.TextInput(attrs={'class':'tag_field'})
As seen above, it uses a TextInput form field widget. But in admin I would like it to be disp...
Hello,
Building a Django app.
Class Company(models.Model):
trucks = models.IntegerField()
multiplier = models.IntegerField()
#capacity = models.IntegerField()
The 'capacity' field is actually the sum of (trucks * multiplier). So I don't need a database field for it since I can calculate it.
However, my admin user wants ...
Django-admin is pluralizing a model that I have running as a proxy class.
The normal case here works fine:
class Triviatheme(models.Model):
[ ... elided ... ]
class Meta:
db_table = u'TriviaTheme'
verbose_name_plural='trivia themes'
But for a main content table, I have a parent model called 'Content', and a p...
Hi there
I want to upload images to a gallery app. I want the user to be able to either load images normaly, or upload on zip file containing all the images for that gallery. Then it must be uncompressed and all images must be added to that model. This is for the admin site.
Any ideas?
...
I have a model in my django project with a member which is a char field. Basically data in this field will be entered as comma-separated values
Without a long-winded explanation of what the overall goal of this is, basically rather than having the admin interface use a simple text field, I'd rather have have some custom HTML for the fo...
I have a django model with a text field. I'm using a rich text editor (nicEdit) on the admin site to allow the client to easily enter markup into the field. I'd like to process the contents of the field and perform a few actions before anything is inserted into the database.
For example, I want to strip junk generated by MS Word, font t...
I saw some ppl had this problem before me, but on older versions of Django, and I'm running on 1.2.1.
I have a model that looks like:
class Category(models.Model):
objects = CategoryManager()
name = models.CharField(max_length=30, blank=False, null=False)
parent = models.ForeignKey('self', null=True, blank=True, help_text=_('The di...
Suppose I have a Book model containing a foreign key to a Publisher model.
How can I display in the Django admin a column with the number of books published by each publisher, in a way that I can use the built-in sorting?
...
i want to pass a variable by URL to another page in django admin.
it seems it is not working, i want to pass the variable "/?name=hello", and catch it by request.GET.get["name",""].but the url becomes "/?e=1" after it passed.
if i use the default parameter'q', it works, but it will have a conflict.
it seems this problem is django-admi...
i am using django-admin, and i have a model as following. it shows as a dropdown list in the admin. how can i order it by alphabet? instead of default user ID?
user= models.ForeignKey(User)
...
Hi there,
I'm running a Django app for my root public_html folder, and it's working fine. But there's a problem with one of my other apps. The problematic app is accessed through a redirect to a subdirectory (e.g. http://workingsite.com redirects to public_html, http://brokensite.com redirects to public_html/foo)
The problem is that th...