Opened 7 years ago

Closed 7 years ago

Last modified 6 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: UI/UX:

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 Changed 7 years ago by kmtracey

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to invalid
  • Status changed from new to closed

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 Changed 7 years ago by hannnndy <web@…>

  • milestone set to 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 Changed 7 years ago by hannnndy <web@…>

  • Resolution invalid deleted
  • Status changed from closed to reopened

comment:4 Changed 7 years ago by mtredinnick

  • Resolution set to invalid
  • Status changed from reopened to closed

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 Changed 6 years ago by anonymous

  • milestone post-1.0 deleted

Milestone post-1.0 deleted

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