Re: Please help me out!

2020-06-19 Thread Doddahulugappa.B
Please elaborate more on your requirement

On Fri, Jun 19, 2020, 10:31 AM meera gangani 
wrote:

> Hello ,
>
> I want to implement a Notification module in my Project
> could you please help me out!
>
>
> Thank you
> -Meera Gangani
>
> --
> 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/CANaPPPJJq_r9AZqeQACGqMpGjPzzx1sJA%3DLQr-K3FJ6s4%3DQkbA%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/CAKfjjGpDpgBQ%3DK4%3DbjACmsSNE%2BddHndVvJMqR3FF43fLvjpejw%40mail.gmail.com.


Re: How to use session in django??

2020-06-15 Thread Doddahulugappa.B
Refer below

first, you need to install Django-session-timeout with the command:

pip install django-session-timeout

then you need to update your SessionTimeoutMiddleware in settings.py

MIDDLEWARE_CLASSES = [
 ...
'django.contrib.sessions.middleware.SessionMiddleware',
'django_session_timeout.middleware.SessionTimeoutMiddleware',
 ...
]

at last, you need to add SESSION_EXPIRE_SECONDS at the end of settings.py:

SESSION_EXPIRE_SECONDS = 300  # 300 seconds = 5 minutes



Virus-free.
www.avast.com

<#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>

On Mon, Jun 15, 2020 at 8:35 AM meera gangani 
wrote:

> Hello ,
>  How To use session in django
> Can you please help me out!
>
>
> Thanks in advance
> -Meera Gangani
>
> --
> 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/CANaPPP%2BAoBVbpM9-jwoevd8tVkep8YasFt6VSRD1M2bfP-bjcg%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/CAKfjjGqGom7nccYn5sSKNJgjrZU4r8CsR9LfiBhgyf03DYUcjw%40mail.gmail.com.


Re: Role based access

2020-01-19 Thread Doddahulugappa.B
Thank you so much. I will try this..

On Sun, Jan 19, 2020, 5:38 PM maninder singh Kumar <
maninder.s.ku...@gmail.com> wrote:

> Here's what you could do :
>
> def requestView(request):
>
>
>
> say :
>
> first_query =.objects.values_list(‘name’, age’, ‘department’,
> ‘user’).filter(user__icontains = ‘user1’)
>
>
>second_query = .objects.values_list(‘name’, age’,
> ‘department’, ‘user’).filter(user__icontains = ‘user1’)
>
>
>
> #the below part can be worked out using django docs
> <https://docs.djangoproject.com/en/3.0/topics/auth/default/#user-objects>
>
> ---
>
>   myuser.groups.set([group_list])
>
>  view: *user.has_perm('.view_')*
>
> *   ---*
>
> *return render (request=request, template_name='template.html', context =
> {text1 : first_query, text2 : second_query})*
>
>
> *{{first_query.name <http://first_query.name>}}*
>
>
>
>
>
>
>
> [image: --]
>
> Maninder Kumar
> [image: http://]about.me/maninder.s.kumar
> <http://about.me/maninder.s.kumar?promo=email_sig>
>
>
>
>
> On Sun, Jan 19, 2020 at 4:32 PM HULUGESH B 
> wrote:
>
>> My use case is like this
>>
>>
>>
>> name
>>
>> age
>>
>> department
>>
>> user(manytomanyfiled)
>>
>> xyz
>>
>> 23
>>
>> cs
>>
>> user1
>>
>> abc
>>
>> 24
>>
>> ec
>>
>> user1
>>
>> pqr
>>
>> 25
>>
>> me
>>
>> user2
>>
>>
>>
>>
>>
>> Now my question is if user1 loged in means he has to see only
>>
>>
>>
>> name
>>
>> age
>>
>> department
>>
>> user(manytomanyfiled)
>>
>> xyz
>>
>> 23
>>
>> cs
>>
>> user1
>>
>> abc
>>
>> 24
>>
>> ec
>>
>> user1
>>
>>
>>
>> And if user2 login means
>>
>> name
>>
>> age
>>
>> department
>>
>> user(manytomanyfiled)
>>
>> pqr
>>
>> 25
>>
>> me
>>
>> user2
>>
>>
>>
>>
>>
>> Kindly let me know below explanation is serving my purpose?
>>
>>
>>
>> Best Regards,
>>
>> HULI
>>
>>
>>
>> *From: *maninder singh Kumar 
>> *Sent: *Sunday, January 19, 2020 2:46 PM
>> *To: *django-users@googlegroups.com
>> *Subject: *Re: Role based access
>>
>>
>>
>> Django has an authentication model of :
>>
>> 1. Creating users
>>
>> 2. Assigning them permissions or group permissions
>>
>>
>>
>> Use Authenticate() to authenticate users.  Based on the assigned
>> permissions they will have access to parts of your site.  Basically you
>> create views and the objects in the views are available to users with
>> permissions.  For example :
>>
>>
>>
>> def myview(request)
>>
>>  #My users database has a
>> user 'Guy" with password "1234"
>>
>> myuser =
>> users_Users.object.values("users_Name').filter(users_Name_starts_with =
>> "Guy")
>>
>>  #Permissions for this object
>> can be set.
>>
>> myuser.has_view_permission('foo.bar')
>> myuser.has_add_permission('foo.bar')
>>
>> myuser.has_delete_permission('foo.bar')#where foo is the application
>> and bar the model
>>
>> object_list = Content.objects.all()
>>
>>
>>
>>
>>
>>
>>
>>
>> *Maninder Kumar*
>>
>> about.me/maninder.s.kumar
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> On Sun, Jan 19, 2020 at 3:49 PM Doddahulugappa.B <
>> doddahuluga...@gmail.com> wrote:
>>
>> Thank you for your response. Can you please Explain me how to do that..
>>
>>
>>
>> On Sun, Jan 19, 2020, 2:09 PM maninder singh Kumar <
>> maninder.s.ku...@gmail.com> wrote:
>>
>> Could it be that there is a user from each department and each user in a
>> department has a role ?
>>
>>
>>
>>
>>
>> *Maninder Kumar*
>>
>> about.me/maninder.s.kumar
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> On Sun, Jan 19, 2020 at 3:04 PM Doddahulugappa.B <
>> doddahuluga...@gmail.com> wrot

Re: Role based access

2020-01-19 Thread Doddahulugappa.B
Thank you. I ll check it out.

On Sun, Jan 19, 2020, 4:29 PM maninder singh Kumar <
maninder.s.ku...@gmail.com> wrote:

> it will work, it requires working out queries
>
>
> [image: --]
>
> Maninder Kumar
> [image: http://]about.me/maninder.s.kumar
> <http://about.me/maninder.s.kumar?promo=email_sig>
>
>
>
>
> On Sun, Jan 19, 2020 at 4:32 PM HULUGESH B 
> wrote:
>
>> My use case is like this
>>
>>
>>
>> name
>>
>> age
>>
>> department
>>
>> user(manytomanyfiled)
>>
>> xyz
>>
>> 23
>>
>> cs
>>
>> user1
>>
>> abc
>>
>> 24
>>
>> ec
>>
>> user1
>>
>> pqr
>>
>> 25
>>
>> me
>>
>> user2
>>
>>
>>
>>
>>
>> Now my question is if user1 loged in means he has to see only
>>
>>
>>
>> name
>>
>> age
>>
>> department
>>
>> user(manytomanyfiled)
>>
>> xyz
>>
>> 23
>>
>> cs
>>
>> user1
>>
>> abc
>>
>> 24
>>
>> ec
>>
>> user1
>>
>>
>>
>> And if user2 login means
>>
>> name
>>
>> age
>>
>> department
>>
>> user(manytomanyfiled)
>>
>> pqr
>>
>> 25
>>
>> me
>>
>> user2
>>
>>
>>
>>
>>
>> Kindly let me know below explanation is serving my purpose?
>>
>>
>>
>> Best Regards,
>>
>> HULI
>>
>>
>>
>> *From: *maninder singh Kumar 
>> *Sent: *Sunday, January 19, 2020 2:46 PM
>> *To: *django-users@googlegroups.com
>> *Subject: *Re: Role based access
>>
>>
>>
>> Django has an authentication model of :
>>
>> 1. Creating users
>>
>> 2. Assigning them permissions or group permissions
>>
>>
>>
>> Use Authenticate() to authenticate users.  Based on the assigned
>> permissions they will have access to parts of your site.  Basically you
>> create views and the objects in the views are available to users with
>> permissions.  For example :
>>
>>
>>
>> def myview(request)
>>
>>  #My users database has a
>> user 'Guy" with password "1234"
>>
>> myuser =
>> users_Users.object.values("users_Name').filter(users_Name_starts_with =
>> "Guy")
>>
>>  #Permissions for this object
>> can be set.
>>
>> myuser.has_view_permission('foo.bar')
>> myuser.has_add_permission('foo.bar')
>>
>> myuser.has_delete_permission('foo.bar')#where foo is the application
>> and bar the model
>>
>> object_list = Content.objects.all()
>>
>>
>>
>>
>>
>>
>>
>>
>> *Maninder Kumar*
>>
>> about.me/maninder.s.kumar
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> On Sun, Jan 19, 2020 at 3:49 PM Doddahulugappa.B <
>> doddahuluga...@gmail.com> wrote:
>>
>> Thank you for your response. Can you please Explain me how to do that..
>>
>>
>>
>> On Sun, Jan 19, 2020, 2:09 PM maninder singh Kumar <
>> maninder.s.ku...@gmail.com> wrote:
>>
>> Could it be that there is a user from each department and each user in a
>> department has a role ?
>>
>>
>>
>>
>>
>> *Maninder Kumar*
>>
>> about.me/maninder.s.kumar
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> On Sun, Jan 19, 2020 at 3:04 PM Doddahulugappa.B <
>> doddahuluga...@gmail.com> wrote:
>>
>> Hi team,
>>
>>
>>
>> How to make role based access in django. For ex.
>>
>>
>>
>> If employee names and their department in one table.
>>
>>
>>
>>  And also we assign department to user. With manytomany field.. So how
>> can i display only the records of employees and their department which is
>> assigned to the user.
>>
>>
>>
>> Kindly help..
>>
>>
>>
>> --
>> 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
>&

Re: Role based access

2020-01-19 Thread Doddahulugappa.B
Thank you for your response. Can you please Explain me how to do that..

On Sun, Jan 19, 2020, 2:09 PM maninder singh Kumar <
maninder.s.ku...@gmail.com> wrote:

> Could it be that there is a user from each department and each user in a
> department has a role ?
>
>
> [image: --]
>
> Maninder Kumar
> [image: http://]about.me/maninder.s.kumar
> <http://about.me/maninder.s.kumar?promo=email_sig>
>
>
>
>
> On Sun, Jan 19, 2020 at 3:04 PM Doddahulugappa.B 
> wrote:
>
>> Hi team,
>>
>> How to make role based access in django. For ex.
>>
>> If employee names and their department in one table.
>>
>>  And also we assign department to user. With manytomany field.. So how
>> can i display only the records of employees and their department which is
>> assigned to the user.
>>
>> Kindly help..
>>
>> --
>> 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/CAKfjjGpT_xeQaRqySC4SX_v2-aVOb7u5%2B9qoPhByQ8Wq2DM4ow%40mail.gmail.com
>> <https://groups.google.com/d/msgid/django-users/CAKfjjGpT_xeQaRqySC4SX_v2-aVOb7u5%2B9qoPhByQ8Wq2DM4ow%40mail.gmail.com?utm_medium=email_source=footer>
>> .
>>
> --
> 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/CABOHK3TS62AWZLjR48m%2BzG%3DgWouvCQfY90KcpMAsMD_T%3DoOW1A%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CABOHK3TS62AWZLjR48m%2BzG%3DgWouvCQfY90KcpMAsMD_T%3DoOW1A%40mail.gmail.com?utm_medium=email_source=footer>
> .
>

-- 
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/CAKfjjGqsW_FUKhEoEn4fxBR46sdF-xFhct864J_cmp-EjbbUeg%40mail.gmail.com.


Role based access

2020-01-19 Thread Doddahulugappa.B
Hi team,

How to make role based access in django. For ex.

If employee names and their department in one table.

 And also we assign department to user. With manytomany field.. So how can
i display only the records of employees and their department which is
assigned to the user.

Kindly help..

-- 
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/CAKfjjGpT_xeQaRqySC4SX_v2-aVOb7u5%2B9qoPhByQ8Wq2DM4ow%40mail.gmail.com.


Re: Problems with "Class Meta" and " __str__"

2019-09-10 Thread Doddahulugappa.B
*def __str__(self):return self.name *



On Tue, Sep 10, 2019, 8:30 PM Elmaco7  wrote:

> Hello, I do these models but the Django admin page doesn't read the "class
> Meta" and " __str__".
> This is the models.py document
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> *from django.db import models# Create your models here.class
> Autore(models.Model):nome = models.CharField(max_length=50)cognome
> = models.CharField(max_length=50)def __str__(self):return
> self.autore_textclass Meta:verbose_name_plural = "Autori"class
> Genere(models.Model):descrizione = models.CharField(max_length=30)def
> __str__(self):return self.genere_textclass Meta:
> verbose_name_plural = "Generi"class Libro(models.Model):titolo =
> models.CharField(max_length=200)autore = models.ForeignKey(Autore,
> on_delete=models.CASCADE)genere = models.ForeignKey(Genere,
> on_delete=models.CASCADE)def __str__(self):return
> self.libro_textclass Meta:verbose_name_plural = "Libri"*
>
>
> These are the results
>
>
>
>
> Can someone help me?
>
> --
> 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/c1941b52-7d2b-4b09-8ead-fce630b73757%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/CAKfjjGrMMEkg85LOVGhDeSes%3D4eMzoh%3DTn%2BwyS%2Bc5VxWMBMiPw%40mail.gmail.com.


Re: Database Views

2019-08-27 Thread Doddahulugappa.B
Thank you. I got it.. Issue with timezone

By default django considering
TIME_ZONE = 'UTC'
USE_TZ = True

Thats the reason it was showing less records than actual..
I changed it local to local time zone name and USE_TZ = False

Its working perfectly.. I also understood that its not only to database
views, its also applicable to tables also.

Kindly make sure to change above two lines in setting according to ur local
time zone to render correct records.

Thank you.


On Tue, Aug 27, 2019, 10:02 PM Doddahulugappa.B 
wrote:

> Thanks for your response.
>
> In Django models.. For example
>
> class TempUser(models.Model):
> first_name = models.CharField(max_length=100)
>
> class Meta:
> managed = False
> db_table = "temp_user"
>
>
>
> temp_user is database view.
>
> Now assume select * from temp_user
>
> Gives 5 records
>
>
> Same model if i register in admin panel.
>
> It will show less records than 5.
>
> Even if i do TempUser.Objects.Count()
>
> It will show less records than 5.
>
>
> Very rare case it show exactly what view is having otherwise most of the time 
> it fails to show exact records.
>
> I observed this since many days in 3 to 4 projects of my django
>
>
>
>
> On Tue, Aug 27, 2019, 9:01 PM Jani Tiainen  wrote:
>
>> Hi.
>>
>> You really need to provide more context. Without knowing your data,
>> tables involved in a view. Your model and query you used and query you used
>> to verify wrong (or correct) results it is virtually impossible to help you
>> further.
>>
>>
>> ti 27. elok. 2019 klo 17.47 HULUGESH B 
>> kirjoitti:
>>
>>> Hi All,
>>>
>>>
>>> I am facing issues in Django Models:
>>>
>>> If connect databse views in models.
>>>
>>> It shows less records than actual number of records. Kindly assist me.
>>> How to solve. This is not all the time.. sometimes it is correct sometimes
>>> not correct.
>>>
>>> --
>>> 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/29c228cc-295a-487e-a5df-afb1471b8730%40googlegroups.com
>>> <https://groups.google.com/d/msgid/django-users/29c228cc-295a-487e-a5df-afb1471b8730%40googlegroups.com?utm_medium=email_source=footer>
>>> .
>>>
>> --
>> 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/CAHn91ocVY%2B-Z-9_GYKa0gbT5MCg%2Bh%2BvBzfLEgVf5QmnArV%2BaZw%40mail.gmail.com
>> <https://groups.google.com/d/msgid/django-users/CAHn91ocVY%2B-Z-9_GYKa0gbT5MCg%2Bh%2BvBzfLEgVf5QmnArV%2BaZw%40mail.gmail.com?utm_medium=email_source=footer>
>> .
>>
>

-- 
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/CAKfjjGoar7k6qQqb%2BoOBv5S3SY-z6a4aeKdjdh_7MsR7BdZ%2BPA%40mail.gmail.com.


Re: Database Views

2019-08-27 Thread Doddahulugappa.B
Thanks for your response.

In Django models.. For example

class TempUser(models.Model):
first_name = models.CharField(max_length=100)

class Meta:
managed = False
db_table = "temp_user"



temp_user is database view.

Now assume select * from temp_user

Gives 5 records


Same model if i register in admin panel.

It will show less records than 5.

Even if i do TempUser.Objects.Count()

It will show less records than 5.


Very rare case it show exactly what view is having otherwise most of
the time it fails to show exact records.

I observed this since many days in 3 to 4 projects of my django




On Tue, Aug 27, 2019, 9:01 PM Jani Tiainen  wrote:

> Hi.
>
> You really need to provide more context. Without knowing your data, tables
> involved in a view. Your model and query you used and query you used to
> verify wrong (or correct) results it is virtually impossible to help you
> further.
>
>
> ti 27. elok. 2019 klo 17.47 HULUGESH B 
> kirjoitti:
>
>> Hi All,
>>
>>
>> I am facing issues in Django Models:
>>
>> If connect databse views in models.
>>
>> It shows less records than actual number of records. Kindly assist me.
>> How to solve. This is not all the time.. sometimes it is correct sometimes
>> not correct.
>>
>> --
>> 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/29c228cc-295a-487e-a5df-afb1471b8730%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/CAHn91ocVY%2B-Z-9_GYKa0gbT5MCg%2Bh%2BvBzfLEgVf5QmnArV%2BaZw%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/CAKfjjGq5JFLz62UYD5CcPbYoqkOkty%2BBUz-O%2B9pwPZ%3DGazNvMw%40mail.gmail.com.