Opened 15 years ago

Closed 15 years ago

Last modified 15 years ago

#9313 closed (invalid)

search in manyToMany fields in admin page

Reported by: web@… Owned by: nobody
Component: contrib.admin Version: 1.0
Severity: Keywords: query, ManyToMany, models.Model, search_fields, admin.ModelAdmin, ManyToManyField, models.ManyToManyField
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

hi,

what should i place here to search into the phones while I'm in the student admin page

class studentAdminView(admin.ModelAdmin):
	#fields = ['firstName', 'lastName']
	#list_filter = ('birthDate')
	list_display = ('firstName', 'lastName')
	#date_hierarchy = 'birthDate'
	#list_display_links = ('firstName', 'lastName')
	list_per_page = 1
	search_fields = ['firstName','lastName']
class phone_type(models.Model):
	type = models.CharField(max_length=20)

class phone(models.Model):
	number = models.CharField(max_length=20)
	phone_type_id = models.ForeignKey(phone_type)

class student(models.Model):
	classNumber = models.CharField(max_length=20)
	firstName = models.CharField(max_length=100)
	lastName = models.CharField(max_length=100)
	image = models.ImageField(upload_to='uploads')
	branch = models.CharField(max_length=100)
	birthDate = models.DateField('Birth Date',default=datetime.now)
	phones = models.ManyToManyField(phone)

I want to search between phones for example a number which is in phone table

select * from student 
innerjoin studentPhone on student.id = studentPhone.studentId
innerjoin phone on phone.id = studentPhone.phoneId

Change History (5)

comment:1 by Karen Tracey, 15 years ago

Resolution: invalid
Status: newclosed

This reads like a user question, not a code bug or even an enhancement request. If it is indeed a user question you are better off asking it on django-users, which far more people read and will likely be happy to offer suggestions. If you think you've found a bug you need to spell it out more clearly.

comment:2 by hannnndy <web@…>, 15 years ago

milestone: post-1.0

my question is refered to usage of the admin page not a bug or something else in django

the question is how to register a table or a python model class without viewing in the main admin page and usage of the many to many fileds

comment:3 by hannnndy <web@…>, 15 years ago

Resolution: invalid
Status: closedreopened

comment:4 by Malcolm Tredinnick, 15 years ago

Resolution: invalid
Status: reopenedclosed

So, as Karen noted, it's a question, not a bug report. Please ask questions on the django-users mailing list where there are a lot of people willing to help. We use Trac for bug reports only, not for "how do I..." questions.

comment:5 by (none), 15 years ago

milestone: post-1.0

Milestone post-1.0 deleted

Note: See TracTickets for help on using tickets.
Back to Top