[Django] #28716: search_fields = ['question_text'] from Tutorial07 not working.

3 views
Skip to first unread message

Django

unread,
Oct 16, 2017, 6:29:17 PM10/16/17
to django-...@googlegroups.com
#28716: search_fields = ['question_text'] from Tutorial07 not working.
-------------------------------------+-------------------------------------
Reporter: PSKyne | Owner: nobody
Type: Bug | Status: new
Component: | Version: 1.11
Documentation | Keywords: search_fields
Severity: Normal | documentation tutorial
Triage Stage: | Has patch: 0
Unreviewed |
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------
Following the django tutorial from the beginning, everything works as it
should except the Search Fields example in Tutorial 07.

Following the tutorial, my polls/admin.py appears below. However, no
search field appears in Google Chrome or in Firefox. No error is thrown by
the django server either. I did not find any relevant google responses to
the issue, nor did I find it here in Trac.

{{{
## polls/admin.py:
from django.contrib import admin

# Register your models here.

from .models import Question, Choice

class ChoiceInline(admin.TabularInline):
model = Choice
extra = 3


class QuestionAdmin(admin.ModelAdmin):
fieldsets = [
(None, {'fields': ['question_text']}),
('Date information', {'fields': ['pub_date'], 'classes':
['collapse']}),
]
inlines = [ChoiceInline]

list_display = ('question_text', 'pub_date', 'was_published_recently')

list_filter = ['pub_date']

search_fields = ['question_text', 'pub_date']

admin.site.register(Question, QuestionAdmin)
}}}

System check identified no issues (0 silenced).
October 16, 2017 - 15:36:08
Django version 1.11.5, using settings 'mysite.settings'
Starting development server at http://127.0.0.1:8000/

{140}$ python
Python 3.6.2 (default, Aug 03 2017, 16:34:42) [GCC] on linux

--
Ticket URL: <https://code.djangoproject.com/ticket/28716>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Oct 16, 2017, 6:32:32 PM10/16/17
to django-...@googlegroups.com
#28716: search_fields = ['question_text'] from Tutorial07 not working.
-------------------------------------+-------------------------------------
Reporter: Patrick Kyne | Owner: nobody
Type: Bug | Status: new
Component: Documentation | Version: 1.11
Severity: Normal | Resolution:
Keywords: search_fields | Triage Stage:
documentation tutorial | Unreviewed
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Patrick Kyne):

* Attachment "Screenshot_20171016_172927.png" added.

Chrome example

Django

unread,
Oct 16, 2017, 6:39:10 PM10/16/17
to django-...@googlegroups.com
#28716: search_fields = ['question_text'] from Tutorial07 not working.
-------------------------------------+-------------------------------------
Reporter: Patrick Kyne | Owner: nobody
Type: Bug | Status: new

Component: Documentation | Version: 1.11
Severity: Normal | Resolution:
Keywords: search_fields | Triage Stage:
documentation tutorial | Unreviewed
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Old description:

New description:

Following the django tutorial from the beginning, everything works as it
should except the Search Fields example in Tutorial 07.

Following the tutorial, my polls/admin.py appears below. However, no
search field appears in Google Chrome or in Firefox. No error is thrown by
the django server either. I did not find any relevant google responses to
the issue, nor did I find it here in Trac.

{{{
## polls/admin.py:
from django.contrib import admin

# Register your models here.

from .models import Question, Choice

class ChoiceInline(admin.TabularInline):
model = Choice
extra = 3


class QuestionAdmin(admin.ModelAdmin):
fieldsets = [
(None, {'fields': ['question_text']}),
('Date information', {'fields': ['pub_date'], 'classes':
['collapse']}),
]
inlines = [ChoiceInline]

list_display = ('question_text', 'pub_date', 'was_published_recently')

list_filter = ['pub_date']

search_fields = ['question_text']

admin.site.register(Question, QuestionAdmin)
}}}

System check identified no issues (0 silenced).
October 16, 2017 - 15:36:08
Django version 1.11.5, using settings 'mysite.settings'
Starting development server at http://127.0.0.1:8000/

{140}$ python
Python 3.6.2 (default, Aug 03 2017, 16:34:42) [GCC] on linux

--

Comment (by Patrick Kyne):

I've tested it with both the search_fields as:

{{{
search_fields = ['question_text']
}}}

-and-

{{{


search_fields = ['question_text', 'pub_date']
}}}

to see if there were any difference or error thrown. No difference. No
search field is displayed, and no error is thrown.

--
Ticket URL: <https://code.djangoproject.com/ticket/28716#comment:1>

Django

unread,
Oct 16, 2017, 7:23:59 PM10/16/17
to django-...@googlegroups.com
#28716: search_fields = ['question_text'] from Tutorial07 not working.
-------------------------------------+-------------------------------------
Reporter: Patrick Kyne | Owner: Patrick
| Kyne
Type: Bug | Status: assigned

Component: Documentation | Version: 1.11
Severity: Normal | Resolution:
Keywords: search_fields | Triage Stage:
documentation tutorial | Unreviewed
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Patrick Kyne):

* owner: nobody => Patrick Kyne
* status: new => assigned


Comment:

For the search_field to show up in the Admin website, all that was needed
was to stop (Ctrl-C) and restart the django test server. Then the search
field shows up as desired.

Perhaps the documentation should be updated to state this.

--
Ticket URL: <https://code.djangoproject.com/ticket/28716#comment:2>

Django

unread,
Oct 16, 2017, 7:29:44 PM10/16/17
to django-...@googlegroups.com
#28716: search_fields = ['question_text'] from Tutorial07 not working.
-------------------------------------+-------------------------------------
Reporter: Patrick Kyne | Owner: Patrick
| Kyne
Type: Bug | Status: closed
Component: Documentation | Version: 1.11
Severity: Normal | Resolution: fixed

Keywords: search_fields | Triage Stage:
documentation tutorial | Unreviewed
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Patrick Kyne):

* status: assigned => closed
* resolution: => fixed


Comment:

For the Search box to appear on the Admin website (and the search_fields
to function) a stop and restart of the django test server was required.

{{{
(Ctrl-C)

? python manage.py runserver

}}}


After that, the search box appeared and functioned as desired.

Perhaps the on-line tutorial should be updated to reflect this.

--Closing

--
Ticket URL: <https://code.djangoproject.com/ticket/28716#comment:3>

Reply all
Reply to author
Forward
0 new messages