Re: HOW TO REDIRECT DIFFERENT CATEGORY OF USERS THROUGH LOGIN REDIRECT (two login redirects instead of one)

2020-07-12 Thread Kuntal Paul
Thanks a lot for help. That worked.

On Sat, Jul 11, 2020, 11:47 PM oba stephen  wrote:

> It should work.
>
> Try the link Damanjeet shared.
> If you still get an error, share the error message.
>
> On Sat, Jul 11, 2020 at 6:57 PM Damanjeet Singh 
> wrote:
>
>> Please check this answer
>> https://stackoverflow.com/questions/16824004/django-conditional-login-redirect
>>
>> On Sat, 11 Jul 2020, 18:22 Kuntal Paul,  wrote:
>>
>>> Thank you for your response. I did this way and it was giving me a 405
>>> error. I couldn't find my mistake. I was saving both of them as student and
>>> as teacher separately from auth.user.
>>>  Also, do I have to provide a separate temple for that view?
>>>
>>>
>>> On Sat, Jul 11, 2020, 10:41 PM oba stephen 
>>> wrote:
>>>
 You can consider redirecting to a URL that handles the request.

 That is a View function that checks if the user is a student or
 teacher, then renders the respective profiles.

 Regards

 On Sat, Jul 11, 2020 at 5:58 PM Kuntal Paul 
 wrote:

> The *LOGIN_REDIRECT_URL*  only allowing to redirect to a particular
> profile page. But in scenarios like where there are *students* and
> *teachers*, both of them need their specific profile page after
> login.
>
> Using* LOGIN_REDIRECT_URL*, both the teachers and the students are
> getting redirected to the same profile ( in my case, both of them either
> entirely to teachers profile or entirely to students profile).
>
> How can I set *two login redirects instead of one*? I searched in the
> documentation, online videos, and everything but couldn't find such. 
> Please
> help me with resources/codes/guide/etc from where I can learn from and
> implement. I'm pretty new to this and have tried whatever I know till now.
>
> Thank You.
>
> --
> 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/e185b4ba-2219-4a1b-bba2-8ef4e4466682o%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/CAAJsLnqfSPy0VEjpv9TrPS-qcFTWjrtQqhFMMQs8B6qqUX5XOw%40mail.gmail.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/CABD8006ftC%3DtPyk%2BFWikZ0mGLGpiNBnFicU6eq2cL-mRcO-LbA%40mail.gmail.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/CAGLHGi4c2yJju-91NAivt_gOeoD%3DyhaUq___VjEuUnADrtoyNw%40mail.gmail.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/CAAJsLnob_HXQB8jRndd%2Bm4hswgKcewsn%3D28adVNw0xgnOQWi1Q%40mail.gmail.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 o

Django deployment on linux rhel 7

2020-07-12 Thread ashish goyal
Hi,

Anyone done django deployment on linux rhel 7 and bootstrap working fine with 
below command
python manage.py runserver 

Need help

Thanks
Ashish

-- 
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/08B5234D-64F5-40DD-8252-EE2B0AB1AC37%40gmail.com.


want to take input of datetimefield from my template

2020-07-12 Thread Chander shekhar
starttime=datetimefield()

i want to take datetimefield from my template but i am not able to do it.
i have created the form and passed the widget of datetime-local but it is 
not acceptable ,it is giving me error .
Help me to resolve it .
It's important 

-- 
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/14540560-2e99-4f53-852d-67fefad5ade7o%40googlegroups.com.


Re: Django deployment on linux rhel 7

2020-07-12 Thread Kasper Laudrup
On July 12, 2020 2:16:19 PM GMT+02:00, ashish goyal  
wrote:
>Hi,
>
>Anyone done django deployment on linux rhel 7 and bootstrap working
>fine with below command
>python manage.py runserver 
>
>Need help
>

https://simpleisbetterthancomplex.com/tutorial/2017/05/23/how-to-deploy-a-django-application-on-rhel.html

Hi Ashish

-- 
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/02712700-604F-42E5-A7C5-0BF90634447C%40stacktrace.dk.


Re: want to take input of datetimefield from my template

2020-07-12 Thread Kasper Laudrup
On July 12, 2020 3:02:00 PM GMT+02:00, Chander shekhar  
wrote:
>starttime=datetimefield()
>
>i want to take datetimefield from my template but i am not able to do
>it.
>i have created the form and passed the widget of datetime-local but it
>is 
>not acceptable ,it is giving me error .
>Help me to resolve it .
>It's important 

It will be a lot easier for people to help you if you share which kind of error 
you are getting.

Kind regards,

Kasper Laudrup

-- 
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/7D0D33A0-8A01-48F7-9928-A8465CC40066%40stacktrace.dk.


Re: Django deployment on linux rhel 7

2020-07-12 Thread Ajish Gopinath
Yes, I have installed and its working fine.

On Sun, 12 Jul 2020 at 17:47, ashish goyal 
wrote:

> Hi,
>
> Anyone done django deployment on linux rhel 7 and bootstrap working fine
> with below command
> python manage.py runserver
>
> Need help
>
> Thanks
> Ashish
>
> --
> 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/08B5234D-64F5-40DD-8252-EE2B0AB1AC37%40gmail.com
> .
>


-- 
Wish you all the best
Ajish Nair
9916353500

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


Re: Django deployment on linux rhel 7

2020-07-12 Thread Kasper Laudrup
On July 12, 2020 4:41:31 PM GMT+02:00, Ashish General 
 wrote:
>Hi Kasper,
>
>Thanks that link is good for reference but I just try to run run server
>with below command but bootstrap is not getting loaded. Same project on
>win10 is loading bootstrap correctly. Can you help
>

Send your replies to the mailing list, not just to me.

No, I can't help.

Kind regards,

Kasper Laudrup

-- 
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/DFABB250-6572-4D5F-829E-6ED331CAB945%40stacktrace.dk.


randomizing objects in the view with pagination

2020-07-12 Thread John McClain
I have a marketplace with many sellers selling the same 3 products in
various values. In all the are 18 product type for sell on the platform
with hundreds of sellers.

I was randomizing the product category page when loaded so that items from
all sellers could appear on the page.

I was not using paginations and I have thousands of products so the page
was obviously loading very slow.

I added pagination and let python manage the query instead of it happening
on the server-side. This increased the page load but I lost my
randomization.

The first page is the only page getting random items loaded. When using
pagination to get to the 2nd page the items loading on that page are
descending oldest to newest.

Does anyone have an idea how to manage randomizing items on each new page?

I am django core paginator

https://docs.djangoproject.com/en/3.0/ref/paginator/

Any ideas would be appreciated

Cheers,

John

-- 
John McClain

Cell: 085-1977-823
Skype: jmcclain0129
Email: jmcclain0...@gmail.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/CAN-hv_qyzZQdCXJBRs_a-3MEt46%3DsOtXvknNuEVBzWNZ_bk5Xg%40mail.gmail.com.


Re: randomizing objects in the view with pagination

2020-07-12 Thread MUGOYA DIHFAHSIH
Am anxiously waiting for the answer to this question cos i would like to do
the same for my django web app

On Sun, Jul 12, 2020, 19:46 John McClain  wrote:

> I have a marketplace with many sellers selling the same 3 products in
> various values. In all the are 18 product type for sell on the platform
> with hundreds of sellers.
>
> I was randomizing the product category page when loaded so that items from
> all sellers could appear on the page.
>
> I was not using paginations and I have thousands of products so the page
> was obviously loading very slow.
>
> I added pagination and let python manage the query instead of it happening
> on the server-side. This increased the page load but I lost my
> randomization.
>
> The first page is the only page getting random items loaded. When using
> pagination to get to the 2nd page the items loading on that page are
> descending oldest to newest.
>
> Does anyone have an idea how to manage randomizing items on each new page?
>
> I am django core paginator
>
> https://docs.djangoproject.com/en/3.0/ref/paginator/
>
> Any ideas would be appreciated
>
> Cheers,
>
> John
>
> --
> John McClain
>
> Cell: 085-1977-823
> Skype: jmcclain0129
> Email: jmcclain0...@gmail.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/CAN-hv_qyzZQdCXJBRs_a-3MEt46%3DsOtXvknNuEVBzWNZ_bk5Xg%40mail.gmail.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/CAP%3DJD9z6-8PXmm5Pmh8LjTCi7m%2BajFG1wwWPQZGFZ56W5%2BooQw%40mail.gmail.com.


Re: randomizing objects in the view with pagination

2020-07-12 Thread Damanjeet Singh
Hello,

I have been using random module (django-random-queryset)  for site
https://www.euroautozone.com. Performance is not bad.

here is the code

models.py

class product(models.Model):
##Slug
objects = RandomManager()

Views.py

   query = product.objects.filter(Q(title__icontains=query)

  |
  Q(description__icontains=query)
  |
  Q(customLabel__icontains=query)
  |
  Q(advertiserName__icontains=query)
  |
  Q(brand__icontains=query)

).filter(siteName__icontains=getCurrentSite(request)).distinct()

 all_information=query.random(1000)


Regards,

Damanjeet


On Sun, Jul 12, 2020 at 7:57 PM MUGOYA DIHFAHSIH 
wrote:

> Am anxiously waiting for the answer to this question cos i would like to
> do the same for my django web app
>
> On Sun, Jul 12, 2020, 19:46 John McClain  wrote:
>
>> I have a marketplace with many sellers selling the same 3 products in
>> various values. In all the are 18 product type for sell on the platform
>> with hundreds of sellers.
>>
>> I was randomizing the product category page when loaded so that items
>> from all sellers could appear on the page.
>>
>> I was not using paginations and I have thousands of products so the page
>> was obviously loading very slow.
>>
>> I added pagination and let python manage the query instead of it
>> happening on the server-side. This increased the page load but I lost my
>> randomization.
>>
>> The first page is the only page getting random items loaded. When using
>> pagination to get to the 2nd page the items loading on that page are
>> descending oldest to newest.
>>
>> Does anyone have an idea how to manage randomizing items on each new page?
>>
>> I am django core paginator
>>
>> https://docs.djangoproject.com/en/3.0/ref/paginator/
>>
>> Any ideas would be appreciated
>>
>> Cheers,
>>
>> John
>>
>> --
>> John McClain
>>
>> Cell: 085-1977-823
>> Skype: jmcclain0129
>> Email: jmcclain0...@gmail.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/CAN-hv_qyzZQdCXJBRs_a-3MEt46%3DsOtXvknNuEVBzWNZ_bk5Xg%40mail.gmail.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/CAP%3DJD9z6-8PXmm5Pmh8LjTCi7m%2BajFG1wwWPQZGFZ56W5%2BooQw%40mail.gmail.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/CAGLHGi6sn6T1AFE6RF%2BPCuiv9Sy%3DkEi_Q-PDLUWQom%3DhByjhOw%40mail.gmail.com.


Multiple DB

2020-07-12 Thread Soumen Khatua
Hi Folks,
Actually I want to set up multiple Databases like one DB for User-specific
table and another DB for Blog Post, But in this case, User should be a
Foreign Key in Post table. Is it possible to do that, if it is then How I
can write a query(ORM)?


Thank  you

Regards,
Soumen

-- 
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/CAPUw6WbcsivMS4Ahwc6SGxjyWhcSzeAwG6VKe%3DsfoBUVAbz%2BkQ%40mail.gmail.com.


Error or stack trace redirection in Django

2020-07-12 Thread Ram
Hi,

When a failure is happened in Django web application, we noticed that the
error is returned directly on the web browser as shown in the attached
snap. We wanted to understand whether this is expected as per Django FWK or
are we doing something wrong in our coding itself?  I believe we should
never display anything other than error message that is explicity provided
in coding statement, e.g. "Invalid login Id".

If coding needs to be changed here to avoid stack trace on the user
browsers, what should be changed here?

Thanks,
~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/CA%2BOi5F1J873Mk5BxO66cQ8TJk6sTAM-TwCBL7gYwJ%2B7p-086Ww%40mail.gmail.com.


Re: Error or stack trace redirection in Django

2020-07-12 Thread Christophe Pettus



> On Jul 12, 2020, at 19:08, Ram  wrote:
> 
> If coding needs to be changed here to avoid stack trace on the user browsers, 
> what should be changed here? 

You have DEBUG = True; that will result in the debugging output you see.  You 
shouldn't ever have it turned on for a production website.

--
-- Christophe Pettus
   x...@thebuild.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/0BCA3B5B-7C4E-4D94-89DE-7B94A5C4B201%40thebuild.com.


Re: Error or stack trace redirection in Django

2020-07-12 Thread Ram
Yes, this error is from our development server and we have DEBUG = True.
Thanks for quick answer. We will not turn this on in production server.

Best regards,
~Ram

On Sun, Jul 12, 2020 at 8:18 PM Christophe Pettus  wrote:

>
>
> > On Jul 12, 2020, at 19:08, Ram  wrote:
> >
> > If coding needs to be changed here to avoid stack trace on the user
> browsers, what should be changed here?
>
> You have DEBUG = True; that will result in the debugging output you see.
> You shouldn't ever have it turned on for a production website.
>
> --
> -- Christophe Pettus
>x...@thebuild.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/0BCA3B5B-7C4E-4D94-89DE-7B94A5C4B201%40thebuild.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/CA%2BOi5F0o%3DM%2Bheh5nc%2BeuWJZVG-7YPzZo4pJHV%3DNXS78%3DqbGMkA%40mail.gmail.com.