Issue Django V 1.11.16 Admin Search Not Working with all Data
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}
I developed an application form in Django I added 500 +- records using the Django admin, then I imported 9000 records using MySql. In the Django admin I can see all records perfectly. However, when I search for xxx record does not find it but I can see the record on the admin right there. It is weird because when I search the records I added using the Django admin the search works and display them correctly. If I want to search for a record or records that was imported using MySql import (9000 records) does not find them. If I filter them, yes I see the records, if I type the same search for the filter does not show them. I really appreciate your help. Thanks a MILLON.
This is for a Linux server running on AWS, running MySQL, Python, Django 1.11.16 I changed the filters, add filters, checked the search_fields, restart the server.
from django.contrib import admin
from .models import ApplicationForm, Supervisor
from .forms import AdminForm
from advanced_filters.admin import AdminAdvancedFiltersMixin
from apps.users import views
# Register your models here.
class ReadOnly(AdminAdvancedFiltersMixin, admin.ModelAdmin):
readonly_fields =
advanced_filter_fields = ('first_name', 'last_name', 'email', 'phoneNumber', 'city', 'state', 'socialSecurityNumber', 'other city', 'project', 'agreement_signed_date', 'middle_name', 'supervisor__name', 'gender', 'Marital_status', 'home_address1', 'home_address2', 'postCode', 'dateOFBirth', 'no_of_dependents', 'emergency_contact_firstName', 'emergency_contact_lastName', 'emergency_contact_phoneNumber', 'emergency_contact_relation', 'ceiling_mechanic', 'framing_mechanic', 'drywall_hanger', 'drywall_finisher', 'general_larborer', 'painter_tradesman', 'plaster_tradesman', 'layout_blueprint', 'drywall_wood_framing', 'drywall_painter', 'cabinets', 'safety_jobsite', 'masonry_bricklayer', 'masonry_blocklayer', 'carpenter', 'concrete_forming', 'concrete_finisher', 'osha_manager', 'project_manager', 'is_osha10', 'is_osha30', 'is_osha_training_manager', 'work_eligible_military')
def get_readonly_fields(self, request, obj=None):
group = request.user.groups.values_list('name', flat=True)
if len(group) == 0:
return list(self.readonly_fields) + ['id_identifier']
else:
if group[0] == 'View Users':
return list(self.readonly_fields) +
[field.name for field in obj._meta.fields] +
[field.name for field in obj._meta.many_to_many]
return self.readonly_fields
class ApplicationAdmin(ReadOnly):
form = AdminForm
list_display = ['id_identifier', 'first_name', 'last_name', 'email', 'phoneNumber','agreement_signed_date', 'city',
'reg_form_thumb', 'i9_form_thumb', 'w4_form_thumb']
list_filter = ['state', 'city', 'postCode']
search_fields = ['postCode', 'first_name', 'last_name', 'email', 'city', 'phoneNumber', 'project', 'phoneNumber', 'supervisor__name']
readonly_fields = ['id_identifier','created_date', 'last_update', 'reviewed_date']
I should see all data from the admin when I search but does not display all data.
Please take a look a the images and you will see the issue, if I search for ALTON it shows zero records, when I filter for ALTON it shows 5 results. Pretty weird.
Filtering data and display all forms
Searching the data and does not display anything
mysql django search
add a comment |
I developed an application form in Django I added 500 +- records using the Django admin, then I imported 9000 records using MySql. In the Django admin I can see all records perfectly. However, when I search for xxx record does not find it but I can see the record on the admin right there. It is weird because when I search the records I added using the Django admin the search works and display them correctly. If I want to search for a record or records that was imported using MySql import (9000 records) does not find them. If I filter them, yes I see the records, if I type the same search for the filter does not show them. I really appreciate your help. Thanks a MILLON.
This is for a Linux server running on AWS, running MySQL, Python, Django 1.11.16 I changed the filters, add filters, checked the search_fields, restart the server.
from django.contrib import admin
from .models import ApplicationForm, Supervisor
from .forms import AdminForm
from advanced_filters.admin import AdminAdvancedFiltersMixin
from apps.users import views
# Register your models here.
class ReadOnly(AdminAdvancedFiltersMixin, admin.ModelAdmin):
readonly_fields =
advanced_filter_fields = ('first_name', 'last_name', 'email', 'phoneNumber', 'city', 'state', 'socialSecurityNumber', 'other city', 'project', 'agreement_signed_date', 'middle_name', 'supervisor__name', 'gender', 'Marital_status', 'home_address1', 'home_address2', 'postCode', 'dateOFBirth', 'no_of_dependents', 'emergency_contact_firstName', 'emergency_contact_lastName', 'emergency_contact_phoneNumber', 'emergency_contact_relation', 'ceiling_mechanic', 'framing_mechanic', 'drywall_hanger', 'drywall_finisher', 'general_larborer', 'painter_tradesman', 'plaster_tradesman', 'layout_blueprint', 'drywall_wood_framing', 'drywall_painter', 'cabinets', 'safety_jobsite', 'masonry_bricklayer', 'masonry_blocklayer', 'carpenter', 'concrete_forming', 'concrete_finisher', 'osha_manager', 'project_manager', 'is_osha10', 'is_osha30', 'is_osha_training_manager', 'work_eligible_military')
def get_readonly_fields(self, request, obj=None):
group = request.user.groups.values_list('name', flat=True)
if len(group) == 0:
return list(self.readonly_fields) + ['id_identifier']
else:
if group[0] == 'View Users':
return list(self.readonly_fields) +
[field.name for field in obj._meta.fields] +
[field.name for field in obj._meta.many_to_many]
return self.readonly_fields
class ApplicationAdmin(ReadOnly):
form = AdminForm
list_display = ['id_identifier', 'first_name', 'last_name', 'email', 'phoneNumber','agreement_signed_date', 'city',
'reg_form_thumb', 'i9_form_thumb', 'w4_form_thumb']
list_filter = ['state', 'city', 'postCode']
search_fields = ['postCode', 'first_name', 'last_name', 'email', 'city', 'phoneNumber', 'project', 'phoneNumber', 'supervisor__name']
readonly_fields = ['id_identifier','created_date', 'last_update', 'reviewed_date']
I should see all data from the admin when I search but does not display all data.
Please take a look a the images and you will see the issue, if I search for ALTON it shows zero records, when I filter for ALTON it shows 5 results. Pretty weird.
Filtering data and display all forms
Searching the data and does not display anything
mysql django search
add a comment |
I developed an application form in Django I added 500 +- records using the Django admin, then I imported 9000 records using MySql. In the Django admin I can see all records perfectly. However, when I search for xxx record does not find it but I can see the record on the admin right there. It is weird because when I search the records I added using the Django admin the search works and display them correctly. If I want to search for a record or records that was imported using MySql import (9000 records) does not find them. If I filter them, yes I see the records, if I type the same search for the filter does not show them. I really appreciate your help. Thanks a MILLON.
This is for a Linux server running on AWS, running MySQL, Python, Django 1.11.16 I changed the filters, add filters, checked the search_fields, restart the server.
from django.contrib import admin
from .models import ApplicationForm, Supervisor
from .forms import AdminForm
from advanced_filters.admin import AdminAdvancedFiltersMixin
from apps.users import views
# Register your models here.
class ReadOnly(AdminAdvancedFiltersMixin, admin.ModelAdmin):
readonly_fields =
advanced_filter_fields = ('first_name', 'last_name', 'email', 'phoneNumber', 'city', 'state', 'socialSecurityNumber', 'other city', 'project', 'agreement_signed_date', 'middle_name', 'supervisor__name', 'gender', 'Marital_status', 'home_address1', 'home_address2', 'postCode', 'dateOFBirth', 'no_of_dependents', 'emergency_contact_firstName', 'emergency_contact_lastName', 'emergency_contact_phoneNumber', 'emergency_contact_relation', 'ceiling_mechanic', 'framing_mechanic', 'drywall_hanger', 'drywall_finisher', 'general_larborer', 'painter_tradesman', 'plaster_tradesman', 'layout_blueprint', 'drywall_wood_framing', 'drywall_painter', 'cabinets', 'safety_jobsite', 'masonry_bricklayer', 'masonry_blocklayer', 'carpenter', 'concrete_forming', 'concrete_finisher', 'osha_manager', 'project_manager', 'is_osha10', 'is_osha30', 'is_osha_training_manager', 'work_eligible_military')
def get_readonly_fields(self, request, obj=None):
group = request.user.groups.values_list('name', flat=True)
if len(group) == 0:
return list(self.readonly_fields) + ['id_identifier']
else:
if group[0] == 'View Users':
return list(self.readonly_fields) +
[field.name for field in obj._meta.fields] +
[field.name for field in obj._meta.many_to_many]
return self.readonly_fields
class ApplicationAdmin(ReadOnly):
form = AdminForm
list_display = ['id_identifier', 'first_name', 'last_name', 'email', 'phoneNumber','agreement_signed_date', 'city',
'reg_form_thumb', 'i9_form_thumb', 'w4_form_thumb']
list_filter = ['state', 'city', 'postCode']
search_fields = ['postCode', 'first_name', 'last_name', 'email', 'city', 'phoneNumber', 'project', 'phoneNumber', 'supervisor__name']
readonly_fields = ['id_identifier','created_date', 'last_update', 'reviewed_date']
I should see all data from the admin when I search but does not display all data.
Please take a look a the images and you will see the issue, if I search for ALTON it shows zero records, when I filter for ALTON it shows 5 results. Pretty weird.
Filtering data and display all forms
Searching the data and does not display anything
mysql django search
I developed an application form in Django I added 500 +- records using the Django admin, then I imported 9000 records using MySql. In the Django admin I can see all records perfectly. However, when I search for xxx record does not find it but I can see the record on the admin right there. It is weird because when I search the records I added using the Django admin the search works and display them correctly. If I want to search for a record or records that was imported using MySql import (9000 records) does not find them. If I filter them, yes I see the records, if I type the same search for the filter does not show them. I really appreciate your help. Thanks a MILLON.
This is for a Linux server running on AWS, running MySQL, Python, Django 1.11.16 I changed the filters, add filters, checked the search_fields, restart the server.
from django.contrib import admin
from .models import ApplicationForm, Supervisor
from .forms import AdminForm
from advanced_filters.admin import AdminAdvancedFiltersMixin
from apps.users import views
# Register your models here.
class ReadOnly(AdminAdvancedFiltersMixin, admin.ModelAdmin):
readonly_fields =
advanced_filter_fields = ('first_name', 'last_name', 'email', 'phoneNumber', 'city', 'state', 'socialSecurityNumber', 'other city', 'project', 'agreement_signed_date', 'middle_name', 'supervisor__name', 'gender', 'Marital_status', 'home_address1', 'home_address2', 'postCode', 'dateOFBirth', 'no_of_dependents', 'emergency_contact_firstName', 'emergency_contact_lastName', 'emergency_contact_phoneNumber', 'emergency_contact_relation', 'ceiling_mechanic', 'framing_mechanic', 'drywall_hanger', 'drywall_finisher', 'general_larborer', 'painter_tradesman', 'plaster_tradesman', 'layout_blueprint', 'drywall_wood_framing', 'drywall_painter', 'cabinets', 'safety_jobsite', 'masonry_bricklayer', 'masonry_blocklayer', 'carpenter', 'concrete_forming', 'concrete_finisher', 'osha_manager', 'project_manager', 'is_osha10', 'is_osha30', 'is_osha_training_manager', 'work_eligible_military')
def get_readonly_fields(self, request, obj=None):
group = request.user.groups.values_list('name', flat=True)
if len(group) == 0:
return list(self.readonly_fields) + ['id_identifier']
else:
if group[0] == 'View Users':
return list(self.readonly_fields) +
[field.name for field in obj._meta.fields] +
[field.name for field in obj._meta.many_to_many]
return self.readonly_fields
class ApplicationAdmin(ReadOnly):
form = AdminForm
list_display = ['id_identifier', 'first_name', 'last_name', 'email', 'phoneNumber','agreement_signed_date', 'city',
'reg_form_thumb', 'i9_form_thumb', 'w4_form_thumb']
list_filter = ['state', 'city', 'postCode']
search_fields = ['postCode', 'first_name', 'last_name', 'email', 'city', 'phoneNumber', 'project', 'phoneNumber', 'supervisor__name']
readonly_fields = ['id_identifier','created_date', 'last_update', 'reviewed_date']
I should see all data from the admin when I search but does not display all data.
Please take a look a the images and you will see the issue, if I search for ALTON it shows zero records, when I filter for ALTON it shows 5 results. Pretty weird.
Filtering data and display all forms
Searching the data and does not display anything
mysql django search
mysql django search
asked Jan 4 at 2:50
sannickosannicko
12
12
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
Well! I have fixed the issue installing the django-haystack, elasticsearch, pyelasticsearch modules. The search is working perfectly. Cheers!
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54032550%2fissue-django-v-1-11-16-admin-search-not-working-with-all-data%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Well! I have fixed the issue installing the django-haystack, elasticsearch, pyelasticsearch modules. The search is working perfectly. Cheers!
add a comment |
Well! I have fixed the issue installing the django-haystack, elasticsearch, pyelasticsearch modules. The search is working perfectly. Cheers!
add a comment |
Well! I have fixed the issue installing the django-haystack, elasticsearch, pyelasticsearch modules. The search is working perfectly. Cheers!
Well! I have fixed the issue installing the django-haystack, elasticsearch, pyelasticsearch modules. The search is working perfectly. Cheers!
answered Jan 5 at 19:35
sannickosannicko
12
12
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54032550%2fissue-django-v-1-11-16-admin-search-not-working-with-all-data%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown