how to show liste filtre admin django ManyToOne
how to show liste filtre admin django ManyToOne in this case : in models.py --- class Personne(models.Model): name= models.CharField(max_length=50,blank=False) def __str__(self): return self.name class Project(models.Model): title= models.CharField(max_length=50,blank=False) note= models.CharField(max_length=50,blank=False) def __str__(self): return self.title class Task(models.Model): title= models.CharField(max_length=50,blank=False) projecttasktask= models.ForeignKey(Project, on_delete=models.CASCADE) personnetask= models.ForeignKey(Personne, on_delete=models.CASCADE) def __str__(self): return self.title in admin.py --- ProjectAdmin(admin.ModelAdmin): list_filter = () How can i filtre in Project by tasks and specialy by Personne liste dropdown of personne and show me liste of projects ? best ragards -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/b5782617-a2c9-480a-90e7-8204b7143b7bn%40googlegroups.com.
how to show liste filtre admin django ManyToOne Please
how to show liste filtre admin django ManyToOne in this case : [image: Sans titre 9.jpg] How can i filtre in Project by tasks and specialy by Personne liste dropdown of personne and show me liste of projects ? best ragards -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/fe0edeca-f6a0-49b7-8199-697447f895ccn%40googlegroups.com.
How to get Dependent Dropdown Feilds in Django ModelForms. Please answer : Important
Hi You need to use some JQUERY code You need this in admin or frontend ? -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/759c74e5-c2ae-4b5a-af7d-fb6d58bedcb7o%40googlegroups.com.
Re: How to get Dependent Dropdown Feilds in Django ModelForms. Please answer : Important
You 'll use JQUERY normal as the same in html You need every html id (so you cab add on change) JQUERY on change select Show hidden popup / or show hidden input Share your code. -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/45f6db02-6231-4e49-b97a-93565012abf9o%40googlegroups.com.
Re: How to get Dependent Dropdown Feilds in Django ModelForms. Please answer : Important
rt models > from datetime import datetime, date, timedelta > from django.core.validators import RegexValidator > > # Create your models here. > #New Client model > class NewClient(models.Model): > #choices for selection > > > status_choice = [ > ('active', 'Active'), > ('inactive', 'In-Active'), > ] > > #User Input Feilds > business_name = models.CharField(max_length=1024, help_text='Enter > Your Business Name') > legal_name = models.CharField(max_length=1024, help_text='Enter Legal > Name, if different from the Business') > nature_of_business = models.CharField(max_length=1024) > years_in_business = models.PositiveIntegerField(default=0) > company_type = models.CharField(max_length=20) > #Data provided by Tool to reflect in Database > association_name = models.CharField(max_length=20, default='OCIBP') > group = models.CharField(max_length=30, default='', null=True) > code = models.CharField(max_length=10, default='000') > status = models.CharField(max_length=15, choices=status_choice, > default='active') > > anniversery_date=models.DateTimeField(default=datetime.now()+timedelta(days=365)) > service_rep = models.CharField(max_length=50, default='Carolina') > sales_person = models.CharField(max_length=50, default='Robert > Perusco') > renewal_agent = models.CharField(max_length=50, default='Merit > Ontario') > first_billing_period = models.DateField(auto_now_add=True) > created_on = models.DateField(auto_now=True) > created_by = models.DateField(null=True) > last_updated_on = models.DateField(null=True) > last_updated_by = models.DateField(null=True) > current_state = models.CharField(max_length=15, default='open') > original_service_date = models.DateField(auto_now_add=True) > cert_length = models.PositiveIntegerField(null=True) > cert_start = models.DateField(null=True) > require_pin = models.CharField(max_length=15, null=True) > require_alt_pin = models.CharField(max_length=15, null=True) > > > > > > def __str__(self): > return self.business_name > > #BillingGroup Model > > class BillingGroup(models.Model): > client = models.ForeignKey(NewClient) > name = models.CharField(max_length=1024, default='Administration Fee') > billing_type = models.CharField(max_length=1024, default='Per Person > Charge') > remit_to = models.CharField(max_length=1024, default = 'BSL') > language = models.CharField(max_length=50, default='English') > legacy_system_code = models.CharField(max_length=20, null=True) > carrier_division_code = models.CharField(max_length=20, null=True) > invoice_override = models.CharField(max_length=20, null=True) > address_1 = models.CharField("Address line 1",max_length=1024,) > address_2 = models.CharField("Address line 2",max_length=1024,) > city = models.CharField("City",max_length=1024,) > province = models.CharField("Province",max_length=30,) > country = models.CharField("Country", max_length=30) > zip_code = models.CharField("ZIP / Postal code",max_length=12,) > first_name = models.CharField("First Name", max_length=30, ) > last_name = models.CharField("Last Name", max_length=30,) > title = models.CharField("Title/Position", max_length=1024) > email = models.EmailField("Authorized - Email", max_length=254) > phone_regex = RegexValidator(regex=r'^\+?1?\d{9,15}$', message="Phone > number must be entered in the format: '+9'. Up to 15 digits > allowed.") > phone_number = models.CharField(validators=[phone_regex], > max_length=17, blank=True) # validators should be a list > fax = models.CharField(max_length=30, null=True) > send_notification = models.BooleanField(default=True) > executive_authority = models.CharField(verbose_name = "Is This Person > also has Signing Authority", max_length=15,) > exec_first_name = models.CharField("Executive First Name", > max_length=30, ) > exec_last_name = models.CharField("Executive Last Name", > max_length=30,) > exec_title = models.CharField("Executive Title/Position", > max_length=1024) > exec_email = models.EmailField("Executive - Email", max_length=254) > exec_phone_regex = RegexValidator(regex=r'^\+?1?\d{9,15}$', > message="Phone number must be entered in the format: '+9'. Up to 15 > digits allowed.") > exec_phone_number = models.CharField("Executive Phone > Number",validators=[phone_regex], max_length=17, blank=True) > exec_fax = models.CharField("Fax number",max_length=30, null=True) > payment_type = models.CharField(max_length=30) > institution_code = models.CharField(max_length=30) > branch_number = models.CharField(max_length=30) > account_number = models.CharField(max_length=30) > withdraw_day = models.DateField(null=True, blank=True) > federal_tax_province = models.CharField(max_length=30, > default="Ontario") > > def __str__(self): > return self.client > > *client.html* > > ** > {% extends 'er_form/index.html' %} > > {% block content %} > > > > {% csrf_token %} > {{ client_form.as_p }} > {{ billing_form.as_p }} > Submit > > > > {% endblock content %} > > ** > *urls.py* > * > from django.conf.urls import url > from er_form import views > > urlpatterns = [ > url('', views.client, name="client"), > ] > * > I am combining two model forms into a single HTML template. > > Please have a look AZIZ sir > > > On Sun, Jun 7, 2020 at 11:53 AM AMINE AZIZ > wrote: > >> You 'll use JQUERY normal as the same in html >> >> You need every html id (so you cab add on change) >> >> JQUERY on change select >> Show hidden popup / or show hidden input >> >> Share your code. >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Django users" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to django...@googlegroups.com . >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/django-users/45f6db02-6231-4e49-b97a-93565012abf9o%40googlegroups.com >> . >> > -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/aaa4eb47-7f2f-463a-a341-d910c5ec4baeo%40googlegroups.com.
Re: How to get Dependent Dropdown Feilds in Django ModelForms. Please answer : Important
I will share with you my iwn code used in admin , but it still the same as the front end withe jQuery i can show input or hide it , so you will do the same with popup , by default it will be display none, and with Jquery you can show it if user change value to yes dropdown (select) you will use id div of pupup to show it or hide it if (!$) { // Need this line because Django also provided jQuery and namespaced as django.jQuery $ = django.jQuery; } $(document).ready(function() { $("#id_paysPartenaires").change(function() { var total_partenaire=$("#id_multipartenairecooperationbilaterale_set-TOTAL_FORMS").val() var SelectNumber = i SelectedValuePartenaire=$("#id_multipartenairecooperationbilaterale_set-"+SelectNumber+"-multiPartenairePP").val() //alert(SelectNumber) $("[id=div-2-multiAdefinir]:eq("+SelectNumber+")").hide(); $("[id=div-2-multiGouvernementPP]:eq("+SelectNumber+")").hide(); $("[id=div-2-multiGouvernementPP]:eq("+SelectNumber+")").hide(); $("[id=div-2-multiPaysPP]:eq("+SelectNumber+")").show(); } }); Le dimanche 7 juin 2020 07:34:00 UTC+1, Sai a écrit : > > Hi guys, > I am working on a* Django project,* which involves submission form and > saving the data in the database using model form. I am stuck with one of > the functionalities of form which should work like for example "do you want > benefit plan: *YES,* *next Field options should pop up*. if click* NO, > nothing should happen* and move to the next question." > > I went through all over the internet and found the dependent drop-down > select option but not like field pop up as we click through te form. > > Please let me know how to achieve this in a clear way as I am new to > Django and programming as well. > > Thank You so much in advance. > -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/3f3bf262-7fac-4818-836e-dc8532dae707o%40googlegroups.com.
Re: How to get Dependent Dropdown Feilds in Django ModelForms. Please answer : Important
👍🏻 Shre your code, so it will help others. And if you can, change to resoulved, so it will be marked in Google search Best regards -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/0986b7a6-ac98-4687-8d21-1d45917984f6o%40googlegroups.com.
Problem to see file or image uploaded in admin django
Problem to see file or image uploaded in admin django see image below my setting.py import os from django.utils.translation import gettext_lazy as _ # Build paths inside the project like this: os.path.join(BASE_DIR, ...) BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) LOCALE_PATHS = [os.path.join(BASE_DIR, 'locale')] # Quick-start development settings - unsuitable for production # See https://docs.djangoproject.com/en/3.0/howto/deployment/checklist/ # SECURITY WARNING: keep the secret key used in production secret! SECRET_KEY = '##' AUTH_PROFILE_MODULE= 'system.UserProfile' # SECURITY WARNING: don't run with debug turned on in production! DEBUG = True JQUERY_URL = False USE_DJANGO_JQUERY = True ALLOWED_HOSTS = [] MEDIA_ROOT = os.path.join(BASE_DIR, 'media') MEDIA_URL = 'media/' LANGUAGES = [ ('en', _('English')), ('ar', _('Arabe')), ] INSTALLED_APPS = [ 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'smart_selects', 'fieldsets_with_inlines', 'easy_thumbnails', 'image_cropping', 'file_resubmit', 'admin_reorder', 'system', ] from easy_thumbnails.conf import Settings as thumbnail_settings THUMBNAIL_PROCESSORS = ( 'image_cropping.thumbnail_processors.crop_corners', ) + thumbnail_settings.THUMBNAIL_PROCESSORS CACHES = { 'default': { 'BACKEND': 'django.core.cache.backends.locmem.LocMemCache', }, "file_resubmit": { 'BACKEND': 'django.core.cache.backends.filebased.FileBasedCache', "LOCATION": '/tmp/file_resubmit/' },} MIDDLEWARE = [ 'django.middleware.security.SecurityMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.common.CommonMiddleware', #'admin_reorder.middleware.ModelAdminReorder', 'django.middleware.csrf.CsrfViewMiddleware', 'django.middleware.locale.LocaleMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', ] ROOT_URLCONF = 'portail.urls' TEMPLATES = [ { 'BACKEND': 'django.template.backends.django.DjangoTemplates', 'DIRS': [os.path.join(BASE_DIR, "templates"),], 'APP_DIRS': True, 'OPTIONS': { 'context_processors': [ 'django.template.context_processors.debug', 'django.template.context_processors.request', 'django.contrib.auth.context_processors.auth', 'django.contrib.messages.context_processors.messages', ], }, }, ] # Password validation # https://docs.djangoproject.com/en/3.0/ref/settings/#auth-password-validators AUTH_PASSWORD_VALIDATORS = [ { 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', }, { 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', }, { 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', }, { 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', }, ] # Internationalization # https://docs.djangoproject.com/en/3.0/topics/i18n/ LANGUAGE_CODE = 'en-us' TIME_ZONE = 'UTC' USE_I18N = True USE_L10N = True USE_TZ = True # Static files (CSS, JavaScript, Images) # https://docs.djangoproject.com/en/3.0/howto/static-files/ # Internationalization # https://docs.djangoproject.com/en/3.0/topics/i18n/ LANGUAGE_CODE = 'en' TIME_ZONE = 'UTC' USE_I18N = True USE_L10N = True USE_TZ = True # Static files (CSS, JavaScript, Images) # https://docs.djangoproject.com/en/3.0/howto/static-files/ STATIC_URL = '/static/' STATIC_ROOT = os.path.join(BASE_DIR, 'static') -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/782e3c34-27d2-4b27-b258-1fe40aeac128n%40googlegroups.com.
Re: Problem to see file or image uploaded in admin django
i found solution just i need to change media/ to /media/ :) Le lun. 24 août 2020 à 15:40, Ogunsanya Opeyemi a écrit : > Hi, do you have pillow installed in your library. and look for the image > in that path in your local directory. > > > On Mon, Aug 24, 2020 at 12:59 PM AMINE AZIZ wrote: > >> Problem to see file or image uploaded in admin django >> >> see image below >> >> my setting.py >> >> >> >> import os >> from django.utils.translation import gettext_lazy as _ >> >> >> >> # Build paths inside the project like this: os.path.join(BASE_DIR, ...) >> BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) >> LOCALE_PATHS = [os.path.join(BASE_DIR, 'locale')] >> >> # Quick-start development settings - unsuitable for production >> # See https://docs.djangoproject.com/en/3.0/howto/deployment/checklist/ >> >> >> >> >> # SECURITY WARNING: keep the secret key used in production secret! >> SECRET_KEY = '##' >> AUTH_PROFILE_MODULE= 'system.UserProfile' >> # SECURITY WARNING: don't run with debug turned on in production! >> DEBUG = True >> JQUERY_URL = False >> USE_DJANGO_JQUERY = True >> ALLOWED_HOSTS = [] >> >> MEDIA_ROOT = os.path.join(BASE_DIR, 'media') >> MEDIA_URL = 'media/' >> >> LANGUAGES = [ >> ('en', _('English')), >> ('ar', _('Arabe')), >> ] >> >> INSTALLED_APPS = [ >> 'django.contrib.admin', >> >> 'django.contrib.auth', >> 'django.contrib.contenttypes', >> 'django.contrib.sessions', >> 'django.contrib.messages', >> 'django.contrib.staticfiles', >> 'smart_selects', >> 'fieldsets_with_inlines', >> 'easy_thumbnails', >> 'image_cropping', >> 'file_resubmit', >> 'admin_reorder', >> 'system', >> ] >> >> >> from easy_thumbnails.conf import Settings as thumbnail_settings >> THUMBNAIL_PROCESSORS = ( >> 'image_cropping.thumbnail_processors.crop_corners', >> ) + thumbnail_settings.THUMBNAIL_PROCESSORS >> >> >> CACHES = { >> 'default': { >> 'BACKEND': 'django.core.cache.backends.locmem.LocMemCache', >> }, >> "file_resubmit": { >> 'BACKEND': 'django.core.cache.backends.filebased.FileBasedCache', >> "LOCATION": '/tmp/file_resubmit/' >> },} >> >> MIDDLEWARE = [ >> 'django.middleware.security.SecurityMiddleware', >> 'django.contrib.sessions.middleware.SessionMiddleware', >> 'django.middleware.common.CommonMiddleware', >> #'admin_reorder.middleware.ModelAdminReorder', >> 'django.middleware.csrf.CsrfViewMiddleware', >> 'django.middleware.locale.LocaleMiddleware', >> 'django.contrib.auth.middleware.AuthenticationMiddleware', >> 'django.contrib.messages.middleware.MessageMiddleware', >> 'django.middleware.clickjacking.XFrameOptionsMiddleware', >> ] >> >> ROOT_URLCONF = 'portail.urls' >> >> TEMPLATES = [ >> { >> 'BACKEND': 'django.template.backends.django.DjangoTemplates', >>'DIRS': [os.path.join(BASE_DIR, "templates"),], >> 'APP_DIRS': True, >> 'OPTIONS': { >> 'context_processors': [ >> 'django.template.context_processors.debug', >> 'django.template.context_processors.request', >> 'django.contrib.auth.context_processors.auth', >> 'django.contrib.messages.context_processors.messages', >> ], >> }, >> }, >> ] >> >> >> # Password validation >> # >> https://docs.djangoproject.com/en/3.0/ref/settings/#auth-password-validators >> >> AUTH_PASSWORD_VALIDATORS = [ >> { >> 'NAME': >> 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', >> }, >> { >> 'NAME': >> 'django.contrib.