Re: DJNAGO Many to Many field MultiSelect Into DropdownList

2021-10-19 Thread Sebastian Jung
This is Admin Frontend this has nothing to do with normal Frontend. In
Admin Frontend i have no experience...

Am Di., 19. Okt. 2021 um 09:55 Uhr schrieb 'Maryam Yousaf' via Django users
:

> It is not working with SelectMultiple. I can select multiple values but it
> is not showing any drop down.
>
> On Mon, 18 Oct 2021 at 16:07, Sebastian Jung 
> wrote:
>
>> Hello,
>>
>> then change in widgets Select() to SelectMultiple().
>>
>> https://docs.djangoproject.com/en/3.2/ref/forms/widgets/#selectmultiple
>>
>> Regards
>>
>> Am Mo., 18. Okt. 2021 um 15:51 Uhr schrieb 'Maryam Yousaf' via Django
>> users :
>>
>>> Hi,
>>>
>>> I have one manytomany field in one of my model which is currently coming
>>> as Multiselect but I need a dropdown where user can select multiple values
>>> as I have huge data to show.
>>>
>>> I am trying this in forms.py but it is not showing dropdown field.
>>>
>>> Kindly help me out.
>>>
>>> *Model.py:*
>>>
>>> class Chain(models.Model):
>>> chain_id = models.AutoField(primary_key=True)
>>> chain_name = models.CharField(max_length=255, unique=True)
>>> chain_type = models.ForeignKey(ChainType, on_delete=models.CASCADE)
>>> history = HistoricalRecords()
>>>
>>> def __str__(self):
>>> return self.chain_name
>>>
>>> class Meta:
>>> ordering = ('chain_name',)
>>>
>>>
>>> class Brg(models.Model):
>>> brg_campaign_id = models.AutoField(primary_key=True)
>>> campaign_tracking = models.ForeignKey(CampaignTracking,
>>> on_delete=models.CASCADE)
>>> brg_name = models.ForeignKey(Chain, on_delete=models.CASCADE,
>>> related_name="primary_brg",
>>> help_text='Add Brgs/chain names for these above campaign has run')
>>> brg_benchmark = models.ManyToManyField(Chain,
>>> related_name="competitor_brg", null=True,
>>> blank=True, help_text='Add max.5 other benchmarks brgs to check overall
>>> impact')
>>> history = HistoricalRecords()
>>>
>>> def __str__(self):
>>> return "Brg names list"
>>>
>>> class Meta:
>>> verbose_name = 'Brg Campaign Tracking'
>>>
>>> *forms.py:*
>>> class ChainForm(forms.ModelForm):
>>> class Meta:
>>> model: Chain
>>> # fields = ('campaign_tracking', 'brg_name', 'brg_benchmark',)
>>> widgets = {
>>> 'chain_name': Select(),
>>> }
>>>
>>> Regards,
>>> maryam
>>>
>>>
>>> --
>>> This email and any files transmitted with it contain confidential
>>> information and/or privileged or personal advice. This email is intended
>>> for the addressee(s) stated above only. If you are not the addressee of the
>>> email please do not copy or forward it or otherwise use it or any part of
>>> it in any form whatsoever. If you have received this email in error please
>>> notify the sender and remove the e-mail from your system. Thank you.
>>>
>>> This is an email from the company Just Eat Takeaway.com N.V., a public
>>> limited liability company with corporate seat in Amsterdam, the
>>> Netherlands, and address at Oosterdoksstraat 80, 1011 DK Amsterdam,
>>> registered with the Dutch Chamber of Commerce with number 08142836 and
>>> where the context requires, includes its subsidiaries and associated
>>> undertakings.
>>>
>>> --
>>> 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/ac59ba2a-5baa-4302-88c9-0dd17606fdaen%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/CAKGT9mwXNTc2638qv-vScbHZW2uRq3utmu%2BbfM5Mz06WERmt2g%40mail.gmail.com
>> 
>> .
>>
>
>
> --
> This email and any files transmitted with it contain confidential
> information and/or privileged or personal advice. This email is intended
> for the addressee(s) stated above only. If you are not the addressee of the
> email please do not copy or forward it or otherwise use it or any part of
> it in any form whatsoever. If you have received this email in error please
> notify the sender and remove the e-mail from your system. Thank you.
>
> This is an email from the company Just Eat Takeaway.com N.V., a public
> limited liability company with corporate seat in Amsterdam, the
> Netherlands, and address at Oosterdoksstraat 80, 1011 DK Amsterdam,
> registered with the Dutch Chamber of Commerce with number 08142836 and
> where 

django datatable

2021-10-19 Thread Eugene TUYIZERE
Please suggest a good CSS  for the datatable below
[image: image.png]
Regards,

-- 
*Eugene*

-- 
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/CABxpZHvN2XvzwQ0V4swjK1JD8MwY6Rq9tN8uUuqOpZFaqdjHdQ%40mail.gmail.com.


Re: What it takes to bring web application to a mobile app

2021-10-19 Thread Planet X
Hey there all all you Mind-blowing people
i am new in django i am trying to set my view and urls of app and project i 
tried lots of time it showing errors please help me out to do i want to 
learn with the help of your 

On Tuesday, October 19, 2021 at 2:31:53 PM UTC+5:30 ram.mu...@gmail.com 
wrote:

> Hi,
>
> We are planning to create a mobile app for our e-commerce web application 
> that is being developed on DJango, Python, VUE Js and we need to keep both 
> mobile and web interfaces but data should be synced seamlessly. Also we 
> don’t want responsive design web app in mobile view.
>
> Best regards,
> ~ Ram
> ~ Ram

-- 
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/53d6d752-020f-4df6-a250-44e80f19af58n%40googlegroups.com.


Django admin redirects behind nginx proxy subpath

2021-10-19 Thread Rodolphe Gohard

I am running a small django app with django admin.
In fact, I only use django admin to edit a few models.

It works fine in local and behind a simple proxy reverse, but now I have 
this kind a rewrite that changes the path: (it's a nginx ingress rewrite 
rule for Kubernetes)

path: /diagnosis-admin(/|$)(.*) => $2

Wich means, urls such as mydomain.com/diagnosis-admin redirect to 
localhost/ (mind the path change.

When I try to access the admin at mydomain.com/diagnosis-admin/admin, 
django tries to redirect to mydomain.com/admin/, which leads nowhere 
because it falls on the proxy:


   1. Request URL: 
  https://mydomain.com/diagnosis-admin/admin
  2. Request Method: 
  GET
  3. Status Code: 
  301 
  4. Remote Address: 
  138.21.17.33:3128
  5. Referrer Policy: 
  strict-origin-when-cross-origin
  1. Response Headers
  1. content-length: 
  0
  2. content-type: 
  text/html; charset=utf-8
  3. date: 
  Tue, 19 Oct 2021 15:11:42 GMT
  4. location: 
  /admin/
  5. script_name: 
  /diagnosis-admin
  6. strict-transport-security: 
  max-age=15724800; includeSubDomains
  7. x-content-type-options: 
  nosniff
   

I had this problems with other applicative frameworks but could solve it 
since they can interpret the FORWARDED_HOST, FORWARDED_PORT and 
FORWARDED_PATH headers provided by the proxy.

Searching the internets gave me tons of solutions for reverse proxy with 
simple rewrite rules with no path alterations, but here I am stuck 

I have no idea how to solve this withing django. Any help will be much 
appreciated


Additionnal information:
I run django with "python manage.py runserver 0.0.0.0:8000" on a docker 
container (running through GKE)

Everything is pretty standard, I ran the basic django project scafolding, 
setup the database, auto migrated the models and that's about it. I can 
provide additionnal files if needed



-- 
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/e962cece-fc2e-4010-aaf4-191d74fe74fdn%40googlegroups.com.


[no subject]

2021-10-19 Thread Waqas Ali
Hi Maryam whare you from?

-- 
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/CAF2yDDEhBoM9w4yw8XLHd8GbPnkZWYEPZ-QKooyzVYeMbS4_EA%40mail.gmail.com.


What it takes to bring web application to a mobile app

2021-10-19 Thread Ram Mullapudi
Hi,

We are planning to  create a mobile app for our e-commerce web application that 
is being developed  on  DJango, Python, VUE Js and we need to keep both mobile 
and web interfaces but data should be synced seamlessly. Also we don’t want 
responsive design web app in mobile view.

Best regards,
~ Ram
~ Ram

-- 
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/C8FC5E4A-F554-45D6-923B-D68440DFA16A%40gmail.com.


Re: TypeError __init__() takes 1 positional argument but 2 were given

2021-10-19 Thread Lalit Suthar
try changing this

def get_context_data(self, *args, **kwargs):
context = super(registro, self).get_context_data(*args, **kwargs)

to this

def get_context_data(self, **kwargs):
context = super(registro, self).get_context_data(**kwargs)

refer:
https://ccbv.co.uk/projects/Django/3.2/django.views.generic.edit/CreateView/

On Tue, 19 Oct 2021 at 02:27, Jose Cabrera  wrote:

> hello everyone, please help me with this error that is generated in the
> views.py, in class registro(CreateView):
> Thank you
> form.py
> class RegistrationForm(forms.ModelForm):
> password = forms.CharField(label='Password',
> widget=forms.PasswordInput)
> class Meta:
> model = UserProfile
> fields = ('email','password')
>
> def save(self, commit=True):
> # Save the provided password in hashed format
> user = super().save(commit=False)
> user.set_password(self.cleaned_data["password"])
> if commit:
> user.save()
> return user
>
> views.py
> from .models import UserProfile
> from .forms import RegistrationForm
> from django.views.generic.edit import CreateView, UpdateView
> from django.urls import reverse
>
> class registro(CreateView):
> template_name = 'registration/registro.html'
> form_class = RegistrationForm
>
> def get_context_data(self, *args, **kwargs):
> context = super(registro, self).get_context_data(*args, **kwargs)
> context['next'] = self.request.GET.get('next')
> return context
>
> def get_success_url(self):
> next_url = self.request.POST.get('next')
> success_url = reverse('home')
> if next_url:
> success_url += '?next={}'.format(next_url)
>
> return success_url
>
> --
> 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/070868ce-cd4a-4231-9685-38144e2cd417n%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/CAGp2JVFpOiQ04VLBwtFOhXh6SM4h4J6jL03EnikwowBmGux4Xw%40mail.gmail.com.