Re: ?? question ,its urgent

2022-06-23 Thread Soumen Khatua
Better use JSON Field to store all the informations

On Mon, Jun 20, 2022 at 12:16 PM Abhinandan K 
wrote:

> how to store the data in django databse table if user append fields
> according to their need
> for example i have 1 one field 1) name 2) age 3) salary and the sign('+)
> if user click on + sign row append one plus in form..my question is that i
> want to store the data in all appended textboxes in single field in
> database,,
>
> --
> 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/CAA6_Mp6UPLakoi-JhcgB4U89-iKfDwAaxDWwW547tFKyk_imrg%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/CAPUw6WZmMSjWKoTxGvmvuk_paEkvpvD5NjX0ri7cRrDe%2BtMtfg%40mail.gmail.com.


Remove username field

2019-04-02 Thread Soumen Khatua
>
> Hi folks,

I want to remove username field from django.contrib.auth.User please tell
me, how I can do that and also set email address as a username in inbuilt
login form???


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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAPUw6WZY-1Viu0gmgU4yuKZ6kt77oQP_4bQRJ3YE7N5WGS5Qfw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Remove username field

2019-04-03 Thread Soumen Khatua
Can you send me the code link, please I'm struggling to find it or solve it.
Please help.
Thank you for your time.

On Wed, 3 Apr 2019, 09:28 Guru Murthy,  wrote:

> Hi Suman khatua,
>You can remove the username from admin authentication system
>
> --
> 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 post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAMgkGLVJv7Yt6h1F%2B59erwGcwgdsU9vERe7Ho7OUPT-5046aSA%40mail.gmail.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAPUw6WYT%3DKxjOMwjRERAk_Q%3DH0bD9y5DAr5%3DGJzpmhahjawT6Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Regarding password and email field

2019-04-06 Thread Soumen Khatua
How I can display please enter the same password. if both password is
different in django inbuilt auth forms.

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAPUw6WZk%2BWKiPHhH-35Huc0iE8Gg6HPBxJyvFcv_v8EXVkok4Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


'WSGIRequest' object has no attribute 'Files'

2019-04-16 Thread Soumen Khatua
Hi Folks,
I'm getting this error 'WSGIRequest' object has no attribute 'Files' and i
didn't get proper solution in google also. I alredaty took
*enctype="multipart/form-data"* in my forms tag. Here is my code snippet
please provide me the solution it's urgent.

Thank you in advance.

*.html*

  
{% csrf_token %}
{{ p_form.as_p }}

  


*models.py*

*class Profile(models.Model):*
*user = models.OneToOneField(User, on_delete=models.CASCADE)*
*bio =  models.TextField(blank=True, null=True)*
*image = models.ImageField(default='profile/default.jpg',
upload_to='profile')*

views.py

*def profile_view(request): if request.method == 'POST': print("this is
update form post method") p_form =
ProfileUpdateForm(request.POST,request.Files,instance =

request.user.profile) if  p_form.is_valid():
p_form.save()  return redirect('profile')*

Error:

'WSGIRequest' object has no attribute 'Files'

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAPUw6WYQi_pc-GHt8-jsupbkuamL9RK7TZXV3J%3D%2B3yd%3DoWUtiQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: 'WSGIRequest' object has no attribute 'Files'

2019-04-16 Thread Soumen Khatua
Thanks. It's working.

On Tue, 16 Apr 2019, 13:22 Jani Tiainen,  wrote:

> Hi.
>
> It is .FILES all in capital. Not just first letter.
>
>
> ti 16. huhtik. 2019 klo 10.05 Soumen Khatua 
> kirjoitti:
>
>> Hi Folks,
>> I'm getting this error 'WSGIRequest' object has no attribute 'Files' and
>> i didn't get proper solution in google also. I alredaty took
>> *enctype="multipart/form-data"* in my forms tag. Here is my code snippet
>> please provide me the solution it's urgent.
>>
>> Thank you in advance.
>>
>> *.html*
>>
>>   
>> {% csrf_token %}
>> {{ p_form.as_p }}
>> 
>>   
>>
>>
>> *models.py*
>>
>> *class Profile(models.Model):*
>> *user = models.OneToOneField(User, on_delete=models.CASCADE)*
>> *bio =  models.TextField(blank=True, null=True)*
>> *image = models.ImageField(default='profile/default.jpg',
>> upload_to='profile')*
>>
>> views.py
>>
>> *def profile_view(request): if request.method == 'POST': print("this is
>> update form post method") p_form =
>> ProfileUpdateForm(request.POST,request.Files,instance =
>>
>> request.user.profile) if  p_form.is_valid():
>> p_form.save()  return redirect('profile')*
>>
>> Error:
>>
>> 'WSGIRequest' object has no attribute 'Files'
>>
>>
>>
>>
>> --
>> 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 post to this group, send email to django-users@googlegroups.com.
>> Visit this group at https://groups.google.com/group/django-users.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CAPUw6WYQi_pc-GHt8-jsupbkuamL9RK7TZXV3J%3D%2B3yd%3DoWUtiQ%40mail.gmail.com
>> <https://groups.google.com/d/msgid/django-users/CAPUw6WYQi_pc-GHt8-jsupbkuamL9RK7TZXV3J%3D%2B3yd%3DoWUtiQ%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
> --
> 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 post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAHn91ofCbdtnEfKNeYjLVjgmPh6BH4BJVEUaV8p74DqzqYcxBA%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAHn91ofCbdtnEfKNeYjLVjgmPh6BH4BJVEUaV8p74DqzqYcxBA%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAPUw6WYUBhTZcg03Bn6SRPW45Ck60MQt726E72O8KJh_BeRqxw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Database setup

2019-04-19 Thread Soumen Khatua
Hi Folks,
How can I configure xampp server provided mysql database in django.

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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAPUw6WZXNhKtx4zkUk-tqjSTvfBU%2BhFKuzqXG-UzHmDzT9iZyg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Database setup

2019-04-19 Thread Soumen Khatua
Yes I already install xampp server but what will be my password? Actually
for development purpose xampp server not accept any password, I guess!!


Thank you for your valuable time.

On Sat, 20 Apr 2019, 10:48 Okware Aldo,  wrote:

> Hey, If you have xampp installed, just create a database using phpmyadmin,
> attach a user to that database.
> then ensure you have a driver package installed and setup for django. eg.
> pymsql has worked well for.
> then make the necessary changes in django settings file.
>
>
> On Fri, Apr 19, 2019 at 9:21 PM Soumen Khatua 
> wrote:
>
>> Hi Folks,
>> How can I configure xampp server provided mysql database in django.
>>
>> 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 post to this group, send email to django-users@googlegroups.com.
>> Visit this group at https://groups.google.com/group/django-users.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CAPUw6WZXNhKtx4zkUk-tqjSTvfBU%2BhFKuzqXG-UzHmDzT9iZyg%40mail.gmail.com
>> <https://groups.google.com/d/msgid/django-users/CAPUw6WZXNhKtx4zkUk-tqjSTvfBU%2BhFKuzqXG-UzHmDzT9iZyg%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
> --
> 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 post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAMEZma_4bR_yUbUTWJCB_JhmRXWqEHpgzGzQp24qCCr%3DG%3DjQvg%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAMEZma_4bR_yUbUTWJCB_JhmRXWqEHpgzGzQp24qCCr%3DG%3DjQvg%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAPUw6WZ9FfDQi2dewUuL4W%2BV9XEsafK4Fmp-XiV72ySyNdYZGw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Blog sharing

2019-04-24 Thread Soumen Khatua
Hi folks,

I want to make on blogger website and I want to share them with social
media's timeline like Facebook, instragam, twitter etc. But for each post
generate the embed code is little bit time consuming. So how I can write a
script where for each post can be redirect to Facebook or twitter Web site.
If anyone have this type of code please share with me.

Thank you guys.

Soumen
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAPUw6WbjhfjZ6bY8xU4u%3DEBs1AnbDxHJZ-nwPn7m37KZEJX3HQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Blog sharing

2019-04-24 Thread Soumen Khatua
Can you share any link related to these concept???

On Thu, 25 Apr 2019, 01:42 Makori Breens,  wrote:

> Easy, there are several automatic sharing services out there...some free
>
> On Wed, Apr 24, 2019, 10:41 PM Soumen Khatua 
> wrote:
>
>> Hi folks,
>>
>> I want to make on blogger website and I want to share them with social
>> media's timeline like Facebook, instragam, twitter etc. But for each post
>> generate the embed code is little bit time consuming. So how I can write a
>> script where for each post can be redirect to Facebook or twitter Web site.
>> If anyone have this type of code please share with me.
>>
>> Thank you guys.
>>
>> Soumen
>> 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 post to this group, send email to django-users@googlegroups.com.
>> Visit this group at https://groups.google.com/group/django-users.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CAPUw6WbjhfjZ6bY8xU4u%3DEBs1AnbDxHJZ-nwPn7m37KZEJX3HQ%40mail.gmail.com
>> <https://groups.google.com/d/msgid/django-users/CAPUw6WbjhfjZ6bY8xU4u%3DEBs1AnbDxHJZ-nwPn7m37KZEJX3HQ%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
> --
> 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 post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAOz9w2FN%2BrSg_tDNLF2HMZDOaxdgbWUR%2BK%2BvY0tt0aurBmyAmw%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAOz9w2FN%2BrSg_tDNLF2HMZDOaxdgbWUR%2BK%2BvY0tt0aurBmyAmw%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAPUw6WaxNuUVcb8c9u7516HhzcdKKnWDAvEhKyRHmgbXRTDEHw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Blog sharing

2019-04-24 Thread Soumen Khatua
I know I can do that by using api. Do you have any source code for that?

On Thu, 25 Apr 2019, 05:20 Nitesh Saini,  wrote:

> By using http request you can store content of your blog and create a bot
> which will use Instagram api, Twitter api etc and can upload your blog.
>
> On Thu, 25 Apr 2019, 1:42 am Makori Breens 
>> Easy, there are several automatic sharing services out there...some free
>>
>> On Wed, Apr 24, 2019, 10:41 PM Soumen Khatua 
>> wrote:
>>
>>> Hi folks,
>>>
>>> I want to make on blogger website and I want to share them with social
>>> media's timeline like Facebook, instragam, twitter etc. But for each post
>>> generate the embed code is little bit time consuming. So how I can write a
>>> script where for each post can be redirect to Facebook or twitter Web site.
>>> If anyone have this type of code please share with me.
>>>
>>> Thank you guys.
>>>
>>> Soumen
>>> 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 post to this group, send email to django-users@googlegroups.com.
>>> Visit this group at https://groups.google.com/group/django-users.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/CAPUw6WbjhfjZ6bY8xU4u%3DEBs1AnbDxHJZ-nwPn7m37KZEJX3HQ%40mail.gmail.com
>>> <https://groups.google.com/d/msgid/django-users/CAPUw6WbjhfjZ6bY8xU4u%3DEBs1AnbDxHJZ-nwPn7m37KZEJX3HQ%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>> --
>> 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 post to this group, send email to django-users@googlegroups.com.
>> Visit this group at https://groups.google.com/group/django-users.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CAOz9w2FN%2BrSg_tDNLF2HMZDOaxdgbWUR%2BK%2BvY0tt0aurBmyAmw%40mail.gmail.com
>> <https://groups.google.com/d/msgid/django-users/CAOz9w2FN%2BrSg_tDNLF2HMZDOaxdgbWUR%2BK%2BvY0tt0aurBmyAmw%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
> --
> 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 post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAGP%2BSDMyL8aLHK8aAvK3EyeMatedvje_TudX5OrapRmHeJrRwA%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAGP%2BSDMyL8aLHK8aAvK3EyeMatedvje_TudX5OrapRmHeJrRwA%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAPUw6WYwLvbbny6JROHU%3D-c4kJkSOyvjFNhvKimW%3DY8jkP_wkA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Comment Form Related issue

2019-04-26 Thread Soumen Khatua
Hi Folks,
I want to show one textarea where only logged in users can comment
otherwise if they are click the textareabox redirect them to login page
just like youutbe comnet box. If anyone have any source code related to
this please share.

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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAPUw6WadmH6vfXBrpSfNdGrMRgVoBAV-DZfGbJkoO%2B1tVuWyfw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Comment Form

2019-04-26 Thread Soumen Khatua
Hi Folks,
I want to allow for those who are logged in if they are not logged then it
will redirect to login page.
if any one have any code related to this concept please share with me. For
better clarity please go through this link-
https://www.amazon.in/Megaliving-Monk-Who-Sold-Ferrari/dp/8172246145/ref=sr_1_1_sspa?keywords=the+old+monk+who+sold+his+ferrari&qid=1556275424&s=gateway&sr=8-1-spons&psc=1

and then click add reviews.

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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAPUw6WY%3Dood%3Dpx1pgboLVj7%2BDrXhZj5r9%3DW5rPdA1iQ1cRageg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Comment Form Related issue

2019-04-26 Thread Soumen Khatua
yes,I'm new to django so let me check once.
Thank You for your response.

On Fri, Apr 26, 2019 at 4:36 PM Robin Riis  wrote:

> class Comment(models.Model):
>
> message = models.TextField()
>
> video = models.ForeignKey(Video, related_name='comments',
> on_delete=models.CASCADE)
>
> created_at = models.DateTimeField(auto_now_add=True)
>
> created_by = models.ForeignKey(get_user_model(), related_name='comments',
> on_delete=models.CASCADE)
>
>
> class CommentForm(forms.ModelForm):
>
> class Meta:
>
> model = Comment
>
> fields = ['message',]
>
>
> def CommentVideo(request, pk):
>
> video = get_object_or_404(Video, pk=pk)
>
> if request.method == 'POST':
>
> form = CommentForm(request.POST)
>
> if form.is_valid():
>
> comment = form.save(commit=False)
>
> comment.video = video
>
> comment.created_by = request.user
>
> comment.save()
>
> return reverse_lazy('my_cool_place')
>
> else:
>
> form = CommentForm()
>
> return render(request, 'path/to/html/file.html', {'video': video, 'form':
> form})
>
> something like that?
>
> Den fre 26 apr. 2019 kl 12:34 skrev Soumen Khatua <
> soumenkhatua...@gmail.com>:
>
>> Hi Folks,
>> I want to show one textarea where only logged in users can comment
>> otherwise if they are click the textareabox redirect them to login page
>> just like youutbe comnet box. If anyone have any source code related to
>> this please share.
>>
>> 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 post to this group, send email to django-users@googlegroups.com.
>> Visit this group at https://groups.google.com/group/django-users.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CAPUw6WadmH6vfXBrpSfNdGrMRgVoBAV-DZfGbJkoO%2B1tVuWyfw%40mail.gmail.com
>> <https://groups.google.com/d/msgid/django-users/CAPUw6WadmH6vfXBrpSfNdGrMRgVoBAV-DZfGbJkoO%2B1tVuWyfw%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
> --
> 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 post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAPLZMbMsH-55Z_KK3byho-BqMDHaXWmWQcwnmn1ZDuKHUB56eg%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAPLZMbMsH-55Z_KK3byho-BqMDHaXWmWQcwnmn1ZDuKHUB56eg%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAPUw6WbCeF%2BUuQVfOBoNEzM1vZo9dheKTQYoMz%3DQXfQmtgeTSQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Comment Form Related issue

2019-04-26 Thread Soumen Khatua
Okay,Could you tell me If any user want to update their comment it later
the process is same or different?

Thank You


On Fri, Apr 26, 2019 at 5:31 PM Robin Riis  wrote:

> class Comment(models.Model): <--- in models.py
>
> class CommentForm(forms.ModelForm): <--- in forms.py
>
> def CommentVideo(request, pk): <--- in views.py
>
> and the video is another model i used since you said like youtube. :)
>
> Den fre 26 apr. 2019 kl 13:33 skrev Soumen Khatua <
> soumenkhatua...@gmail.com>:
>
>> yes,I'm new to django so let me check once.
>> Thank You for your response.
>>
>> On Fri, Apr 26, 2019 at 4:36 PM Robin Riis  wrote:
>>
>>> class Comment(models.Model):
>>>
>>> message = models.TextField()
>>>
>>> video = models.ForeignKey(Video, related_name='comments',
>>> on_delete=models.CASCADE)
>>>
>>> created_at = models.DateTimeField(auto_now_add=True)
>>>
>>> created_by = models.ForeignKey(get_user_model(),
>>> related_name='comments', on_delete=models.CASCADE)
>>>
>>>
>>> class CommentForm(forms.ModelForm):
>>>
>>> class Meta:
>>>
>>> model = Comment
>>>
>>> fields = ['message',]
>>>
>>>
>>> def CommentVideo(request, pk):
>>>
>>> video = get_object_or_404(Video, pk=pk)
>>>
>>> if request.method == 'POST':
>>>
>>> form = CommentForm(request.POST)
>>>
>>> if form.is_valid():
>>>
>>> comment = form.save(commit=False)
>>>
>>> comment.video = video
>>>
>>> comment.created_by = request.user
>>>
>>> comment.save()
>>>
>>> return reverse_lazy('my_cool_place')
>>>
>>> else:
>>>
>>> form = CommentForm()
>>>
>>> return render(request, 'path/to/html/file.html', {'video': video,
>>> 'form': form})
>>>
>>> something like that?
>>>
>>> Den fre 26 apr. 2019 kl 12:34 skrev Soumen Khatua <
>>> soumenkhatua...@gmail.com>:
>>>
>>>> Hi Folks,
>>>> I want to show one textarea where only logged in users can comment
>>>> otherwise if they are click the textareabox redirect them to login page
>>>> just like youutbe comnet box. If anyone have any source code related to
>>>> this please share.
>>>>
>>>> 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 post to this group, send email to django-users@googlegroups.com.
>>>> Visit this group at https://groups.google.com/group/django-users.
>>>> To view this discussion on the web visit
>>>> https://groups.google.com/d/msgid/django-users/CAPUw6WadmH6vfXBrpSfNdGrMRgVoBAV-DZfGbJkoO%2B1tVuWyfw%40mail.gmail.com
>>>> <https://groups.google.com/d/msgid/django-users/CAPUw6WadmH6vfXBrpSfNdGrMRgVoBAV-DZfGbJkoO%2B1tVuWyfw%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>>> .
>>>> For more options, visit https://groups.google.com/d/optout.
>>>>
>>> --
>>> 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 post to this group, send email to django-users@googlegroups.com.
>>> Visit this group at https://groups.google.com/group/django-users.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/CAPLZMbMsH-55Z_KK3byho-BqMDHaXWmWQcwnmn1ZDuKHUB56eg%40mail.gmail.com
>>> <https://groups.google.com/d/msgid/django-users/CAPLZMbMsH-55Z_KK3byho-BqMDHaXWmWQcwnmn1ZDuKHUB56eg%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>> --
>> 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 djang

Razorpay imtegration

2019-04-26 Thread Soumen Khatua
Hi folks,

Anyone have the source code to integrate Razorpay along with full
security,actually I saw their documentation but I'm still confused. If
anyone have please share with me??

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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAPUw6WZs5_5BHwgsbwe%3D-pxuuP6_3roBMYr4568_TZgUb8v7Zg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Phonenumber Field

2019-05-02 Thread Soumen Khatua
Hi Folks,
Actullay I didn't understand the  how this code is working,Please if you
guys know about the convention,can you please give me some eaxmple with
explanation.

*models.py*

*from phonenumber_field.modelfields import PhoneNumber, PhoneNumberField*

*class PossiblePhoneNumberField(PhoneNumberField):*
*"""Less strict field for phone numbers written to database."""*

*default_validators = [validate_possible_number]*



*class Address(models.Model):*

*phone = PossiblePhoneNumberField(blank=True, default='')*

*class Meta:*
*ordering = ('pk', )*


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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAPUw6WawH8DfbxLewNi8gDE4GNpa0J84sF6X7TZKCsLwX6H%2BYw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Error

2019-05-05 Thread Soumen Khatua
Hi Folks,
I'm getting one error from models.py,here is my models.py.

Error:
from django.db.models import SubfieldBase
   ImportError: cannot import name 'SubfieldBase'

models.py
import uuid
from django.conf import settings
from django.db import models
from django.db.models import Q, Value
from django.forms.models import model_to_dict
from django.utils import timezone
from django.utils.translation import pgettext_lazy
from django_countries.fields import Country, CountryField

from django.contrib.auth.models import (
AbstractBaseUser, BaseUserManager, PermissionsMixin)

from phonenumber_field.modelfields import PhoneNumber, PhoneNumberField
from versatileimagefield.fields import VersatileImageField
from .validators import validate_possible_number

# Create your models here.
class PossiblePhoneNumberField(PhoneNumberField):
"""Less strict field for phone numbers written to database."""
default_validators = [validate_possible_number]

class AddressQueryset(models.QuerySet):
def annotate_default(self, user):
# Set default shipping/billing address pk to None
# if default shipping/billing address doesn't exist
default_shipping_address_pk, default_billing_address_pk = None, None
if user.default_shipping_address:
default_shipping_address_pk = user.default_shipping_address.pk
if user.default_billing_address:
default_billing_address_pk = user.default_billing_address.pk
return user.addresses.annotate(
user_default_shipping_address_pk=Value(
default_shipping_address_pk, models.IntegerField()),
user_default_billing_address_pk=Value(
default_billing_address_pk, models.IntegerField()))

class Address(models.Model):
first_name = models.CharField(max_length=256, blank=True)
last_name = models.CharField(max_length=256, blank=True)
company_name = models.CharField(max_length=256, blank=True)
street_address_1 = models.CharField(max_length=256, blank=True)
street_address_2 = models.CharField(max_length=256, blank=True)
city = models.CharField(max_length=256, blank=True)
city_area = models.CharField(max_length=128, blank=True)
postal_code = models.CharField(max_length=20, blank=True)
country = CountryField()
country_area = models.CharField(max_length=128, blank=True)
phone = PossiblePhoneNumberField(blank=True, default='')
objects = AddressQueryset.as_manager()

class Meta:
ordering = ('pk', )

@property
def full_name(self):
return '%s %s' % (self.first_name, self.last_name)

def __str__(self):
if self.company_name:
return '%s - %s' % (self.company_name, self.full_name)
return self.full_name


def __eq__(self, other):
'''The equality method is defined such that instances with the same
primary key value and the same concrete class are considered equal, except
that instances with a primary key value of None aren’t equal to anything
except themselves.'''
return self.as_data() == other.as_data()

# The __hash__() method is based on the instance’s primary key value.
It is effectively hash(obj.pk). If the instance doesn’t have a primary key
value then a TypeError will be raised (otherwise the __hash__() method
would return different values before and after the instance is saved, but
changing the __hash__() value of an instance is forbidden in Python.
__hash__ = models.Model.__hash__

# model_to_dict will convert all the data into dict except id and user
in this model
def as_data(self):
"""Return the address as a dict suitable for passing as
kwargs.Result does not contain the primary key or an associated user."""
data = model_to_dict(self,exclude=['id','user'])
if isinstance(data['country'], Country):
data['country'] = data['country'].code
if isinstance(data['phone'], PhoneNumber):
#as_e164 is a phonenumber format information
data['phone'] = data['phone'].as_e164
return data


def get_copy(self):
"""Return a new instance of the same address."""
return Address.objects.create(**self.as_data())

class UserManager(BaseUserManager):
def create_user(self, email, password=None, is_staff=False,
is_active=True,
**extra_fields):
"""Create a user instance with the given email and password."""
email = UserManager.normalize_email(email)
# Google OAuth2 backend send unnecessary username field
extra_fields.pop('username', None)

user = self.model(email=email, is_active=is_active,
is_staff=is_staff,
**extra_fields)

if password:
user.set_password(password)
user.save()
return user

def create_superuser(self, email, password=None, **extra_fields):
return self.create_user(
email, password, is_staff=True, is_superuse

django models

2019-05-06 Thread Soumen Khatua
Hi Folks,

How this underline code works?


models.py

class Address(models.Model):
first_name = models.CharField(max_length=256, blank=True)
last_name = models.CharField(max_length=256, blank=True)
company_name = models.CharField(max_length=256, blank=True)
street_address_1 = models.CharField(max_length=256, blank=True)
street_address_2 = models.CharField(max_length=256, blank=True)
city = models.CharField(max_length=256, blank=True)
city_area = models.CharField(max_length=128, blank=True)
postal_code = models.CharField(max_length=20, blank=True)
country = CountryField()
country_area = models.CharField(max_length=128, blank=True)
phone = PossiblePhoneNumberField(blank=True, default='')


*def __eq__(self, other):*
*   return self.as_data() == other.as_data()*
* __hash__ = models.Model.__hash__*


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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAPUw6WY-pNGnPBHzDA%3DiRZUHY7NrmK30_dMbKiQpe%2B1n%2ByW%2BQQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Info

2019-05-06 Thread Soumen Khatua
Hi Folks,

Should I need to pay for asking questions or problem in this group?


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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAPUw6WaUeKf%3D9%2BAgkXbek46gNhL7dWzSOZHdk6pTXPrvam8gVA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Info

2019-05-06 Thread Soumen Khatua
Then why one bit bounce application is coming everytime after sending any
problem and saying if you will pay the we will allow your request to our
inbox.

Thanks buddy for help.



On Mon, 6 May 2019, 23:25 charan,  wrote:

> No folk
>
> No need to pay
>
>
>
> Sent from Mail <https://go.microsoft.com/fwlink/?LinkId=550986> for
> Windows 10
>
>
>
> *From: *Soumen Khatua 
> *Sent: *06 May 2019 16:52
> *To: *django-users@googlegroups.com
> *Subject: *Info
>
>
>
> Hi Folks,
>
>
>
> Should I need to pay for asking questions or problem in this group?
>
>
>
>
>
> 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 post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAPUw6WaUeKf%3D9%2BAgkXbek46gNhL7dWzSOZHdk6pTXPrvam8gVA%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAPUw6WaUeKf%3D9%2BAgkXbek46gNhL7dWzSOZHdk6pTXPrvam8gVA%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>
>
>
> --
> 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 post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/5cd0752a.1c69fb81.cdc85.081b%40mx.google.com
> <https://groups.google.com/d/msgid/django-users/5cd0752a.1c69fb81.cdc85.081b%40mx.google.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAPUw6WaRX4GwZ2ru7-T5u9%2BQRntpEq6rLYg1EYuDFV_0KgApBw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Info

2019-05-06 Thread Soumen Khatua
Thanks guys for your help.



On Tue, 7 May 2019, 00:24 Ahmed Ishtiaque,  wrote:

> Ignore that. I think it's someone who's set up a ploy for that e-mail to
> be replied back to get some free money.
>
> On Mon, May 6, 2019 at 2:50 PM Soumen Khatua 
> wrote:
>
>> Then why one bit bounce application is coming everytime after sending any
>> problem and saying if you will pay the we will allow your request to our
>> inbox.
>>
>> Thanks buddy for help.
>>
>>
>>
>> On Mon, 6 May 2019, 23:25 charan,  wrote:
>>
>>> No folk
>>>
>>> No need to pay
>>>
>>>
>>>
>>> Sent from Mail <https://go.microsoft.com/fwlink/?LinkId=550986> for
>>> Windows 10
>>>
>>>
>>>
>>> *From: *Soumen Khatua 
>>> *Sent: *06 May 2019 16:52
>>> *To: *django-users@googlegroups.com
>>> *Subject: *Info
>>>
>>>
>>>
>>> Hi Folks,
>>>
>>>
>>>
>>> Should I need to pay for asking questions or problem in this group?
>>>
>>>
>>>
>>>
>>>
>>> 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 post to this group, send email to django-users@googlegroups.com.
>>> Visit this group at https://groups.google.com/group/django-users.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/CAPUw6WaUeKf%3D9%2BAgkXbek46gNhL7dWzSOZHdk6pTXPrvam8gVA%40mail.gmail.com
>>> <https://groups.google.com/d/msgid/django-users/CAPUw6WaUeKf%3D9%2BAgkXbek46gNhL7dWzSOZHdk6pTXPrvam8gVA%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>>
>>>
>>> --
>>> 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 post to this group, send email to django-users@googlegroups.com.
>>> Visit this group at https://groups.google.com/group/django-users.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/5cd0752a.1c69fb81.cdc85.081b%40mx.google.com
>>> <https://groups.google.com/d/msgid/django-users/5cd0752a.1c69fb81.cdc85.081b%40mx.google.com?utm_medium=email&utm_source=footer>
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>> --
>> 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 post to this group, send email to django-users@googlegroups.com.
>> Visit this group at https://groups.google.com/group/django-users.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CAPUw6WaRX4GwZ2ru7-T5u9%2BQRntpEq6rLYg1EYuDFV_0KgApBw%40mail.gmail.com
>> <https://groups.google.com/d/msgid/django-users/CAPUw6WaRX4GwZ2ru7-T5u9%2BQRntpEq6rLYg1EYuDFV_0KgApBw%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
> --
> 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 post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAKizqR6kw3fwfWjp%3Dc8Y3yW5%3DXKO7uH9eGm64q8L02ZO2zSCxg%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAKizqR6kw3fwfWjp%3Dc8Y3yW5%3DXKO7uH9eGm64q8L02ZO2zSCxg%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAPUw6WZ5fCVeOZQP1nyQm7SG%2BBC-CX4pg%3Db4JAkvgaG9-_hBRg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Info

2019-05-06 Thread Soumen Khatua
Okay


Thank you for your help.

On Tue, 7 May 2019, 00:26 Alex Heyden,  wrote:

> When a message goes out to here, it's sent to everyone on the group. When
> you reply to it, it also goes out to the group. What you're seeing is
> someone's auto-reply. I couldn't say for sure if it's a malicious attempt
> to passively get some money or if it's someone not realizing his personal
> spam filter is spamming a bunch of people in the group. Either way, just
> block the sender and ignore it.
>
> On Mon, May 6, 2019 at 1:49 PM Soumen Khatua 
> wrote:
>
>> Then why one bit bounce application is coming everytime after sending any
>> problem and saying if you will pay the we will allow your request to our
>> inbox.
>>
>> Thanks buddy for help.
>>
>>
>>
>> On Mon, 6 May 2019, 23:25 charan,  wrote:
>>
>>> No folk
>>>
>>> No need to pay
>>>
>>>
>>>
>>> Sent from Mail <https://go.microsoft.com/fwlink/?LinkId=550986> for
>>> Windows 10
>>>
>>>
>>>
>>> *From: *Soumen Khatua 
>>> *Sent: *06 May 2019 16:52
>>> *To: *django-users@googlegroups.com
>>> *Subject: *Info
>>>
>>>
>>>
>>> Hi Folks,
>>>
>>>
>>>
>>> Should I need to pay for asking questions or problem in this group?
>>>
>>>
>>>
>>>
>>>
>>> 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 post to this group, send email to django-users@googlegroups.com.
>>> Visit this group at https://groups.google.com/group/django-users.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/CAPUw6WaUeKf%3D9%2BAgkXbek46gNhL7dWzSOZHdk6pTXPrvam8gVA%40mail.gmail.com
>>> <https://groups.google.com/d/msgid/django-users/CAPUw6WaUeKf%3D9%2BAgkXbek46gNhL7dWzSOZHdk6pTXPrvam8gVA%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>>
>>>
>>> --
>>> 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 post to this group, send email to django-users@googlegroups.com.
>>> Visit this group at https://groups.google.com/group/django-users.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/5cd0752a.1c69fb81.cdc85.081b%40mx.google.com
>>> <https://groups.google.com/d/msgid/django-users/5cd0752a.1c69fb81.cdc85.081b%40mx.google.com?utm_medium=email&utm_source=footer>
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>> --
>> 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 post to this group, send email to django-users@googlegroups.com.
>> Visit this group at https://groups.google.com/group/django-users.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CAPUw6WaRX4GwZ2ru7-T5u9%2BQRntpEq6rLYg1EYuDFV_0KgApBw%40mail.gmail.com
>> <https://groups.google.com/d/msgid/django-users/CAPUw6WaRX4GwZ2ru7-T5u9%2BQRntpEq6rLYg1EYuDFV_0KgApBw%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
> --
> 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 post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CA%2Bv0ZYWD62dqujZoQ7EbhFZvXXCfNeFhT%2BbHnQuQiBXBE9kyFg%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CA%2Bv0ZYWD62dqujZoQ7EbhFZvXXCfNeFhT%2BbHnQuQiBXBE9kyFg%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAPUw6WYHS-iR6SO2%2BuOqHPqNgwcg%2BW2B23uiJuj4AmdvyM_KHw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: django models

2019-05-06 Thread Soumen Khatua
Yes,You are right as_data is custom made function inside the same
class,here is the code:



def as_data(self):
"""Return the address as a dict suitable for passing as
kwargs.Result does not contain the primary key or an associated user."""
data = model_to_dict(self,exclude=['id','user'])
if isinstance(data['country'], Country):
data['country'] = data['country'].code
if isinstance(data['phone'], PhoneNumber):
#as_e164 is a phonenumber format information
data['phone'] = data['phone'].as_e164
return data


But here other is an argument so we need to pass it then without passing
how we can compare with self.as_data varibale?

Thank you for your response.

On Tue, May 7, 2019 at 2:19 AM Skyisblue  wrote:

> Soumen,
>
> The function looks to compare two Address objects. The as_data() call is
> custom made. I saw it documented in your other post. It removes the Primary
> Key and User from the Address object. I presume this is so they can compare
> the hash of one address to the hash of another.
>
> Regards,
> Joe
>
> On Mon, May 6, 2019 at 6:03 AM Soumen Khatua 
> wrote:
>
>> Hi Folks,
>>
>> How this underline code works?
>>
>>
>> models.py
>>
>> class Address(models.Model):
>> first_name = models.CharField(max_length=256, blank=True)
>> last_name = models.CharField(max_length=256, blank=True)
>> company_name = models.CharField(max_length=256, blank=True)
>> street_address_1 = models.CharField(max_length=256, blank=True)
>> street_address_2 = models.CharField(max_length=256, blank=True)
>> city = models.CharField(max_length=256, blank=True)
>> city_area = models.CharField(max_length=128, blank=True)
>> postal_code = models.CharField(max_length=20, blank=True)
>> country = CountryField()
>> country_area = models.CharField(max_length=128, blank=True)
>> phone = PossiblePhoneNumberField(blank=True, default='')
>>
>>
>> *def __eq__(self, other):*
>> *   return self.as_data() == other.as_data()*
>> * __hash__ = models.Model.__hash__*
>>
>>
>> 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 post to this group, send email to django-users@googlegroups.com.
>> Visit this group at https://groups.google.com/group/django-users.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CAPUw6WY-pNGnPBHzDA%3DiRZUHY7NrmK30_dMbKiQpe%2B1n%2ByW%2BQQ%40mail.gmail.com
>> <https://groups.google.com/d/msgid/django-users/CAPUw6WY-pNGnPBHzDA%3DiRZUHY7NrmK30_dMbKiQpe%2B1n%2ByW%2BQQ%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
> --
> 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 post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAGgUuiuun1NebT1V5r2v3GGjSCJ4RybUw9Fsn1g4M6x1ei2VQw%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAGgUuiuun1NebT1V5r2v3GGjSCJ4RybUw9Fsn1g4M6x1ei2VQw%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAPUw6Wbdko08d210HbV5uv8EBeWiC6Q%3D8LKdfyyYKHN--7__pA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


django models

2019-05-06 Thread Soumen Khatua
Hi Folks,

I didn't  understand this code please help me to understand this code.

class AddressQueryset(models.QuerySet):
def annotate_default(self, user):
# Set default shipping/billing address pk to None
# if default shipping/billing address doesn't exist
default_shipping_address_pk, default_billing_address_pk = None, None
if user.default_shipping_address:
default_shipping_address_pk = user.default_shipping_address.pk
if user.default_billing_address:
default_billing_address_pk = user.default_billing_address.pk
return user.addresses.annotate(
user_default_shipping_address_pk=Value(
default_shipping_address_pk, models.IntegerField()),
user_default_billing_address_pk=Value(
default_billing_address_pk, models.IntegerField()))


default_shipping_address & default_billing_address_pk is available in my
User table it is a foreignkey of Address table  and  addresses is also
avialable in my User table as ManytoManytoField refering to same Address
Table and the last i'm using this inside Address table just like this :
objects = AddressQueryset.as_manager()



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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAPUw6Wbb9Emmq0aODhK9GmT9Z8X0TMQtSOsPJ-SA-99mpdT6sg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Database setup

2019-05-10 Thread Soumen Khatua
Hi Folks,

I have one existing table in my database then how I can use the same table
in my models.py.

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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAPUw6WakznFSEwPXtisj9rz782HEKxEDVE10GC1nNtEL7dGMOg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Redirect

2019-05-14 Thread Soumen Khatua
Hi Folks,
Actually after login I want to redirect them by their name to a custome
page.

Assume  my name is soumen so my url will be after login:
   *127.0.0.1:8000/accounts/soumen  *
But not every time only they will click on particular login button.


Please help me.
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAPUw6WYieo85n0HZjUSOASEarcRm-MkzTkAJ0kUKDvWWYAkoAA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Redirect

2019-05-14 Thread Soumen Khatua
Thanks for your help. But it should be redirect to these custom page if and
only if  I'll click login button and at the same time it should not
redirect to custom page if it is coming by loginrequired functionality.

Can you share me the code, please if it is possible.

Thank you once again.



On Wed, 15 May 2019, 01:20 Victor H. Velasquez Rizo, 
wrote:

> *Hi Soumen.*
>
> your are trying to re-direct an user to a customized url. To do that you
> need to create an URL that receive the name as an argument.
>
> *urls.py*
> path('url/', view, name='view_name'),
>
> *View.py*
> *from *django.shortcuts* import *redirect
>
> return redirect('app:view_name', user_name=userName)
>
>
>
> --
> 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 post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAFCXTzgf0vZqSFht%3D_4dr1TUfewsRF3WOQYYKfYATmHUKgrHiQ%40mail.gmail.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAPUw6WbAqXhgqh3rh47gmxmYo5DvDcw-MnhonNtEkHXgpWBpWg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


TypeError

2019-05-22 Thread Soumen Khatua
Hi Folks,

I'm getting this error "TypeError:" everytime, Can You guys tell me where
is the problem in this code.

*Cart*

views.py
@require_POST
def cart_add(request,product_id):
cart = Cart(request)
product = get_object_or_404(Product,id  = product_id)
form = forms.CartAddProductForm(request.POST)
if form.is_valid():
cd  = form.cleaned_data
cart.add(
   product = product,
   quantity = cd['quantity'],
   update_quantity = cd['update'])
return redirect('cart:cart_detail')


def cart_detail(request):
cart = Cart(request)
return render (request,'cart/cartdetail.html',{'cart':cart})



cartdetail.html:
{% for item in cart %}
{{ item.quantity }}
{% endfor %}

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAPUw6WYVTQWq-5WtiMo6HekSmaw6%2BRCxfRu4wbFF9BgYaDsPqg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


some random problem

2019-05-22 Thread Soumen Khatua
Hi Folks,

I'm getting len(cart) is 0 and after iterate *item is not coming from cart* in
this project,plese tell me where is my problem.
I'm sharing my git repo please go through it and please tell me the what i
missed.It's urgent.

Here is the link:
https://github.com/Herosoumen/clothproject


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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAPUw6Wax3Uy5ZEsnqG9hdJRri-CqMUSVhdAPwfaDd_u%2BCi58Og%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


data not coming into html

2019-05-22 Thread Soumen Khatua
Hi Folks,
Guys I'm not getting my data into html after rendered that still I'm not
getting my data,i'm sharing my github link:
https://github.com/Herosoumen/clothproject.Please go through this
link.Please guys help me it's urgent.


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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAPUw6WZ-ESxGfTZwiSBUf7ZSiDF3g0jzSNqUX3N4NowKA3%3DGTg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: data not coming into html

2019-05-22 Thread Soumen Khatua
*cart.py*

class Cart(object):
def __init__(self,request):
self.session = request.session
cart = self.session.get(settings.CART_SESSION_ID)
if not cart:
# save an empty cart in the session
   cart = self.session[settings.CART_SESSION_ID] = {}
self.cart = cart

def add(self,product,quantity = 1,update_quantity = False):
'''
Add a product to the cart or update its quantity

'''
product_id = str(product.id)
print(product_id)
if product_id not in self.cart:
self.cart[product_id] = {'quantity':0,'price':str(product.price)}

if update_quantity:
self.cart[product_id]['quantity'] = quantity


else:
self.cart[product_id]['quantity']+=quantity

self.save()

def save(self):
#mark the session as "modidied" to make sure it gets saved
self.session.modified = True

def remove(self, product):
'''
  remove a product from the cart
'''
product_id = str(product.id)

if product_id in self.cart:
del self.cart[product_id]
self.save()


def __iter__(self):
'''
Iterate over the items in the cart and get the products from the database

'''
product_ids = self.cart.keys()
# get the product objects and add them to the cart
products = Product.objects.filter(id__in=product_ids)
cart = self.cart.copy()
for product in products:
cart[str(product.id)]['product'] = product

for item in cart.values():
item['price'] = Decimal(item['price'])
item['total_price'] = item['price'] * item['quantity']
yield item

def __len__(self):
"""
count all the items in the cart
"""
return sum(item['quantity'] for item in self.cart.values())

def get_total_price(self):
return sum(Decimal(item['price']) * item['quantity'] for item in
self.cart.values())

def clear(self):
#remove cart from session
del self.session[settings.CART_SESSION_ID]
self.save()


*views.py(cart)*
@require_POST
def cart_add(request,product_id):
cart = Cart(request)
product = get_object_or_404(Product,id  = product_id)
form = forms.CartAddProductForm(request.POST)
if form.is_valid():
cd  = form.cleaned_data
cart.add(product = product,quantity = cd['quantity'],update_quantity =
cd['update'])
return redirect('cart_detail')


def cart_remove(request,product_id):
cart = Cart(request)
product = get_object_or_404(Product,id = product_id)
cart.remove(product)
return redirect('cart_detail')



def cart_detail(request):
cart = Cart(request)
for item in cart:
* print(item)*
for item in cart:
item['update_quantity_form'] = forms.CartAddProductForm(
   initial =
{'quantity':item['quantity'],
  'update' : True}

  )

return render (request,'cart/cartdetail.html',{'cart':cart})

here len of item is 0



On Wed, May 22, 2019 at 6:58 PM Anirudh Jain 
wrote:

> Can you tell which function in which app you are using to show data in
> which template ?
>
> On Wed, 22 May 2019, 18:56 Soumen Khatua, 
> wrote:
>
>> Hi Folks,
>> Guys I'm not getting my data into html after rendered that still I'm not
>> getting my data,i'm sharing my github link:
>> https://github.com/Herosoumen/clothproject.Please go through this
>> link.Please guys help me it's urgent.
>>
>>
>> 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 post to this group, send email to django-users@googlegroups.com.
>> Visit this group at https://groups.google.com/group/django-users.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CAPUw6WZ-ESxGfTZwiSBUf7ZSiDF3g0jzSNqUX3N4NowKA3%3DGTg%40mail.gmail.com
>> <https://groups.google.com/d/msgid/django-users/CAPUw6WZ-ESxGfTZwiSBUf7ZSiDF3g0jzSNqUX3N4NowKA3%3DGTg%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
> --
> 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 post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAC3mK7dv0yZwX6-

Re: data not coming into html

2019-05-22 Thread Soumen Khatua
I'm using media for development purpose and i configured that acordingly,So
I don't think this could be the problem.Not new actually.
please go through this link once:https://github.com/Herosoumen/clothproject

On Wed, May 22, 2019 at 7:12 PM Anirudh Jain 
wrote:

> Why is your shop templates folder outside the shop app folder? You dont
> even have any static files folder, niether in shop app nor in cart app. May
> be you could manage it first. BTW are you new to django? (just asking)
>
> On Wed, 22 May 2019, 19:03 Soumen Khatua, 
> wrote:
>
>> *cart.py*
>>
>> class Cart(object):
>> def __init__(self,request):
>> self.session = request.session
>> cart = self.session.get(settings.CART_SESSION_ID)
>> if not cart:
>> # save an empty cart in the session
>>cart = self.session[settings.CART_SESSION_ID] = {}
>> self.cart = cart
>>
>> def add(self,product,quantity = 1,update_quantity = False):
>> '''
>> Add a product to the cart or update its quantity
>>
>> '''
>> product_id = str(product.id)
>> print(product_id)
>> if product_id not in self.cart:
>> self.cart[product_id] = {'quantity':0,'price':str(product.price)}
>>
>> if update_quantity:
>> self.cart[product_id]['quantity'] = quantity
>>
>>
>> else:
>> self.cart[product_id]['quantity']+=quantity
>>
>> self.save()
>>
>> def save(self):
>> #mark the session as "modidied" to make sure it gets saved
>> self.session.modified = True
>>
>> def remove(self, product):
>> '''
>>   remove a product from the cart
>> '''
>> product_id = str(product.id)
>>
>> if product_id in self.cart:
>> del self.cart[product_id]
>> self.save()
>>
>>
>> def __iter__(self):
>> '''
>> Iterate over the items in the cart and get the products from the database
>>
>> '''
>> product_ids = self.cart.keys()
>> # get the product objects and add them to the cart
>> products = Product.objects.filter(id__in=product_ids)
>> cart = self.cart.copy()
>> for product in products:
>> cart[str(product.id)]['product'] = product
>>
>> for item in cart.values():
>> item['price'] = Decimal(item['price'])
>> item['total_price'] = item['price'] * item['quantity']
>> yield item
>>
>> def __len__(self):
>> """
>> count all the items in the cart
>> """
>> return sum(item['quantity'] for item in self.cart.values())
>>
>> def get_total_price(self):
>> return sum(Decimal(item['price']) * item['quantity'] for item in
>> self.cart.values())
>>
>> def clear(self):
>> #remove cart from session
>> del self.session[settings.CART_SESSION_ID]
>> self.save()
>>
>>
>> *views.py(cart)*
>> @require_POST
>> def cart_add(request,product_id):
>> cart = Cart(request)
>> product = get_object_or_404(Product,id  = product_id)
>> form = forms.CartAddProductForm(request.POST)
>> if form.is_valid():
>> cd  = form.cleaned_data
>> cart.add(product = product,quantity = cd['quantity'],update_quantity =
>> cd['update'])
>> return redirect('cart_detail')
>>
>>
>> def cart_remove(request,product_id):
>> cart = Cart(request)
>> product = get_object_or_404(Product,id = product_id)
>> cart.remove(product)
>> return redirect('cart_detail')
>>
>>
>>
>> def cart_detail(request):
>> cart = Cart(request)
>> for item in cart:
>> * print(item)*
>> for item in cart:
>> item['update_quantity_form'] = forms.CartAddProductForm(
>>initial =
>> {'quantity':item['quantity'],
>>   'update' : True}
>>
>>   )
>>
>> return render (request,'cart/cartdetail.html',{'cart':cart})
>>
>> here len of item is 0
>>
>>
>>
>> On Wed, May 22, 2019 at 6:58 PM Anirudh Jain 
>> wrote:
>>
>>> Can you tell which function in which app you are using to show data in
>>> which template ?
>>>
>>> On Wed, 22 May 2019, 18:56 Soumen Khatua, 
>>> wrote:
>>>
>>>> Hi Folks,
>>>> Guys I'

context must be a dict rather than RequestContext.

2019-05-30 Thread Soumen Khatua
Hi Folks,
I'm using django 1.11 for this project I'm implementing payment gateway of
PayuMoney but I'm getting thios error:

context must be a dict rather than RequestContext.



I alreday attach the source code,please let me know what i missed in this
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAPUw6Wb82bGpky2zsUpG2SKcnaaJ7dXeaNafuYKpD0QwF6m6Kw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
from django.shortcuts import render, render_to_response
from django.http import HttpResponse,HttpResponseRedirect
from django.template.loader import get_template
from django.template import Context, Template,RequestContext
import datetime
import hashlib
from random import randint
from django.views.decorators.csrf import csrf_protect, csrf_exempt
from django.views.decorators import csrf

def payment(request):
MERCHANT_KEY = ""
key=""
SALT = ""
PAYU_BASE_URL = "https://sandboxsecure.payu.in/_payment";
action = ''
posted={}
# Merchant Key and Salt provided y the PayU.
for i in request.POST:
posted[i]=request.POST[i]
hash_object = hashlib.sha256(b'randint(0,20)')
txnid=hash_object.hexdigest()[0:20]
hashh = ''
posted['txnid']=txnid
hashSequence = 
"key|txnid|amount|productinfo|firstname|email|udf1|udf2|udf3|udf4|udf5|udf6|udf7|udf8|udf9|udf10"
posted['key']=key
hash_string=''
hashVarsSeq=hashSequence.split('|')
for i in hashVarsSeq:
try:
hash_string+=str(posted[i])
except Exception:
hash_string+=''
hash_string+='|'
hash_string+=SALT
hashh=hashlib.sha512(hash_string.encode('utf-8')).hexdigest().lower()
action =PAYU_BASE_URL
if(posted.get("key")!=None and posted.get("txnid")!=None and 
posted.get("productinfo")!=None and posted.get("firstname")!=None and 
posted.get("email")!=None):
return 
render_to_response('paymant/payment_form.html',RequestContext(request,{"posted":posted,"hashh":hashh,"MERCHANT_KEY":MERCHANT_KEY,"txnid":txnid,"hash_string":hash_string,"action":"https://test.payu.in/_payment";
 }))
else:
return 
render_to_response('paymant/payment_form.html',RequestContext(request,{"posted":posted,"hashh":hashh,"MERCHANT_KEY":MERCHANT_KEY,"txnid":txnid,"hash_string":hash_string,"action":"."
 }))



@csrf_protect
@csrf_exempt
def payment_success(request):
c = {}
c.update(csrf(request))
status=request.POST["status"]
firstname=request.POST["firstname"]
amount=request.POST["amount"]
txnid=request.POST["txnid"]
posted_hash=request.POST["hash"]
key=request.POST["key"]
productinfo=request.POST["productinfo"]
email=request.POST["email"]
salt="X"
try:
additionalCharges=request.POST["additionalCharges"]

retHashSeq=additionalCharges+'|'+salt+'|'+status+'|||'+email+'|'+firstname+'|'+productinfo+'|'+amount+'|'+txnid+'|'+key
except Exception:
retHashSeq = 
salt+'|'+status+'|||'+email+'|'+firstname+'|'+productinfo+'|'+amount+'|'+txnid+'|'+key
hashh=hashlib.sha512(retHashSeq).hexdigest().lower()
if(hashh !=posted_hash):
print("Invalid Transaction. Please try again")
else:
print("Thank You. Your order status is ", status)
print("Your Transaction ID for this transaction is ",txnid)
print("We have received a payment of Rs. ", amount ,". Your order will 
soon be shipped.")
return 
render_to_response('sucess.html',RequestContext(request,{"txnid":txnid,"status":status,"amount":amount}))



@csrf_protect
@csrf_exempt
def payment_failure(request):
c = {}
c.update(csrf(request))
status=request.POST["status"]
firstname=request.POST["firstname"]
amount=request.POST["amount"]
txnid=request.POST["txnid"]
posted_hash=request.POST["hash"]
key=request.POST["key"]
productinfo=request.POST["productinfo"]
email=request.POST["email"]
salt=""
try:
additionalCharges=request.POST["additionalCharges"]

retHashSeq=additionalCharges+'|'+salt+'|'+status+'|||'+email+'|'+firstname+'|'+productinfo+'|'+amount+'|'+txnid+'|'+key
except Exception:
retHashSeq = 
salt+'|'+status+'|||'+email+'|'+firstname+'|'+productinfo+'|'+amount+'|'+txnid+'|'+key
hashh=hashlib.sha512(retHashSeq).hexdigest().lower()
if(hashh !=posted_hash):
print("Invalid Transaction. Please try again")
else:
print("Thank You. Your order status is ", status)
print("Your Transaction ID for this transaction is ",txnid)
  

Deployments

2019-06-06 Thread Soumen Khatua
Hi Folks,

I develope one project using django in my localhost. Now how I can deploy
that project into digital ocean and what are changes I need to do in my
project for moving to production server. Please help I have no idea
regarding this matter.
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAPUw6WbQ_zCf2xUeCH5%2BQ57b7c4%3D-FC-CAh_-AJdTE5gcoUR%3DQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Deployments

2019-06-06 Thread Soumen Khatua
In this tutorial I think they are covering about a how we can create new
project in digital ocean but I have already one project in my local
machine. How I can upload that project into server??

Thank you for your support.

On Fri, 7 Jun 2019, 01:24 Chetan Ganji,  wrote:

>
> https://www.digitalocean.com/community/tutorials/how-to-set-up-django-with-postgres-nginx-and-gunicorn-on-ubuntu-16-04
>
>
>
> Regards,
> Chetan Ganji
> +91-900-483-4183
> ganji.che...@gmail.com
> http://ryucoder.in
>
>
> On Thu, Jun 6, 2019 at 10:33 PM Soumen Khatua 
> wrote:
>
>> Hi Folks,
>>
>> I develope one project using django in my localhost. Now how I can deploy
>> that project into digital ocean and what are changes I need to do in my
>> project for moving to production server. Please help I have no idea
>> regarding this matter.
>> 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 post to this group, send email to django-users@googlegroups.com.
>> Visit this group at https://groups.google.com/group/django-users.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CAPUw6WbQ_zCf2xUeCH5%2BQ57b7c4%3D-FC-CAh_-AJdTE5gcoUR%3DQ%40mail.gmail.com
>> <https://groups.google.com/d/msgid/django-users/CAPUw6WbQ_zCf2xUeCH5%2BQ57b7c4%3D-FC-CAh_-AJdTE5gcoUR%3DQ%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
> --
> 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 post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAMKMUjsAfH-rB1cJW%2BbKh8Ldf9%3D%3DbntfvjTOibKMzm9DSKdGFg%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAMKMUjsAfH-rB1cJW%2BbKh8Ldf9%3D%3DbntfvjTOibKMzm9DSKdGFg%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAPUw6WbidHAsiPDHY%3D3JvpLZ4fD1URiu-7t%3DEpf4PTmpavDuFg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Server Setup Error

2019-06-12 Thread Soumen Khatua
Hi Folks,
After run this command:   sudo systemctl status gunicorn

















*● gunicorn.service - gunicorn daemon   Loaded: loaded
(/etc/systemd/system/gunicorn.service; enabled; vendor preset: enabled)
 Active: failed (Result: exit-code) since Wed 2019-06-12 14:01:44 UTC;
10min ago  Process: 20765 ExecStart=/home/sai/myproject/env/bin/gunicorn
--access-logfile - --workers 3 --bind
unix:/home/sai/myproject/gunicorn.sock clothproject1.wsgi:applica Main PID:
20765 (code=exited, status=1/FAILURE)Jun 12 14:01:44 sai-foundation
gunicorn[20765]: self.stop()Jun 12 14:01:44 sai-foundation
gunicorn[20765]:   File
"/home/sai/myproject/env/lib/python3.6/site-packages/gunicorn/arbiter.py",
line 393, in stopJun 12 14:01:44 sai-foundation gunicorn[20765]:
time.sleep(0.1)Jun 12 14:01:44 sai-foundation gunicorn[20765]:   File
"/home/sai/myproject/env/lib/python3.6/site-packages/gunicorn/arbiter.py",
line 245, in handle_chldJun 12 14:01:44 sai-foundation gunicorn[20765]:
self.reap_workers()Jun 12 14:01:44 sai-foundation gunicorn[20765]:   File
"/home/sai/myproject/env/lib/python3.6/site-packages/gunicorn/arbiter.py",
line 525, in reap_workersJun 12 14:01:44 sai-foundation gunicorn[20765]:
  raise HaltServer(reason, self.WORKER_BOOT_ERROR)Jun 12 14:01:44
sai-foundation gunicorn[20765]: gunicorn.errors.HaltServer: Jun 12 14:01:44 sai-foundation systemd[1]:
gunicorn.service: Main process exited, code=exited, status=1/FAILUREJun 12
14:01:44 sai-foundation systemd[1]: gunicorn.service: Failed with result
'exit-code'.lines 1-16/16 (END)*


please help me guys if you know this solutions?

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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAPUw6WZFXvvW9BvVtxN4rMb5VEBGByRoPmajGOg-Eq0MBx%2Bf9Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Digital Ocean server Error

2019-06-17 Thread Soumen Khatua
Hi Folks,

I uploaded my project into digital ocean but at the time of run
this*(sai@sai-foundation:~/saiproject$
sudo systemctl status gunicorn) *command,I'm getting this error:









*● gunicorn.service - gunicorn daemon   Loaded: loaded
(/etc/systemd/system/gunicorn.service; enabled; vendor preset: enabled)
 Active: failed (Result: exit-code) since Mon 2019-06-17 11:34:09 UTC; 14s
ago Main PID: 1174 (code=exited, status=200/CHDIR)Jun 17 11:34:09
sai-foundation systemd[1]: Started gunicorn daemon.Jun 17 11:34:09
sai-foundation systemd[1]: gunicorn.service: Main process exited,
code=exited, status=200/CHDIRJun 17 11:34:09 sai-foundation systemd[1]:
gunicorn.service: Unit entered failed state.Jun 17 11:34:09 sai-foundation
systemd[1]: gunicorn.service: Failed with result 'exit-code'*.

Please help me guys for this problem.


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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAPUw6WZBuRhK6QR4xZuNpYQrHARuoM0TWiBpTqGNnN0RJdsPXA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Digital Ocean server Error

2019-06-17 Thread Soumen Khatua
after run this  journalctl -xe  command,this is the log:
















































* The leading process of the session is 4094.Jun 17 14:29:43
sai-foundation su[4174]: Successful su for sai by rootJun 17 14:29:43
sai-foundation su[4174]: + /dev/pts/0 root:saiJun 17 14:29:43
sai-foundation su[4174]: pam_unix(su:session): session opened foJun 17
14:29:43 sai-foundation su[4174]: pam_systemd(su:session): Cannot createJun
17 14:30:35 sai-foundation sshd[4190]: Connection closed by 104.248.148.6
poJun 17 14:34:53 sai-foundation sshd[4222]: Connection closed by
104.248.148.6 poJun 17 14:34:59 sai-foundation su[4224]: Successful su for
root by saiJun 17 14:34:59 sai-foundation su[4224]: + /dev/pts/0
sai:rootJun 17 14:34:59 sai-foundation su[4224]: pam_unix(su:session):
session opened foJun 17 14:34:59 sai-foundation su[4224]:
pam_systemd(su:session): Cannot createJun 17 14:35:00 sai-foundation
sshd[1000]: pam_unix(sshd:session): session closeJun 17 14:35:00
sai-foundation systemd-logind[1395]: Removed session 33.-- Subject: Session
33 has been terminated-- Defined-By: systemd-- Support:
http://lists.freedesktop.org/mailman/listinfo/systemd-devel
<http://lists.freedesktop.org/mailman/listinfo/systemd-devel>--
Documentation: http://www.freedesktop.org/wiki/Software/systemd/multiseat
<http://www.freedesktop.org/wiki/Software/systemd/multiseat> A session
with the ID 33 has been terminated.Jun 17 14:35:01 sai-foundation
CRON[4237]: pam_unix(cron:session): session openeJun 17 14:35:01
sai-foundation CRON[4238]: (root) CMD (command -v debian-sa1 > /Jun 17
14:35:01 sai-foundation CRON[4237]: pam_unix(cron:session): session
closelines 1306-1328/1328 (END) The leading process of the session is
4094.Jun 17 14:29:43 sai-foundation su[4174]: Successful su for sai by
rootJun 17 14:29:43 sai-foundation su[4174]: + /dev/pts/0 root:saiJun 17
14:29:43 sai-foundation su[4174]: pam_unix(su:session): session opened for
user sai by root(uid=0)Jun 17 14:29:43 sai-foundation su[4174]:
pam_systemd(su:session): Cannot create session: Already running in a
sessionJun 17 14:30:35 sai-foundation sshd[4190]: Connection closed by
104.248.148.6 port 44108 [preauth]Jun 17 14:34:53 sai-foundation
sshd[4222]: Connection closed by 104.248.148.6 port 46822 [preauth]Jun 17
14:34:59 sai-foundation su[4224]: Successful su for root by saiJun 17
14:34:59 sai-foundation su[4224]: + /dev/pts/0 sai:rootJun 17 14:34:59
sai-foundation su[4224]: pam_unix(su:session): session opened for user root
by root(uid=1000)Jun 17 14:34:59 sai-foundation su[4224]:
pam_systemd(su:session): Cannot create session: Already running in a
sessionJun 17 14:35:00 sai-foundation sshd[1000]: pam_unix(sshd:session):
session closed for user rootJun 17 14:35:00 sai-foundation
systemd-logind[1395]: Removed session 33.-- Subject: Session 33 has been
terminated-- Defined-By: systemd-- Support:
http://lists.freedesktop.org/mailman/listinfo/systemd-devel
<http://lists.freedesktop.org/mailman/listinfo/systemd-devel>--
Documentation: http://www.freedesktop.org/wiki/Software/systemd/multiseat
<http://www.freedesktop.org/wiki/Software/systemd/multiseat> A session
with the ID 33 has been terminated.Jun 17 14:35:01 sai-foundation
CRON[4237]: pam_unix(cron:session): session opened for user root by
(uid=0)Jun 17 14:35:01 sai-foundation CRON[4238]: (root) CMD (command -v
debian-sa1 > /dev/null && debian-sa1 1 1)Jun 17 14:35:01 sai-foundation
CRON[4237]: pam_unix(cron:session): session closed for user root~*

On Mon, Jun 17, 2019 at 5:24 PM Anirudh Jain 
wrote:

> could you run `journalctl -xe` tell us more about the log result
>
> On Mon, 17 Jun 2019, 17:08 Soumen Khatua, 
> wrote:
>
>> Hi Folks,
>>
>> I uploaded my project into digital ocean but at the time of run 
>> this*(sai@sai-foundation:~/saiproject$
>> sudo systemctl status gunicorn) *command,I'm getting this error:
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> *● gunicorn.service - gunicorn daemon   Loaded: loaded
>> (/etc/systemd/system/gunicorn.service; enabled; vendor preset: enabled)
>>  Active: failed (Result: exit-code) since Mon 2019-06-17 11:34:09 UTC; 14s
>> ago Main PID: 1174 (code=exited, status=200/CHDIR)Jun 17 11:34:09
>> sai-foundation systemd[1]: Started gunicorn daemon.Jun 17 11:34:09
>> sai-foundation systemd[1]: gunicorn.service: Main process exited,
>> code=exited, status=200/CHDIRJun 17 11:34:09 sai-foundation systemd[1]:
>> gunicorn.service: Unit entered failed state.Jun 17 11:34:09 sai-foundation
>> systemd[1]: gunicorn.service: Failed with result 'exit-code'*.
>>
>> Please help me guys for this problem.
>>
>>
>> Thank You.
>>
>>
>>
>>
>> regards,
>> Soumen
>>
>> --
>> You received this message because you ar

Typical Django Error

2019-06-18 Thread Soumen Khatua
Hi Folks,

After I turnded debug into False and Alowed host=['providedip','*']. It's
showing like this:
mod = import_module(mod_name)
  File "C:\Users\sou\AppData\Local\Programs\Python\Python36\lib\importlib\__
__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
  File "", line 994, in _gcd_import
  File "", line 971, in _find_and_load
  File "", line 953, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'views'

Please help me guys it's urgent.

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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAPUw6WbAroJcmBD57Vs-Bpw7Q_fRu9FmpAArehC-pkn%2BxJFDrw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Serving staticfiles

2019-06-18 Thread Soumen Khatua
 Hi Folks,
After run python manage.py collrctststic all the static files copied into
project_root specified folder. But after doing debug = false,the images and
Css files link is not working and showing 404 error message in console. But
when I did debug = True it's url and everything working properly. I'm using
django 1.11 so I also added {% load staticfiles %}

 
I'm using loacal machine server(python manage.py runserver) yjen what is
problem in this case???


Please help guys.

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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAPUw6WZZLnWc3K%3DinjD1j4v0Bp56iGOkama9Yy4w28qeqtuA4Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Javascript File is not responding

2019-06-25 Thread Soumen Khatua
Thank you for your email.
Now it's woring after added it under Bootstrap link.

Thank You


Regards,
Soumen



On Tue, 25 Jun 2019, 20:34 ravikumar dingari,  wrote:

> Can U send , How to set Forget PasswordIn django...With user models
>
> On 25-Jun-2019 1:25 PM, "Soumen Khatua"  wrote:
>
>> Hi Folks,
>>
>> When I'm using my javasscript/jquery code inside django template then
>> it's working fine but when I'm save it in external file called main.js then
>> it's functionality not responding but url is working.I did all the process
>> but still problem is same??
>>
>> Myproject:
>>  |   myproject
>>  | myapp
>>  | static
>>  | css
>>  | style.css ( this is working fine )
>>   .
>>| js
>>   | main.js ( url is working but functionality is not working
>> )
>>
>> settings.py :
>>
>> STATIC_URL = '/static/'
>> STATIC_ROOT = os.path.join(BASE_DIR,'assets')
>> STATICFILES_DIRS = [
>>
>> ('favicons',os.path.join(BASE_DIR,'static','favicons')),
>> ('images',os.path.join(BASE_DIR,'static','images')),
>> ('css',os.path.join(BASE_DIR,'static','css')),
>> ('js',os.path.join(BASE_DIR,'static','js')),
>> ]
>> base.html:
>>
>> {% load staticfiles %}
>> https://code.jquery.com/jquery-2.2.4.min.js"</a>;
>> integrity="sha256-BbhdlvQf/xTY9gja0Dq3HiwQF8LaCRTXxZKRutelT44="
>> crossorigin="anonymous">
>> 
>> 
>>
>> Please help me guys. I attached some screen shot for your better
>> understand.
>>
>> 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 post to this group, send email to django-users@googlegroups.com.
>> Visit this group at https://groups.google.com/group/django-users.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CAPUw6WYSeJL0G51A5Osd3D6XAFwtow9tcfKdC7CD_jz144p07Q%40mail.gmail.com
>> <https://groups.google.com/d/msgid/django-users/CAPUw6WYSeJL0G51A5Osd3D6XAFwtow9tcfKdC7CD_jz144p07Q%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
> --
> 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 post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CA%2BvYKMTVv9%3Dr8p8U32_9%3D96wp5rw5v%3DsxdTV0zZxkMftZyNKYw%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CA%2BvYKMTVv9%3Dr8p8U32_9%3D96wp5rw5v%3DsxdTV0zZxkMftZyNKYw%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAPUw6WbhP8h6qLDGR7v3jEd9v4XV9d1KoAbPSr%2BnMdQcpX44Rg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Internal Server Error

2019-06-28 Thread Soumen Khatua
Hi Folks,
I'm using digital ocean provided Ubuntu 16.04 version yesterday I was
trying to configure PostgreSQL remotely.So I did some changes in this path:
/etc/postgresql/9.5/main/pg-hba.conf and postgresql.conf. After that I
cahnge it as it wasbut still I'm getting Internal server error at the
provided IP and also Domain name.

Plase help me guys.

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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAPUw6WYgj5r8Bmkv61%2BgyKN9wRGzXyxkyOPFY9BB7bs0wydG%2BQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Database Configuration Error

2019-06-29 Thread Soumen Khatua
Hi Folks,

I'm uisng Digital Ocean provided VPS and I'm using PostgreSQL and I'm
gettings this error,





*File
"/home/sai/saiproject/env/lib/python3.5/site-packages/psycopg2/__init__.py",
line 126, in connectconn = _connect(dsn,
connection_factory=connection_factory,
**kwasync)django.db.utils.OperationalError: could not connect to server:
Connection refused Is the server running on host "localhost" (127.0.0.1)
and accepting TCP/IP connections on port 5432?*


Please help me,guys.
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAPUw6Wba9GhP2GiuQgE0CkQwURg-T%3DSP%2B9osHMkS%2B_13vrxfBQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


404 not found

2019-07-01 Thread Soumen Khatua
Hi Folks,
i'm using Django 1.11 and is et up everything properly but at the wrong url
django redirecting to 500 page instead of 404 page.Please help me,How i can
solve this problem? Here is my code:


*views.py*




*def error_404(request):return
render(request,'shop/product/404.html',status = 404)def
error_500(request):return render(request,'shop/product/500.html',status
= 500)*

*urls.py*

*from django.conf.urls import url,include,handler404,handler500*

*handler404 = 'shop.views.error_404'handler500 = 'shop.views.error_500'*

*settings.py*

*debug = False*


Guys please help!!!


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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAPUw6WZN0Bj5cETJuoYPHMBE7u9_7Ux8Y-1AtVmF2gcsWwBabA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


django context data into javascript

2020-02-25 Thread Soumen Khatua
Hi Folks,

I'm sending some context data into html like
name = 'soumen'
return render(request,'xyz.html', context = {'name':name})

inside myjs.js(js script has been integrated to html):
---
var my_name = {{name}};

I'm getting an error::: Uncaught SyntaxError: Unexpected token '{'

So,How I can render data into frontend??

Thank You 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/CAPUw6WYM%2BvkoRqOaUn0%2Bt0j9fBf%2BhUZ2myvfsfY4qoBmLAgTfw%40mail.gmail.com.


Re: django context data into javascript

2020-02-25 Thread Soumen Khatua
But I'm getting one error

On Tue 25 Feb, 2020, 5:59 PM Naveen Arora, 
wrote:

> Hi, this is simple just enclose {{name}} into " " as "{{name}}" for your
> part.
>
> Thanks
>
> On Tuesday, 25 February 2020 15:56:05 UTC+5:30, Soumen Khatua wrote:
>>
>> Hi Folks,
>>
>> I'm sending some context data into html like
>> name = 'soumen'
>> return render(request,'xyz.html', context = {'name':name})
>>
>> inside myjs.js(js script has been integrated to html):
>> ---
>> var my_name = {{name}};
>>
>> I'm getting an error::: Uncaught SyntaxError: Unexpected token '{'
>>
>> So,How I can render data into frontend??
>>
>> Thank You 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/b6c9cd98-b9bd-4178-919a-13d8156029a6%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/b6c9cd98-b9bd-4178-919a-13d8156029a6%40googlegroups.com?utm_medium=email&utm_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/CAPUw6WatGXxg0G%3DxC%3DS8ddMFmMpQm-TeZ8B2zZxZi9AAFj8npA%40mail.gmail.com.


Admin login problem

2020-02-26 Thread Soumen Khatua
Hi Folks,
after creating superuser by using this command python manage.py
createsuperuser. Whenever I'm entering the same(exact) login
credentials.I'm getting this error:
Please enter the correct phone number and password for a staff account.
Notethat both fields may be case-sensitive .

But don't why i'm getting this error message.


Thank you in advance

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/CAPUw6WYP-TBzvcgikd4%2BnrGVFstS0cC_dDf1RndheayTZ_2o5g%40mail.gmail.com.


Django Image and File

2020-02-26 Thread Soumen Khatua
Hi Folks,

Actually I have one image filed called profile_pic and another is file
field called  documents but I don't know what is best practise to store it.
Most importantly how I can make each user details is unique.

Thank you in advance

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/CAPUw6WabzCG%2B4ARdyzdn-3DCckud%3D871RtOSxqRiRMLo6zbQuQ%40mail.gmail.com.


production setup

2020-02-27 Thread Soumen Khatua
Hi Folks,

I'm storing users images and documents inside media folder during
development. but I don't how to serve this files for production level.Any
one have any idea, actually I read the documentation but I'm still confuse.

Thank You in advance


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/CAPUw6WZwP%3Dv_wFE71UzU3jYEBXo8wNR9Yf20QFymFkizg2QpjA%40mail.gmail.com.


Re: Django Image and File

2020-02-27 Thread Soumen Khatua
Thanks for your response.

On Thu 27 Feb, 2020, 10:03 PM Robert Rajendra, 
wrote:

> Store only the path in DB and image file in server folder this is the best
> practice,  save the file in some folder and forward the path to DB Object
> so that your DB can remember the path of the file and you can load it in
> the frontend,
>
> here is a snippet that you can use
>
>
> import  FileSystemStorage()
> from django.core.files.storage import FileSystemStorage
> function that will store the file
> profile_pic_upload = request.FILES.get('profile_pic_upload', 'false')
> if user:
> if profile_pic_upload != 'false':
> fs = FileSystemStorage()
> profile_pic = compress_image(profile_pic_upload)
> filename = fs.save(profile_pic_upload.name, profile_pic)
> uploaded_file_url = fs.url(filename)
> uploaded_file_url = uploaded_file_url.split("/")
> original_url= uploaded_file_url[-1]
> user_profile.profile_pic = original_url Here fs is the object of the
> FileSystemStorege() class compress_image() is my custom function no need to
> add that, you can directly pass the image object that you are getting from
> request. then the origina_url will go to DB user_profile.profile_pic = 
> original_url
>  the URL that we get from FileSystemStorage()> also, it will add a
> randomly generated value at the end of the file that will be very useful if
> you have 2 images with the same name NOTE make sure that you have a media
> folder added to you your settings.py file or you can pass the path to where
> to save the image like this fs = FileSystemStorage(location=
> 'media/rent_pictures/') Hope this helps another thing is that image is
> also a file and treated the same way in the backend regards,
>
> On Thu, 27 Feb 2020 at 11:56, Soumen Khatua 
> wrote:
>
>> Hi Folks,
>>
>> Actually I have one image filed called profile_pic and another is file
>> field called  documents but I don't know what is best practise to store it.
>> Most importantly how I can make each user details is unique.
>>
>> Thank you in advance
>>
>> 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/CAPUw6WabzCG%2B4ARdyzdn-3DCckud%3D871RtOSxqRiRMLo6zbQuQ%40mail.gmail.com
>> <https://groups.google.com/d/msgid/django-users/CAPUw6WabzCG%2B4ARdyzdn-3DCckud%3D871RtOSxqRiRMLo6zbQuQ%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>>
>
>
> --
>
> *Robert Rajendra*
>
> Associate Network/Server Support Engineer
>
> IT Hands
>
> P: +91 863.087.3094 <+91%2086308%2073094>
>
> W: www.ITHands.com <http://www.ithands.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/CABbC_KHUHtuJRsGUFNqf%2BXK5CZy9oewdueTdjZ6r7A%3DQTTNDQg%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CABbC_KHUHtuJRsGUFNqf%2BXK5CZy9oewdueTdjZ6r7A%3DQTTNDQg%40mail.gmail.com?utm_medium=email&utm_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/CAPUw6WYq%3D1XXyU6q1QxhqgNg%3D1s-y6pFry6WtfmcwVZYY5-Ovg%40mail.gmail.com.


Image Upload

2020-02-28 Thread Soumen Khatua
Hi Folks,

I'm using DRF APIView to upload images, but I don't know how to write a
POST request to accept image. Please advise me how I can do it?

my *serializers.py*








*class ImageSerializer(serializers.ModelSerializer):class Meta:
model = Profilefields = ['user','profile_pic']extra_kwargs
= {'user': {'write_only': True}}*

My models.py contain profile_pic as a ImageField.


Thank you in advance


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/CAPUw6Wax0gjhfSUV0g1h8asaC_av0dA-ntTyETfrWhh%2B6XgZEw%40mail.gmail.com.


Re: production setup

2020-02-28 Thread Soumen Khatua
I already read the documentation but still I'm confuse that's why I posted.

BTW thank you for your help.

On Fri, Feb 28, 2020 at 5:51 PM Naveen Arora 
wrote:

> Hi Soumen,
>
> https://docs.djangoproject.com/en/3.0/howto/static-files/deployment/
> https://docs.djangoproject.com/en/3.0/howto/static-files/
>
> Have a look here. Hope it helps :)
> Cheers
>
> On Thursday, 27 February 2020 16:48:46 UTC+5:30, Soumen Khatua wrote:
>>
>> Hi Folks,
>>
>> I'm storing users images and documents inside media folder during
>> development. but I don't how to serve this files for production level.Any
>> one have any idea, actually I read the documentation but I'm still confuse.
>>
>> Thank You in advance
>>
>>
>> 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/4042f87e-cd0a-48e6-b79a-9070cde603da%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/4042f87e-cd0a-48e6-b79a-9070cde603da%40googlegroups.com?utm_medium=email&utm_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/CAPUw6Wb%3D7-WNRJ%3DCpCKkFnztqEXUaEaDLSL46ZSjzcHgnqUExQ%40mail.gmail.com.


Re: production setup

2020-02-29 Thread Soumen Khatua
Okay, sure.

Thank you for your response.

On Sat 29 Feb, 2020, 11:33 AM Naveen Arora, 
wrote:

> Hi
>
> have a look at this -
> https://github.com/codingforentrepreneurs/Guides/blob/master/all/Heroku_Django_Deployment_Guide.md
>
> Cheers
>
> --
> 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/62ca806f-a7ef-4124-af65-f6fb775448d6%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/CAPUw6WZ3WuWtiP33BamA3P2t_WJ3w9KX5QM1ka-xpH8rHc23WA%40mail.gmail.com.


Re: production setup

2020-03-01 Thread Soumen Khatua
Actually I'm storing this files in aws s3 bucket..but I want to  know Is it
a good practice to store all the images and documents inside media folder.

On Sat 29 Feb, 2020, 6:45 PM Appu Yadav,  wrote:

> store image and documents in aws bucket or Google stroage
>
> On Sat, 29 Feb 2020, 10:25 Naveen Arora, 
> wrote:
>
>> Try implementing it for once. If you face any problem, you can post in
>> this community
>>
>> 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/bb5983e0-d829-47e4-a28d-196e50297cff%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/CAF_eevfxtJT7mTNAz-Yao_MUqUGB%3DF%2Btg6Q9oOdFMt4UWE%2BsdA%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/CAPUw6WaVYYyuR2PU1wkdKQrnd3bU5j36_9Aid_4DiYZ_0jLV5Q%40mail.gmail.com.


NotImplementedError: This backend doesn't support absolute paths.

2020-03-03 Thread Soumen Khatua
Hi Folks,

I'm using AWS S3 Bucket to store media folder(images) but I want to resize
each every image in 300*300. So, I'm overriding the save method inside
django model class. But I'm getting one error caled:
*   NotImplementedError: This backend doesn't support absolute paths.*

*My django models look like:*

* class Profile(models.Model):*













*user = models.OneToOneField(AUTH_USER_MODEL,
on_delete=models.CASCADE,related_name="profile")profile_pic
= models.ImageField(default = 'profile.jpg',upload_to =
user_directory_path, null = True)def save(self, *args, **kwargs):
  super().save(*args, **kwargs)img =
Image.open(self.profile_pic.path)if img.height > 300 or img.width >
300:output_size = (300, 300)
img.thumbnail(output_size)img.save(self.image.path)*



I don't know how to solve this issue.

Thank you in advance

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/CAPUw6WYJxPh%3DHY%2Bm0HLajTN1EV-9eo4djThgiCZdjdbaM2pr0A%40mail.gmail.com.


Re: NotImplementedError: This backend doesn't support absolute paths.

2020-03-03 Thread Soumen Khatua
after changing the path still I'm getting the same type of error.

Thank you for your response.


On Tue, Mar 3, 2020 at 3:01 PM Naveen Arora 
wrote:

> Try passing a relative path, as the error itself says, absolute path not
> supported.
>
> Thanks
>
> On Tuesday, 3 March 2020 13:46:11 UTC+5:30, Soumen Khatua wrote:
>>
>> Hi Folks,
>>
>> I'm using AWS S3 Bucket to store media folder(images) but I want to
>> resize each every image in 300*300. So, I'm overriding the save method
>> inside django model class. But I'm getting one error caled:
>> *   NotImplementedError: This backend doesn't support absolute paths.*
>>
>> *My django models look like:*
>>
>> * class Profile(models.Model):*
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> *user = models.OneToOneField(AUTH_USER_MODEL,
>> on_delete=models.CASCADE,related_name="profile")profile_pic
>> = models.ImageField(default = 'profile.jpg',upload_to =
>> user_directory_path, null = True)def save(self, *args, **kwargs):
>>   super().save(*args, **kwargs)img =
>> Image.open(self.profile_pic.path)if img.height > 300 or img.width >
>> 300:output_size = (300, 300)
>> img.thumbnail(output_size)img.save(self.image.path)*
>>
>>
>>
>> I don't know how to solve this issue.
>>
>> Thank you in advance
>>
>> 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/c207b85c-c966-43c5-8c23-14084bb4a979%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/c207b85c-c966-43c5-8c23-14084bb4a979%40googlegroups.com?utm_medium=email&utm_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/CAPUw6WYkjYTyBJNR%3DZdTYHKRcYV00O8f2NZPx%3DbcepO%3D0OP2fQ%40mail.gmail.com.


Re: NotImplementedError: This backend doesn't support absolute paths.

2020-03-03 Thread Soumen Khatua
okay..sure

On Wed, Mar 4, 2020 at 11:56 AM Naveen Arora 
wrote:

> Can you share the complete traceback of error + what are you passing and
> where so that i can understand the flow. ?
>
> Cheers
>
> On Tuesday, 3 March 2020 19:15:56 UTC+5:30, Soumen Khatua wrote:
>>
>> after changing the path still I'm getting the same type of error.
>>
>> Thank you for your response.
>>
>>
>> On Tue, Mar 3, 2020 at 3:01 PM Naveen Arora  wrote:
>>
>>> Try passing a relative path, as the error itself says, absolute path not
>>> supported.
>>>
>>> Thanks
>>>
>>> On Tuesday, 3 March 2020 13:46:11 UTC+5:30, Soumen Khatua wrote:
>>>>
>>>> Hi Folks,
>>>>
>>>> I'm using AWS S3 Bucket to store media folder(images) but I want to
>>>> resize each every image in 300*300. So, I'm overriding the save method
>>>> inside django model class. But I'm getting one error caled:
>>>> *   NotImplementedError: This backend doesn't support absolute paths.*
>>>>
>>>> *My django models look like:*
>>>>
>>>> * class Profile(models.Model):*
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> *user = models.OneToOneField(AUTH_USER_MODEL,
>>>> on_delete=models.CASCADE,related_name="profile")profile_pic
>>>> = models.ImageField(default = 'profile.jpg',upload_to =
>>>> user_directory_path, null = True)def save(self, *args, **kwargs):
>>>>   super().save(*args, **kwargs)img =
>>>> Image.open(self.profile_pic.path)if img.height > 300 or img.width >
>>>> 300:output_size = (300, 300)
>>>> img.thumbnail(output_size)img.save(self.image.path)*
>>>>
>>>>
>>>>
>>>> I don't know how to solve this issue.
>>>>
>>>> Thank you in advance
>>>>
>>>> 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...@googlegroups.com.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/c207b85c-c966-43c5-8c23-14084bb4a979%40googlegroups.com
>>> <https://groups.google.com/d/msgid/django-users/c207b85c-c966-43c5-8c23-14084bb4a979%40googlegroups.com?utm_medium=email&utm_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/1b7a29a2-8987-4169-9d4c-d6879fc35c46%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/1b7a29a2-8987-4169-9d4c-d6879fc35c46%40googlegroups.com?utm_medium=email&utm_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/CAPUw6Wb%3DzXLZS2ZJc29TzMtxE4ap7euPY_apq9ydEERiHim8SQ%40mail.gmail.com.


Re: NotImplementedError: This backend doesn't support absolute paths.

2020-03-03 Thread Soumen Khatua
obj.save(force_insert=True, using=self.db)
TypeError: save() got an unexpected keyword argument 'force_insert'
[04/Mar/2020 12:11:16] "POST /register/ HTTP/1.1" 500 108601

On Wed, Mar 4, 2020 at 12:00 PM Soumen Khatua 
wrote:

> okay..sure
>
> On Wed, Mar 4, 2020 at 11:56 AM Naveen Arora 
> wrote:
>
>> Can you share the complete traceback of error + what are you passing and
>> where so that i can understand the flow. ?
>>
>> Cheers
>>
>> On Tuesday, 3 March 2020 19:15:56 UTC+5:30, Soumen Khatua wrote:
>>>
>>> after changing the path still I'm getting the same type of error.
>>>
>>> Thank you for your response.
>>>
>>>
>>> On Tue, Mar 3, 2020 at 3:01 PM Naveen Arora 
>>> wrote:
>>>
>>>> Try passing a relative path, as the error itself says, absolute path
>>>> not supported.
>>>>
>>>> Thanks
>>>>
>>>> On Tuesday, 3 March 2020 13:46:11 UTC+5:30, Soumen Khatua wrote:
>>>>>
>>>>> Hi Folks,
>>>>>
>>>>> I'm using AWS S3 Bucket to store media folder(images) but I want to
>>>>> resize each every image in 300*300. So, I'm overriding the save method
>>>>> inside django model class. But I'm getting one error caled:
>>>>> *   NotImplementedError: This backend doesn't support absolute paths.*
>>>>>
>>>>> *My django models look like:*
>>>>>
>>>>> * class Profile(models.Model):*
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> *user = models.OneToOneField(AUTH_USER_MODEL,
>>>>> on_delete=models.CASCADE,related_name="profile")
>>>>> profile_pic
>>>>> = models.ImageField(default = 'profile.jpg',upload_to =
>>>>> user_directory_path, null = True)def save(self, *args, **kwargs):
>>>>>   super().save(*args, **kwargs)img =
>>>>> Image.open(self.profile_pic.path)if img.height > 300 or img.width 
>>>>> >
>>>>> 300:output_size = (300, 300)
>>>>> img.thumbnail(output_size)img.save(self.image.path)*
>>>>>
>>>>>
>>>>>
>>>>> I don't know how to solve this issue.
>>>>>
>>>>> Thank you in advance
>>>>>
>>>>> 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...@googlegroups.com.
>>>> To view this discussion on the web visit
>>>> https://groups.google.com/d/msgid/django-users/c207b85c-c966-43c5-8c23-14084bb4a979%40googlegroups.com
>>>> <https://groups.google.com/d/msgid/django-users/c207b85c-c966-43c5-8c23-14084bb4a979%40googlegroups.com?utm_medium=email&utm_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/1b7a29a2-8987-4169-9d4c-d6879fc35c46%40googlegroups.com
>> <https://groups.google.com/d/msgid/django-users/1b7a29a2-8987-4169-9d4c-d6879fc35c46%40googlegroups.com?utm_medium=email&utm_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/CAPUw6WZNtw3xO6p9Moj-uAWA1xh6btrW%2Bow68q8duxFj-iwvDw%40mail.gmail.com.


Re: NotImplementedError: This backend doesn't support absolute paths.

2020-03-03 Thread Soumen Khatua
Could you tell me how I can save image in aws S3 bucket after resizing the
image into some random pixels??


Thank you

On Wed, Mar 4, 2020 at 12:11 PM Soumen Khatua 
wrote:

> obj.save(force_insert=True, using=self.db)
> TypeError: save() got an unexpected keyword argument 'force_insert'
> [04/Mar/2020 12:11:16] "POST /register/ HTTP/1.1" 500 108601
>
> On Wed, Mar 4, 2020 at 12:00 PM Soumen Khatua 
> wrote:
>
>> okay..sure
>>
>> On Wed, Mar 4, 2020 at 11:56 AM Naveen Arora 
>> wrote:
>>
>>> Can you share the complete traceback of error + what are you passing and
>>> where so that i can understand the flow. ?
>>>
>>> Cheers
>>>
>>> On Tuesday, 3 March 2020 19:15:56 UTC+5:30, Soumen Khatua wrote:
>>>>
>>>> after changing the path still I'm getting the same type of error.
>>>>
>>>> Thank you for your response.
>>>>
>>>>
>>>> On Tue, Mar 3, 2020 at 3:01 PM Naveen Arora 
>>>> wrote:
>>>>
>>>>> Try passing a relative path, as the error itself says, absolute path
>>>>> not supported.
>>>>>
>>>>> Thanks
>>>>>
>>>>> On Tuesday, 3 March 2020 13:46:11 UTC+5:30, Soumen Khatua wrote:
>>>>>>
>>>>>> Hi Folks,
>>>>>>
>>>>>> I'm using AWS S3 Bucket to store media folder(images) but I want to
>>>>>> resize each every image in 300*300. So, I'm overriding the save method
>>>>>> inside django model class. But I'm getting one error caled:
>>>>>> *   NotImplementedError: This backend doesn't support absolute paths.*
>>>>>>
>>>>>> *My django models look like:*
>>>>>>
>>>>>> * class Profile(models.Model):*
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> *user = models.OneToOneField(AUTH_USER_MODEL,
>>>>>> on_delete=models.CASCADE,related_name="profile")
>>>>>> profile_pic
>>>>>> = models.ImageField(default = 'profile.jpg',upload_to =
>>>>>> user_directory_path, null = True)def save(self, *args, **kwargs):
>>>>>>   super().save(*args, **kwargs)img =
>>>>>> Image.open(self.profile_pic.path)if img.height > 300 or 
>>>>>> img.width >
>>>>>> 300:output_size = (300, 300)
>>>>>> img.thumbnail(output_size)img.save(self.image.path)*
>>>>>>
>>>>>>
>>>>>>
>>>>>> I don't know how to solve this issue.
>>>>>>
>>>>>> Thank you in advance
>>>>>>
>>>>>> 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...@googlegroups.com.
>>>>> To view this discussion on the web visit
>>>>> https://groups.google.com/d/msgid/django-users/c207b85c-c966-43c5-8c23-14084bb4a979%40googlegroups.com
>>>>> <https://groups.google.com/d/msgid/django-users/c207b85c-c966-43c5-8c23-14084bb4a979%40googlegroups.com?utm_medium=email&utm_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/1b7a29a2-8987-4169-9d4c-d6879fc35c46%40googlegroups.com
>>> <https://groups.google.com/d/msgid/django-users/1b7a29a2-8987-4169-9d4c-d6879fc35c46%40googlegroups.com?utm_medium=email&utm_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/CAPUw6WY7Np5XPetukqG%2B8Wnze8fiyj5hfrDS9rp6-Ov1PDwEBQ%40mail.gmail.com.


Unique constrains failed

2020-03-06 Thread Soumen Khatua
Hi Folks,

I'm extending user model as OneToOneField in my own model. So it's mean one
user can contain only one field. But if I'll try to do another request I
getting unique contrainr failed so as of now it's absolutely fine. But my
query is I want to handle this error and send a message to that user
something like your data is already existed in our database. But I don't
know how do that,please help my guys?!!


Thank you in advance

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


ACESS FOREIGN KEY TABLE

2020-03-12 Thread Soumen Khatua
Hi Folks,
My profile model is Foreignkey in another model called Skill,Now I fetch
all the data of this user from Profile table(model) and store it into a
variable called user_profile and now my query is I want to fetch the data
of the Skill table(model) by using this variable.How I can do that??

Thank you in advance


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/CAPUw6WbQEQGF1U4UVKT4kJBWCsHJ%2BC5JX-_u-UpQREcMCuV6XA%40mail.gmail.com.


Restriction to create multiple instance

2020-03-16 Thread Soumen Khatua
Hi Folks,

Actually I'm extending user model as foreignkey into my own model called
Skills. So, suppose a user called X has skill of python and another user
called Y has the same skill set then I'm creating two instance into my
Skills table. But I want to do something like if X and Y have same skill
then they should be under same hood which python(skill) like python---(X,
Y) and if Y's another skill match with some others users then it should be
like Django(Y, Z). I know it is related to many to many relationship
but I don't know how to implement it. I'm also searching about it if you
people know how to solve it then it will save lots of time.

Thank you in advance.

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/CAPUw6WbrZA_tocK4Jz1cMU%3DCeKa%3DHutE0DUCDdGvcXre514uXQ%40mail.gmail.com.


Many to many relationship

2020-03-17 Thread Soumen Khatua
Hi Folks,

I'm using many to many relationship of a model by I'm not able update one
person record. I don't know how to update a particular person's record when
I'm using many to many relationship.

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/CAPUw6WbLc6opPG-XYQwTauVp7wWNx7dd%3DJTcNcDmZAw07Crohw%40mail.gmail.com.


font awesome loading problem

2020-04-08 Thread Soumen Khatua
Hi Folks,

I'm using AWS S3 bucket for my django project,now I want to serve all the
sattic files using this s3 bucket. So I copied all the all static file from
CDN and websites to my S3 bucket.All are working fine for font-awesome I'm
getting some error like:

*Access to font at
'**https://xyz.s3.amazonaws.com/static/css/font-awesome/fonts/fontawesome-webfont.woff2?v=4.7.0
**'
from origin '**http://127.0.0.1:8000
**' has
been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is
present on the requested resource.*

I spent  almost 1day to solve this probem and still I don't now How to
solve it??
Please help me guys regarding this issue.

Thank you in advance

Regards,
Soumen

Note: All error are here

*Access to font at
'https://xyz.s3.amazonaws.com/static/css/font-awesome/fonts/fontawesome-webfont.woff?v=4.7.0
'
from origin 'http://127.0.0.1:8000 ' has been
blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present
on the requested resource.*



*GET
https://xyz.s3.amazonaws.com/static/css/font-awesome/fonts/fontawesome-webfont.ttf?v=4.7.0

net::ERR_FAILED?m=conversations&q=sql:945 1*

*GET
https://xyz.s3.amazonaws.com/static/css/font-awesome/fonts/fontawesome-webfont.woff?v=4.7.0

net::ERR_FAILED*

*Access to font at
'https://xyz.s3.amazonaws.com/static/css/font-awesome/fonts/fontawesome-webfont.ttf?v=4.7.0
'
from origin 'http://127.0.0.1:8000 ' has been
blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present
on the requested resource.*

-- 
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/CAPUw6WaCrSjdH7%2B0Ng1Wh_s5%2BAxH-7ike1Y9ntcwzUfQYqoOGw%40mail.gmail.com.


Django Pipeline

2020-05-07 Thread Soumen Khatua
Hi Guys,
I want to use Django-pipeline library, Does anyone know how I can use it?
I'm also using AWS S3 storage. Any help will be appreciated.

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/CAPUw6WZ7eTj%2BmXOmXs9qHn-XSzUFKs7Zop-qna-GrfHP9N%3DPdA%40mail.gmail.com.


Custom Group

2020-05-26 Thread Soumen Khatua
Hi Folks,
Actually my requirement is a registered user can create a room/group where
n(could be any number) number of peoples can join for a certain period of
time like 1 hr,But I don't have any idea about this,How I can do this in
Django?!

Any help will be appreciated

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/CAPUw6WbmC23MaUNFvwJmOb84GroKceOandCP%3D7uWkF%2Bi0ei21A%40mail.gmail.com.


Optmized Query

2020-05-27 Thread Soumen Khatua
Hi Folks,
I have many to many relationships and Foreign Key in the table, I'm using
select_realted(foreign key filed name) to optimize the query but I want to
fetch many to many and foreign key at the same time , How I can do this in
very optimized way?

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/CAPUw6Wb6f-BCwUZfvgzGtsrbV1seq1iGbXyuqoH%3DKxZrJ2EyLg%40mail.gmail.com.


Re: Optmized Query

2020-05-27 Thread Soumen Khatua
I also know about this concept but I don't how I can achieve it, Could
you give me an example?
Suppose I have:







*class Profile(models.Model):user = models.OneToOneField(
settings.AUTH_USER_MODEL,on_delete = models.CASCADE,
related_name="profile")location = models.ManyToManyField(Location)*


Thank you

Regards,
Soumen

On Wed, May 27, 2020 at 7:20 PM Chetan Ganji  wrote:

> select_related for fk and prefetch_related for m2m in django, you can
> chain them together
>
> Regards,
> Chetan Ganji
> +91-900-483-4183
> ganji.che...@gmail.com
> http://ryucoder.in
>
>
> On Wed, May 27, 2020 at 4:51 PM Soumen Khatua 
> wrote:
>
>> Hi Folks,
>> I have many to many relationships and Foreign Key in the table, I'm using
>> select_realted(foreign key filed name) to optimize the query but I want to
>> fetch many to many and foreign key at the same time , How I can do this in
>> very optimized way?
>>
>> 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/CAPUw6Wb6f-BCwUZfvgzGtsrbV1seq1iGbXyuqoH%3DKxZrJ2EyLg%40mail.gmail.com
>> <https://groups.google.com/d/msgid/django-users/CAPUw6Wb6f-BCwUZfvgzGtsrbV1seq1iGbXyuqoH%3DKxZrJ2EyLg%40mail.gmail.com?utm_medium=email&utm_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/CAMKMUju19j7apa1pXZQcZTY-6ThTJC%3DAL2eQhtO7DL2oTk6Oog%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAMKMUju19j7apa1pXZQcZTY-6ThTJC%3DAL2eQhtO7DL2oTk6Oog%40mail.gmail.com?utm_medium=email&utm_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/CAPUw6WZXtTJssu6SwO8_BiTDxDnzJtKYy9j1hQsMR74jKYC6aA%40mail.gmail.com.


Re: Optmized Query

2020-05-27 Thread Soumen Khatua
Now I'm facing one problem whenever I'm trying to iterate a loop I'm
getting too many SQL variables. Actually after iterating the loop I want to
render all the value in the template.
if could you resolve this it would be very good for me.
Thank you for your time and response

Regards,
Soumen


On Thu, May 28, 2020 at 2:12 AM Chetan Ganji  wrote:

>
> Profile.objects.filter().select_related("user").prefetch_related("location")
>
> On Thu, May 28, 2020, 2:01 AM Soumen Khatua 
> wrote:
>
>> I also know about this concept but I don't how I can achieve it, Could
>> you give me an example?
>> Suppose I have:
>>
>>
>>
>>
>>
>>
>>
>> *class Profile(models.Model):user = models.OneToOneField(
>> settings.AUTH_USER_MODEL,on_delete = models.CASCADE,
>> related_name="profile")location = models.ManyToManyField(Location)*
>>
>>
>> Thank you
>>
>> Regards,
>> Soumen
>>
>> On Wed, May 27, 2020 at 7:20 PM Chetan Ganji 
>> wrote:
>>
>>> select_related for fk and prefetch_related for m2m in django, you can
>>> chain them together
>>>
>>> Regards,
>>> Chetan Ganji
>>> +91-900-483-4183
>>> ganji.che...@gmail.com
>>> http://ryucoder.in
>>>
>>>
>>> On Wed, May 27, 2020 at 4:51 PM Soumen Khatua 
>>> wrote:
>>>
>>>> Hi Folks,
>>>> I have many to many relationships and Foreign Key in the table, I'm
>>>> using select_realted(foreign key filed name) to optimize the query but I
>>>> want to fetch many to many and foreign key at the same time , How I can do
>>>> this in very optimized way?
>>>>
>>>> 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/CAPUw6Wb6f-BCwUZfvgzGtsrbV1seq1iGbXyuqoH%3DKxZrJ2EyLg%40mail.gmail.com
>>>> <https://groups.google.com/d/msgid/django-users/CAPUw6Wb6f-BCwUZfvgzGtsrbV1seq1iGbXyuqoH%3DKxZrJ2EyLg%40mail.gmail.com?utm_medium=email&utm_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/CAMKMUju19j7apa1pXZQcZTY-6ThTJC%3DAL2eQhtO7DL2oTk6Oog%40mail.gmail.com
>>> <https://groups.google.com/d/msgid/django-users/CAMKMUju19j7apa1pXZQcZTY-6ThTJC%3DAL2eQhtO7DL2oTk6Oog%40mail.gmail.com?utm_medium=email&utm_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/CAPUw6WZXtTJssu6SwO8_BiTDxDnzJtKYy9j1hQsMR74jKYC6aA%40mail.gmail.com
>> <https://groups.google.com/d/msgid/django-users/CAPUw6WZXtTJssu6SwO8_BiTDxDnzJtKYy9j1hQsMR74jKYC6aA%40mail.gmail.com?utm_medium=email&utm_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/CAMKMUjth%3DNm%2BUa74bz1PiRYFGhKU-PER9_Y_XQdHRQ23KMbp7Q%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAMKMUjth%3DNm%2BUa74bz1PiRYFGhKU-PER9_Y_XQdHRQ23KMbp7Q%40mail.gmail.com?utm_medium=email&utm_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/CAPUw6WZAY41ksoCccKGuM%2BRSYtyMBiQeYaZAZGz4v-T2_t_Jow%40mail.gmail.com.


Re: Optimized Query

2020-05-27 Thread Soumen Khatua
Actually I want to fetch all users from User table and users location from
Location table which is many to many relation from same Profile table. Is
it possible???

On Thu 28 May, 2020, 2:54 AM Soumen Khatua, 
wrote:

> Now I'm facing one problem whenever I'm trying to iterate a loop I'm
> getting too many SQL variables. Actually after iterating the loop I want to
> render all the value in the template.
> if could you resolve this it would be very good for me.
> Thank you for your time and response
>
> Regards,
> Soumen
>
>
> On Thu, May 28, 2020 at 2:12 AM Chetan Ganji 
> wrote:
>
>>
>> Profile.objects.filter().select_related("user").prefetch_related("location")
>>
>> On Thu, May 28, 2020, 2:01 AM Soumen Khatua 
>> wrote:
>>
>>> I also know about this concept but I don't how I can achieve it, Could
>>> you give me an example?
>>> Suppose I have:
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> *class Profile(models.Model):user = models.OneToOneField(
>>> settings.AUTH_USER_MODEL,on_delete = models.CASCADE,
>>> related_name="profile")location = models.ManyToManyField(Location)*
>>>
>>>
>>> Thank you
>>>
>>> Regards,
>>> Soumen
>>>
>>> On Wed, May 27, 2020 at 7:20 PM Chetan Ganji 
>>> wrote:
>>>
>>>> select_related for fk and prefetch_related for m2m in django, you can
>>>> chain them together
>>>>
>>>> Regards,
>>>> Chetan Ganji
>>>> +91-900-483-4183
>>>> ganji.che...@gmail.com
>>>> http://ryucoder.in
>>>>
>>>>
>>>> On Wed, May 27, 2020 at 4:51 PM Soumen Khatua <
>>>> soumenkhatua...@gmail.com> wrote:
>>>>
>>>>> Hi Folks,
>>>>> I have many to many relationships and Foreign Key in the table, I'm
>>>>> using select_realted(foreign key filed name) to optimize the query but I
>>>>> want to fetch many to many and foreign key at the same time , How I can do
>>>>> this in very optimized way?
>>>>>
>>>>> 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/CAPUw6Wb6f-BCwUZfvgzGtsrbV1seq1iGbXyuqoH%3DKxZrJ2EyLg%40mail.gmail.com
>>>>> <https://groups.google.com/d/msgid/django-users/CAPUw6Wb6f-BCwUZfvgzGtsrbV1seq1iGbXyuqoH%3DKxZrJ2EyLg%40mail.gmail.com?utm_medium=email&utm_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/CAMKMUju19j7apa1pXZQcZTY-6ThTJC%3DAL2eQhtO7DL2oTk6Oog%40mail.gmail.com
>>>> <https://groups.google.com/d/msgid/django-users/CAMKMUju19j7apa1pXZQcZTY-6ThTJC%3DAL2eQhtO7DL2oTk6Oog%40mail.gmail.com?utm_medium=email&utm_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/CAPUw6WZXtTJssu6SwO8_BiTDxDnzJtKYy9j1hQsMR74jKYC6aA%40mail.gmail.com
>>> <https://groups.google.com/d/msgid/django-users/CAPUw6WZXtTJssu6SwO8_BiTDxDnzJtKYy9j1hQsMR74jKYC6aA%40mail.gmail.com?utm_medium=email&utm_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/CAMKMUjth%3DNm%2BUa74bz1PiRYFGhKU-PER9_Y_XQdHRQ23KMbp7Q%40mail.gmail.com
>> <https://groups.google.com/d/msgid/django-users/CAMKMUjth%3DNm%2BUa74bz1PiRYFGhKU-PER9_Y_XQdHRQ23KMbp7Q%40mail.gmail.com?utm_medium=email&utm_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/CAPUw6WY0T5U10NpzTXcsmdsvx641cdDiYJaU%2B3DEjzmb3iPDEA%40mail.gmail.com.


filter on multiple tables

2020-05-28 Thread Soumen Khatua
Actually I want to filter all users those are matched with currently logged
in users based on location or education details like maybe institute_name
or specialization. Is it possible to search in multiple tables?!
I almost spent 2 days but still I stuck in the position.
Any help would be appreciated.

Thank You

Regards,
Soumen




*class Location(models.Model):name = models.CharField(max_length = 15)*







*class Profile(models.Model):user = models.OneToOneField(
settings.AUTH_USER_MODEL,on_delete = models.CASCADE,
related_name="profile")location =
models.ManyToManyField(Location,related_name = 'user_locations')*




*class Education(models.Model):profile = models.ForeignKey(Profile,
on_delete=models.CASCADE,related_name="profiles")institute_name =
models.CharField(max_length = 250)specialization =
models.CharField(max_length = 100)*

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


Re: filter on multiple tables

2020-05-29 Thread Soumen Khatua
Hi,

whenever I'm trying to filter as per your convention I'm getting some error
like FieldError:
*Eg.* *profile =
Profile.objects.filter(education__profile__institute_name="IIT KGP")*

of course, I'm getting this error because Profile is working here as a
Foreign Key, in Education table.

actually I want to fetch all the users those are from the same Institution
or Specialization or location.


Thank you for your response and time.

Regards,
Soumen


‪On Fri, May 29, 2020 at 9:56 AM ‫אורי‬‎  wrote:‬

> Hi Soumen,
>
> You can filter on another table by using __, for
> example:
>
> User.objects.filter(profile__profiles__institute_name="Example")
>
> Or:
>
> User.objects.filter(profile__profiles__institute_name__in=["Example 1",
> "Example 2"])
> אורי
> u...@speedy.net
>
>
> On Thu, May 28, 2020 at 11:27 PM Soumen Khatua 
> wrote:
>
>> Actually I want to filter all users those are matched with currently
>> logged in users based on location or education details like maybe
>> institute_name or specialization. Is it possible to search in multiple
>> tables?!
>> I almost spent 2 days but still I stuck in the position.
>> Any help would be appreciated.
>>
>> Thank You
>>
>> Regards,
>> Soumen
>>
>>
>>
>>
>> *class Location(models.Model):name = models.CharField(max_length =
>> 15)*
>>
>>
>>
>>
>>
>>
>>
>> *class Profile(models.Model):user = models.OneToOneField(
>> settings.AUTH_USER_MODEL,on_delete = models.CASCADE,
>> related_name="profile")location =
>> models.ManyToManyField(Location,related_name = 'user_locations')*
>>
>>
>>
>>
>> *class Education(models.Model):profile = models.ForeignKey(Profile,
>> on_delete=models.CASCADE,related_name="profiles")institute_name =
>> models.CharField(max_length = 250)specialization =
>> models.CharField(max_length = 100)*
>>
>> --
>> 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/CAPUw6WZqX9oqutYfGJqAwCswY_00VfTmf624ypypAr6saS61Nw%40mail.gmail.com
>> <https://groups.google.com/d/msgid/django-users/CAPUw6WZqX9oqutYfGJqAwCswY_00VfTmf624ypypAr6saS61Nw%40mail.gmail.com?utm_medium=email&utm_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/CABD5YeFfHWDEkTFwMFocApuG3ejYY5QjqHHd_86wNNc-JoWP4g%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CABD5YeFfHWDEkTFwMFocApuG3ejYY5QjqHHd_86wNNc-JoWP4g%40mail.gmail.com?utm_medium=email&utm_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/CAPUw6WazA6k1MHjUWiMWvEPU9HnitRK7bBzq-aQVOrP9w84o-Q%40mail.gmail.com.


Re: Optimized Query

2020-05-29 Thread Soumen Khatua
Hi,

Yeah, but whenever I'm trying to iterate a loop on all these qs. I'm
getting an *error too many sql variables.* I know I'm doing something
wrong,but I'm not able to find the error.


Thank you for your response and time.

Regards,
Soumen

‪On Fri, May 29, 2020 at 5:49 PM ‫אורי‬‎  wrote:‬

> They both work for both.
> אורי
> u...@speedy.net
>
>
> On Fri, May 29, 2020 at 12:47 PM Sencer Hamarat 
> wrote:
>
>> I thought select_related works for only FK/M2M and prefetch_related works
>> for only reverse relations, doesn't it?
>>
>> Saygılarımla,
>> Sencer HAMARAT
>>
>>
>>
>> ‪On Fri, May 29, 2020 at 7:32 AM ‫אורי‬‎  wrote:‬
>>
>>> Hi Soumen,
>>>
>>> Sometimes prefetch_related is much faster and more efficient than
>>> select_related. I usually prefer to use prefetch_related.
>>>
>>> Uri.
>>> אורי
>>> u...@speedy.net
>>>
>>>
>>> On Thu, May 28, 2020 at 12:42 AM Soumen Khatua <
>>> soumenkhatua...@gmail.com> wrote:
>>>
>>>> Actually I want to fetch all users from User table and users location
>>>> from Location table which is many to many relation from same Profile table.
>>>> Is it possible???
>>>>
>>>> On Thu 28 May, 2020, 2:54 AM Soumen Khatua, 
>>>> wrote:
>>>>
>>>>> Now I'm facing one problem whenever I'm trying to iterate a loop I'm
>>>>> getting too many SQL variables. Actually after iterating the loop I want 
>>>>> to
>>>>> render all the value in the template.
>>>>> if could you resolve this it would be very good for me.
>>>>> Thank you for your time and response
>>>>>
>>>>> Regards,
>>>>> Soumen
>>>>>
>>>>>
>>>>> On Thu, May 28, 2020 at 2:12 AM Chetan Ganji 
>>>>> wrote:
>>>>>
>>>>>>
>>>>>> Profile.objects.filter().select_related("user").prefetch_related("location")
>>>>>>
>>>>>> On Thu, May 28, 2020, 2:01 AM Soumen Khatua <
>>>>>> soumenkhatua...@gmail.com> wrote:
>>>>>>
>>>>>>> I also know about this concept but I don't how I can achieve it,
>>>>>>> Could you give me an example?
>>>>>>> Suppose I have:
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> *class Profile(models.Model):user = models.OneToOneField(
>>>>>>> settings.AUTH_USER_MODEL,on_delete = models.CASCADE,
>>>>>>> related_name="profile")location = 
>>>>>>> models.ManyToManyField(Location)*
>>>>>>>
>>>>>>>
>>>>>>> Thank you
>>>>>>>
>>>>>>> Regards,
>>>>>>> Soumen
>>>>>>>
>>>>>>> On Wed, May 27, 2020 at 7:20 PM Chetan Ganji 
>>>>>>> wrote:
>>>>>>>
>>>>>>>> select_related for fk and prefetch_related for m2m in django, you
>>>>>>>> can chain them together
>>>>>>>>
>>>>>>>> Regards,
>>>>>>>> Chetan Ganji
>>>>>>>> +91-900-483-4183
>>>>>>>> ganji.che...@gmail.com
>>>>>>>> http://ryucoder.in
>>>>>>>>
>>>>>>>>
>>>>>>>> On Wed, May 27, 2020 at 4:51 PM Soumen Khatua <
>>>>>>>> soumenkhatua...@gmail.com> wrote:
>>>>>>>>
>>>>>>>>> Hi Folks,
>>>>>>>>> I have many to many relationships and Foreign Key in the table,
>>>>>>>>> I'm using select_realted(foreign key filed name) to optimize the 
>>>>>>>>> query but
>>>>>>>>> I want to fetch many to many and foreign key at the same time , How I 
>>>>>>>>> can
>>>>>>>>> do this in very optimized way?
>>>>>>>>>
>>>>>>>>> Thank You
>>>>>>>>> Regards,
>>>>>>>>> Soumen
>>>&

Re: filter on multiple tables

2020-05-29 Thread Soumen Khatua
Thank You, for your guidance.I think I'm very close to this problem.

Thank you once again.

‪On Fri, May 29, 2020 at 9:56 AM ‫אורי‬‎  wrote:‬

> Hi Soumen,
>
> You can filter on another table by using __, for
> example:
>
> User.objects.filter(profile__profiles__institute_name="Example")
>
> Or:
>
> User.objects.filter(profile__profiles__institute_name__in=["Example 1",
> "Example 2"])
> אורי
> u...@speedy.net
>
>
> On Thu, May 28, 2020 at 11:27 PM Soumen Khatua 
> wrote:
>
>> Actually I want to filter all users those are matched with currently
>> logged in users based on location or education details like maybe
>> institute_name or specialization. Is it possible to search in multiple
>> tables?!
>> I almost spent 2 days but still I stuck in the position.
>> Any help would be appreciated.
>>
>> Thank You
>>
>> Regards,
>> Soumen
>>
>>
>>
>>
>> *class Location(models.Model):name = models.CharField(max_length =
>> 15)*
>>
>>
>>
>>
>>
>>
>>
>> *class Profile(models.Model):user = models.OneToOneField(
>> settings.AUTH_USER_MODEL,on_delete = models.CASCADE,
>> related_name="profile")location =
>> models.ManyToManyField(Location,related_name = 'user_locations')*
>>
>>
>>
>>
>> *class Education(models.Model):profile = models.ForeignKey(Profile,
>> on_delete=models.CASCADE,related_name="profiles")institute_name =
>> models.CharField(max_length = 250)specialization =
>> models.CharField(max_length = 100)*
>>
>> --
>> 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/CAPUw6WZqX9oqutYfGJqAwCswY_00VfTmf624ypypAr6saS61Nw%40mail.gmail.com
>> <https://groups.google.com/d/msgid/django-users/CAPUw6WZqX9oqutYfGJqAwCswY_00VfTmf624ypypAr6saS61Nw%40mail.gmail.com?utm_medium=email&utm_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/CABD5YeFfHWDEkTFwMFocApuG3ejYY5QjqHHd_86wNNc-JoWP4g%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CABD5YeFfHWDEkTFwMFocApuG3ejYY5QjqHHd_86wNNc-JoWP4g%40mail.gmail.com?utm_medium=email&utm_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/CAPUw6WZGO9bXukP9VX_k%3DOW0U1Vbz_885cH5i%2BhH8n-nFXz%2BQw%40mail.gmail.com.


User table inside custom table

2020-06-06 Thread Soumen Khatua
Hi Folks,

Actually my problem is very simple, here I'm calling to those users I'm
following but whenever I'm sending the data inside the serializers.I'm not
getting any value. I don't know what is happening here?!


*models.py---*






*class Follow(models.Model):follower = models.ForeignKey(User,on_delete
= models.CASCADE,related_name = 'following')followee =
models.ForeignKey(User,on_delete = models.CASCADE,related_name =
'followers') created_at = models.DateTimeField(auto_now_add = True,
null = True)updated_at = models.DateTimeField(auto_now = True, null =
True)class Meta:   unique_together = ("follower", "followee")*










*views.py--class FolloweeAPIViewList(APIView,
PaginationHandlerMixin):def get(self,request,*args,**kwargs):followee_qs =
Follow.objects.filter(follower = request.user).select_related('followee')
  serializer = UserFollowSerializer(followee_qs,many = True)return
Response(serializer.data,status=status.HTTP_200_OK)serializers.py--*











*class UserDetailSerializer(serializers.ModelSerializer):class Meta:
model = Userfields =
('full_name','email','phone_number','bio')class
UserFollowSerializer(serializers.ModelSerializer): user =
UserDetailSerializer(read_only=True) class Meta:  model =
Follow  fields = ('user','created_at')*


any help will be appreciated.


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/CAPUw6WZY%3DCfQaRfnULzUBJuEm2beb5oaX-cbVFk_NEfNkrBraw%40mail.gmail.com.


Bridge between two users

2020-06-09 Thread Soumen Khatua
Hi Folks,

I have one Follower system and here I want to check  those are following to
me,   we have a mutual connection or not. If they are following to me and
I'm not following to them, I want to set in frontend follow back. Inside
the views I'm fetching the data and sending them to serializer but I don't
,How I can check it?
My models and views are in below:

models.py
-







*class Follow(models.Model):follower = models.ForeignKey(User,on_delete
= models.CASCADE,related_name = 'following')followee =
models.ForeignKey(User,on_delete = models.CASCADE,related_name =
'followers')created_at = models.DateTimeField(auto_now_add = True, null
= True)updated_at = models.DateTimeField(auto_now = True, null = True)
  class Meta:   unique_together = ("follower", "followee")
 ordering  = ('-created_at',)*

views.py:
---










*class FollowerAPIView(APIView,PaginationHandlerMixin):pagination_class
= BasicPaginationserializer_class = UserFollowerSerializerdef
get(self,request,*args,**kwargs):follower_qs =
Follow.objects.filter(followee = request.user).select_related('follower')
  page = self.paginate_queryset(follower_qs)if page is not
None:serializer =
self.get_paginated_response(self.serializer_class(page, many=True).data)
else:serializer = self.serializer_class(follower_qs,
many=True)return
Response(serializer.data,status=status.HTTP_200_OK)*

Please help me

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


Capture Content Id

2020-06-15 Thread Soumen Khatua
Hi Folks,

I have one Blog post project here user can see the blog and by clicking on
the blog title they can see the details of the blog, so here Slug will be
working here as a URL,but in the details view, How I can fetch that
particular content details without having the ID because slug/title is the
parameter of the view and it can be duplicated.
 Any help will be appreciated

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


Re: Capture Content Id

2020-06-15 Thread Soumen Khatua
Could you give me an example??

On Mon, Jun 15, 2020 at 1:21 PM Kayode Oladipo 
wrote:

> There's an id field built into every Django model (aka, the primary key
> (pk))
>
> Just do, ModelInstance.id and that should do the trick.
>
> Cheers.
>
> On Mon, Jun 15, 2020, 8:03 AM Soumen Khatua 
> wrote:
>
>> Hi Folks,
>>
>> I have one Blog post project here user can see the blog and by clicking
>> on the blog title they can see the details of the blog, so here Slug will
>> be working here as a URL,but in the details view, How I can fetch that
>> particular content details without having the ID because slug/title is the
>> parameter of the view and it can be duplicated.
>>  Any help will be appreciated
>>
>> 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/CAPUw6WYCuO9AMa7j4WxaCCZqdgE26YoUTksQptBSYtQ64K8O4g%40mail.gmail.com
>> <https://groups.google.com/d/msgid/django-users/CAPUw6WYCuO9AMa7j4WxaCCZqdgE26YoUTksQptBSYtQ64K8O4g%40mail.gmail.com?utm_medium=email&utm_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/CA%2BARzD-870cXr41yUpGQheNUUDHZxW1GVoR5QJR%3DiV259A4K3w%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CA%2BARzD-870cXr41yUpGQheNUUDHZxW1GVoR5QJR%3DiV259A4K3w%40mail.gmail.com?utm_medium=email&utm_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/CAPUw6WaFgP99TAJ%3D0-SSHcwdbfCJYn3x0EKk_b-cvyRRiBhDFQ%40mail.gmail.com.


Re: Capture Content Id

2020-06-15 Thread Soumen Khatua
Yeah but in this way the time complexity will be very high, just think if
I'll have more than 1 million post than it will check all the field if it
is available or not.
However my query is different I want to fetch the data based on ID only but
I want to make url as slug  name, so it means the function will take slug
as a parameter not ID.

On Tue 16 Jun, 2020, 1:24 AM Kelvin Sajere,  wrote:

> I forgot that you need to import this
>
> from django.utils.text import slugify
>
> On Mon, Jun 15, 2020 at 6:35 PM Kelvin Sajere 
> wrote:
>
>> I think I kinda understand what you want to achieve here. You want to use
>> a slug field, but you are wondering what happens when two posts have the
>> same slug name. Here is what I do. On your model.
>>
>> class Post(models.Model):
>> title = models.CharField(max_length=50)
>> slug = models.CharField(max_length=50)
>>
>> def _get_unique_slug(self):
>> slug = slugify(self.name)
>> unique_slug = slug
>> num = 1
>> while Category.objects.filter(slug=unique_slug).exists():
>> unique_slug = '{}-{}'.format(slug, num)
>> num += 1
>> return unique_slug
>>
>> def save(self, *args, **kwargs):
>> if not self.slug:
>> self.slug = self._get_unique_slug()
>> super().save(*args, **kwargs)
>>
>> This way, no two posts can have the same slug field.
>>
>>
>> On Mon, Jun 15, 2020 at 08:03 Soumen Khatua 
>> wrote:
>>
>>> Hi Folks,
>>>
>>> I have one Blog post project here user can see the blog and by clicking
>>> on the blog title they can see the details of the blog, so here Slug will
>>> be working here as a URL,but in the details view, How I can fetch that
>>> particular content details without having the ID because slug/title is the
>>> parameter of the view and it can be duplicated.
>>>  Any help will be appreciated
>>>
>>> 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/CAPUw6WYCuO9AMa7j4WxaCCZqdgE26YoUTksQptBSYtQ64K8O4g%40mail.gmail.com
>>> <https://groups.google.com/d/msgid/django-users/CAPUw6WYCuO9AMa7j4WxaCCZqdgE26YoUTksQptBSYtQ64K8O4g%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>>
>>
>>
>
> --
> KeLLs
>
> --
> 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/CADYqDX0QVJtizHHDN0FTfr1t7nf%2B32-5VgDk%3DJe9h9rQarUSQw%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CADYqDX0QVJtizHHDN0FTfr1t7nf%2B32-5VgDk%3DJe9h9rQarUSQw%40mail.gmail.com?utm_medium=email&utm_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/CAPUw6WZG3ZdSiB3xL6soM7MTL13U75ffgRNzOpLBDOu0BPfmYw%40mail.gmail.com.


Re: Capture Content Id

2020-06-15 Thread Soumen Khatua
Thank you for your response.

On Tue 16 Jun, 2020, 6:29 AM Soumen Khatua, 
wrote:

> Yeah but in this way the time complexity will be very high, just think if
> I'll have more than 1 million post than it will check all the field if it
> is available or not.
> However my query is different I want to fetch the data based on ID only
> but I want to make url as slug  name, so it means the function will take
> slug as a parameter not ID.
>
> On Tue 16 Jun, 2020, 1:24 AM Kelvin Sajere,  wrote:
>
>> I forgot that you need to import this
>>
>> from django.utils.text import slugify
>>
>> On Mon, Jun 15, 2020 at 6:35 PM Kelvin Sajere 
>> wrote:
>>
>>> I think I kinda understand what you want to achieve here. You want to
>>> use a slug field, but you are wondering what happens when two posts have
>>> the same slug name. Here is what I do. On your model.
>>>
>>> class Post(models.Model):
>>> title = models.CharField(max_length=50)
>>> slug = models.CharField(max_length=50)
>>>
>>> def _get_unique_slug(self):
>>> slug = slugify(self.name)
>>> unique_slug = slug
>>> num = 1
>>> while Category.objects.filter(slug=unique_slug).exists():
>>> unique_slug = '{}-{}'.format(slug, num)
>>> num += 1
>>> return unique_slug
>>>
>>> def save(self, *args, **kwargs):
>>> if not self.slug:
>>> self.slug = self._get_unique_slug()
>>> super().save(*args, **kwargs)
>>>
>>> This way, no two posts can have the same slug field.
>>>
>>>
>>> On Mon, Jun 15, 2020 at 08:03 Soumen Khatua 
>>> wrote:
>>>
>>>> Hi Folks,
>>>>
>>>> I have one Blog post project here user can see the blog and by clicking
>>>> on the blog title they can see the details of the blog, so here Slug will
>>>> be working here as a URL,but in the details view, How I can fetch that
>>>> particular content details without having the ID because slug/title is the
>>>> parameter of the view and it can be duplicated.
>>>>  Any help will be appreciated
>>>>
>>>> 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/CAPUw6WYCuO9AMa7j4WxaCCZqdgE26YoUTksQptBSYtQ64K8O4g%40mail.gmail.com
>>>> <https://groups.google.com/d/msgid/django-users/CAPUw6WYCuO9AMa7j4WxaCCZqdgE26YoUTksQptBSYtQ64K8O4g%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>>> .
>>>>
>>>
>>>
>>>
>>
>> --
>> KeLLs
>>
>> --
>> 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/CADYqDX0QVJtizHHDN0FTfr1t7nf%2B32-5VgDk%3DJe9h9rQarUSQw%40mail.gmail.com
>> <https://groups.google.com/d/msgid/django-users/CADYqDX0QVJtizHHDN0FTfr1t7nf%2B32-5VgDk%3DJe9h9rQarUSQw%40mail.gmail.com?utm_medium=email&utm_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/CAPUw6Wa6Wqk8DSgObib8fk9vnFfJrV88pDbN8hEHvoWi9ZhEMA%40mail.gmail.com.


Custom Primary Key

2020-06-23 Thread Soumen Khatua
Hi Folks,

In Django is there any way to create custom Primark Key like:
M01234GH, M056YUOIP, etc.

Please help me guys.

Thank you in advance

Regards,
Soumen Khatua

-- 
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/CAPUw6WbZ_nrXgk%3DufWfq39%2BZJmN-nmF0DzeuFK9tqgFW-Os3vQ%40mail.gmail.com.


Re: Custom Primary Key

2020-06-23 Thread Soumen Khatua
In the documentation they are specified, How to set Primary Key in Django
model but In my case, I want to generate custom Primary Key?!

On Wed, Jun 24, 2020 at 1:36 AM David Chorpash 
wrote:

> Hi Soumen,
>
> Are you looking for this?
> https://docs.djangoproject.com/en/3.0/ref/models/fields/#primary-key
>
> You should be able to create a field in your model and set the primary_key
> to True
>
>
> On Tue, Jun 23, 2020 at 1:18 PM Soumen Khatua 
> wrote:
>
>> Hi Folks,
>>
>> In Django is there any way to create custom Primark Key like:
>> M01234GH, M056YUOIP, etc.
>>
>> Please help me guys.
>>
>> Thank you in advance
>>
>> Regards,
>> Soumen Khatua
>>
>> --
>> 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/CAPUw6WbZ_nrXgk%3DufWfq39%2BZJmN-nmF0DzeuFK9tqgFW-Os3vQ%40mail.gmail.com
>> <https://groups.google.com/d/msgid/django-users/CAPUw6WbZ_nrXgk%3DufWfq39%2BZJmN-nmF0DzeuFK9tqgFW-Os3vQ%40mail.gmail.com?utm_medium=email&utm_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/CAL_O_N%2Bg167k9EsJ0z5Gc_EYfWJSWrJrdECY5zwfAfc1Rn_M1g%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAL_O_N%2Bg167k9EsJ0z5Gc_EYfWJSWrJrdECY5zwfAfc1Rn_M1g%40mail.gmail.com?utm_medium=email&utm_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/CAPUw6WaryW%3DkdyRxSdTGa73ggd6r43FU4gH0vD8TfCwtZXxk7A%40mail.gmail.com.


Re: Custom Primary Key

2020-06-23 Thread Soumen Khatua
Yes, at the time of add a new record in model, automatically I want to
create a custom ID and insert it into model

On Wed 24 Jun, 2020, 7:18 AM Clive Bruton,  wrote:

>
> On 23 Jun 2020, at 23:32, Oleg Kishenkov wrote:
>
> > Hello Soumen, you should use a CharField with the primary_key=True
> > attribute for your model. This way no no automatic primary key
> > field is generated, your field will be implicitly unique and non-
> > null though. Only one primary key is allowed in a model.
> >
> > class Foo(models.Model)
> > id = models.CharField(max_length=15, primary_key=True)
>
> Just to clarify this, are you indicating that when you create the
> record you generate a unique custom key yourself and insert this?
>
>
> -- Clive
>
> --
> 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/E9317D0D-0A25-48CE-9396-5FB181075045%40indx.co.uk
> .
>

-- 
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/CAPUw6Wb2dEug6QeRrO5hdxTJV-4v4OzkrDajqTV7UNm8q9vGFg%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.


Dynamic Set

2020-08-16 Thread Soumen Khatua
Hi Folks,

In my database under Quiz-A: a user can update 5 MCQ questions and another
user can update 6 questions, so basically it is dynamic. So how can I show
this question in a template and then How can I validate the right answer
using Django,can anyone tell me,please?

Actually I spent multiple hours on this problem.but still I don't have any
clue what is the way to solve it.

Thank you

Regards,
Soumen Khatua

-- 
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/CAPUw6WafxA6_KF8AvDrTgDmcvtg_sisONLeDUo%3D2W4w7W%3DxVfQ%40mail.gmail.com.


wrong time in query

2020-08-30 Thread Soumen Khatua
Hi Folks,
In my model one *column *is their called *start *which is *datetime field*
and start is storing *datetime *by using *django specific datetime field*
like:  *Aug. 30, 2020, 7:44 p.m. *
But after ran one *get *query when I tried to access the date and time,I'm
getting wrong time like: *2020-08-30 14:14:00+00:00*

Can anyone tell me why I'm getting wrong time,although I selected *TIME_ZONE
= 'Asia/Kolkata'*

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/CAPUw6Wa3%3DzBdAud32AiC78ng9SVgTJcneXwtB0hLVD9YwFJ2AQ%40mail.gmail.com.


Re: wrong time in query

2020-08-30 Thread Soumen Khatua
no,directly I'm using *TIME_ZONE = 'Asia/Kolkata',*

On Sun, Aug 30, 2020 at 11:37 PM Kunal Solanke 
wrote:

> Are you using timezone for saving time
> which is exported from django.utils or the python datetime module?
>
> On Sun, Aug 30, 2020, 23:34 Soumen Khatua 
> wrote:
>
>> Hi Folks,
>> In my model one *column *is their called *start *which is *datetime
>> field* and start is storing *datetime *by using *django specific
>> datetime field* like:  *Aug. 30, 2020, 7:44 p.m. *
>> But after ran one *get *query when I tried to access the date and
>> time,I'm getting wrong time like: *2020-08-30 14:14:00+00:00*
>>
>> Can anyone tell me why I'm getting wrong time,although I selected *TIME_ZONE
>> = 'Asia/Kolkata'*
>>
>> 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/CAPUw6Wa3%3DzBdAud32AiC78ng9SVgTJcneXwtB0hLVD9YwFJ2AQ%40mail.gmail.com
>> <https://groups.google.com/d/msgid/django-users/CAPUw6Wa3%3DzBdAud32AiC78ng9SVgTJcneXwtB0hLVD9YwFJ2AQ%40mail.gmail.com?utm_medium=email&utm_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/CAOecAnyNk_CMX%2BQLbVs6H%2B9Wj2XHNTzZEGWRYybXJAJ5QUBKJQ%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAOecAnyNk_CMX%2BQLbVs6H%2B9Wj2XHNTzZEGWRYybXJAJ5QUBKJQ%40mail.gmail.com?utm_medium=email&utm_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/CAPUw6WaAopJUJcbVNLK-etagH4BkujuGQvfj%2BYJq-tMsddHL%2BQ%40mail.gmail.com.


muliple queryset result

2021-01-09 Thread Soumen Khatua
Hi Folks,

Actually I have one *Primary *Table called *CustomUser *and I'm extending
this model as *Foreign *Key in *UserContactDetails model*. So now
basically *one
user have multiple contact details.* But whenever I'm applying *filter
*on *Primary
Table field* as well as *Foreign Key table* field, this queryset is
returnning  multiple Object inside queryset, like If my *ContactDetails *have
3 numbers of record for a user then it's returning the same record 3 number
of times inside queryset, can you guys tell me, How can I solve this
problem? I almost spend three hours on it, please help me.

*models.py*
**




















*class CustomUser(AbstractBaseUser, PermissionsMixin):email =
models.EmailField(_('email address'), unique=True)company_name =
models.CharField(max_length = 150)sap_code =
models.CharField(max_length = 150)is_staff =
models.BooleanField(default=False)is_active =
models.BooleanField(default=True)date_joined =
models.DateTimeField(default=timezone.now)USERNAME_FIELD = 'email'
REQUIRED_FIELDS = []objects = CustomUserManager()class
UserContactDetails(models.Model): user_details =
models.ForeignKey(CustomUser, related_name = 'usercontactdetailes',
related_query_name = 'usercontactdetaies', on_delete = models.CASCADE)
address = models.CharField(max_length = 150) mobile_no =
models.CharField(max_length = 150) primary_contact =
models.BooleanField(default = False)*


*views.py*
**

*query = request.GET.get('param')*





* user_data = CustomUser.objects.filter(
 Q(usercontactdetaies__address = query)|
 Q(usercontactdetaies__mobile_no = query)|   Q(company_name__exact =
query) |   Q(sap_code__exact = query)  )*

* >,
>, >]>*

*Instead of returnning one matched object inside queryset it's returnning
three matched object because I have three contact details for this user.*


*Thank you in advance*

*Regards,*
*Soumen Khatua*

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


Sign Up by using E-mail id

2019-07-24 Thread Soumen Khatua
Hi Folks,
I want to create one signup page where end-user can SignUp and LogIn by
using their e-mail id nit by Username. Please tell me how i can do
that,please provide me source code for that.

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/CAPUw6Wat%3DTGsY%3DF816XDS77YQkk29OLEQYUkjkmQN1hX6A%2B1iw%40mail.gmail.com.


Re:

2019-07-24 Thread Soumen Khatua
Thanks for your response.

Thank You

Regards,
Soumen

On Wed, Jul 24, 2019 at 7:13 PM Devender Kumar  wrote:

> Read django allauth lib.
>
> On Wed 24 Jul, 2019, 4:01 PM avi gehlot,  wrote:
>
>> You can contact me ..
>>
>> On Wed, 24 Jul 2019 at 3:57 PM, Soumen Khatua 
>> wrote:
>>
>>> Hi Folks,
>>> I want to create one signup page where end-user can SignUp and LogIn by
>>> using their e-mail id nit by Username. Please tell me how i can do
>>> that,please provide me source code for that.
>>>
>>> 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/CAPUw6Wat%3DTGsY%3DF816XDS77YQkk29OLEQYUkjkmQN1hX6A%2B1iw%40mail.gmail.com
>>> <https://groups.google.com/d/msgid/django-users/CAPUw6Wat%3DTGsY%3DF816XDS77YQkk29OLEQYUkjkmQN1hX6A%2B1iw%40mail.gmail.com?utm_medium=email&utm_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/CAOo90MDTC8aha3CNOk18UMoa8Zc8J5RURQk5ak7RJAkpFvn2bg%40mail.gmail.com
>> <https://groups.google.com/d/msgid/django-users/CAOo90MDTC8aha3CNOk18UMoa8Zc8J5RURQk5ak7RJAkpFvn2bg%40mail.gmail.com?utm_medium=email&utm_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/CALZ%3DbE%2BBXXV_KGTgzS96Y0GyAJURUVpw%2BuN9UWkz9uQhJ%3DVd1Q%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CALZ%3DbE%2BBXXV_KGTgzS96Y0GyAJURUVpw%2BuN9UWkz9uQhJ%3DVd1Q%40mail.gmail.com?utm_medium=email&utm_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/CAPUw6WY7e6JNW8TnFntE-f5me6WVjA2c_CqcoC-BJoEOUmCcmQ%40mail.gmail.com.


Model Related Issue

2019-07-27 Thread Soumen Khatua
Hi Folks,
I created one Address model and I extended Profile model by using
OnetoOneField of User and this Address model. But in get method  I want to
provide User model email,username and Address model state and Profile model
all details,How I can do that ny using Django Rest Framework.
Please help me guys,It's Urgent??


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


Djago Rest framework Error

2019-07-28 Thread Soumen Khatua
Hi Folks,

I'm getting this error when I declared like this:


def post(self, request):
serializer = ProfileSerializer(data=request.data)
username = request.user.username
user_details = User.objects.get(username = username)
if serializer.is_valid():
serializer_data = serializer.save(commit=False)
serializer_data.user = user_details
serializer_data.save()

 File
"/home/sou/halanx/env/lib/python3.6/site-packages/rest_framework/serializers.py",
line 188, in save
"'commit' is not a valid keyword argument to the 'save()' method. "
AssertionError: 'commit' is not a valid keyword argument to the 'save()'
method. If you need to access data before committing to the database then
inspect 'serializer.validated_data' instead. You can also pass additional
keyword arguments to 'save()' if you need to set extra attributes on the
saved model instance. For example: 'serializer.save(owner=request.user)'.'


please help me guys for this issue!!!

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


Re: Djago Rest framework Error

2019-07-28 Thread Soumen Khatua
How I can hold Profile details and them save it after provide the user
field details, Cn you tell me how i can do that?

Thank you

Regards,
Soumen

On Sun, Jul 28, 2019 at 2:22 PM Pradeep Sukhwani 
wrote:

> Hi Soumen,
>
> ModelSerializers do not behave in exactly the same way as ModelForm. However,
> there are intentional design decisions behind these differences. commit is
> not (and won't ever be) a keyword argument to save().
>
>
> I believe that the usage of .save() is pretty much adequately documented
> here
> <http://www.django-rest-framework.org/api-guide/serializers/#saving-instances>
> .
>
>
> On Sunday, July 28, 2019 at 2:14:31 PM UTC+5:30, Soumen Khatua wrote:
>>
>> Hi Folks,
>>
>> I'm getting this error when I declared like this:
>>
>>
>> def post(self, request):
>> serializer = ProfileSerializer(data=request.data)
>> username = request.user.username
>> user_details = User.objects.get(username = username)
>> if serializer.is_valid():
>> serializer_data = serializer.save(commit=False)
>> serializer_data.user = user_details
>> serializer_data.save()
>>
>>  File
>> "/home/sou/halanx/env/lib/python3.6/site-packages/rest_framework/serializers.py",
>> line 188, in save
>> "'commit' is not a valid keyword argument to the 'save()' method. "
>> AssertionError: 'commit' is not a valid keyword argument to the 'save()'
>> method. If you need to access data before committing to the database then
>> inspect 'serializer.validated_data' instead. You can also pass additional
>> keyword arguments to 'save()' if you need to set extra attributes on the
>> saved model instance. For example: 'serializer.save(owner=request.user)'.'
>>
>>
>> please help me guys for this issue!!!
>>
>> 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/38571245-f03d-454b-8d8b-5258af7ee8b3%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/38571245-f03d-454b-8d8b-5258af7ee8b3%40googlegroups.com?utm_medium=email&utm_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/CAPUw6Wbi9f_LVkuLAqY_ttBZCRnmN99Ui%2BCADdhsxWZwaxm1zw%40mail.gmail.com.


Re: Djago Rest framework Error

2019-07-28 Thread Soumen Khatua
Could you help me I have another requirement like I want to Show some
fields for get method and for post method I want to serialize some other
fields also. So how i can do that using same ProfileSerializers.

Plase help me.

Thank You

Regards,
Soumen

On Sun, Jul 28, 2019 at 2:59 PM Pradeep Sukhwani 
wrote:

> you need to pass the username in the serializer.
>
> Then in serializer, you can do something like this:
>
> serializers.py:
>
> class ProfileSerializer(serializers.ModelSerializer):
> user = UserCreateSerializer() # create the serializer for user
> # mention all the other fields in profile model
>
> class Meta:
> model = Profile
> fields = ('user',) # change this as per your requirement
>
>def validate(self, attrs):
> # validate the data if you have any conditions.
> return attrs
>
>
> def create(self, validated_data):
> # pop out the username from dict to create profile data and then
> save the user.
> user = validated_data.pop('username')
> profile_obj = Profile.objects.create(**validated_data)
> profile_obj.user = user
> profile_obj.save()
> return {"success": True} # You can return anything that you want
> so that you can send this in reponse from api.py.
>
> api.py
>
> def post(self, request):
>  request_data = request.data
>  request_data.update({user: request.user.username})
>  serializer = ProfileSerializer(data=request_data)
>  if serializer.is_valid():
>  return Response(serializer.validated_data)
>
>
>
>
> On Sunday, July 28, 2019 at 2:38:47 PM UTC+5:30, Soumen Khatua wrote:
>>
>> How I can hold Profile details and them save it after provide the user
>> field details, Cn you tell me how i can do that?
>>
>> Thank you
>>
>> Regards,
>> Soumen
>>
>> On Sun, Jul 28, 2019 at 2:22 PM Pradeep Sukhwani 
>> wrote:
>>
>>> Hi Soumen,
>>>
>>> ModelSerializers do not behave in exactly the same way as ModelForm. 
>>> However,
>>> there are intentional design decisions behind these differences. commit is
>>> not (and won't ever be) a keyword argument to save().
>>>
>>>
>>> I believe that the usage of .save() is pretty much adequately
>>> documented here
>>> <http://www.django-rest-framework.org/api-guide/serializers/#saving-instances>
>>> .
>>>
>>>
>>> On Sunday, July 28, 2019 at 2:14:31 PM UTC+5:30, Soumen Khatua wrote:
>>>>
>>>> Hi Folks,
>>>>
>>>> I'm getting this error when I declared like this:
>>>>
>>>>
>>>> def post(self, request):
>>>> serializer = ProfileSerializer(data=request.data)
>>>> username = request.user.username
>>>> user_details = User.objects.get(username = username)
>>>> if serializer.is_valid():
>>>> serializer_data = serializer.save(commit=False)
>>>> serializer_data.user = user_details
>>>> serializer_data.save()
>>>>
>>>>  File
>>>> "/home/sou/halanx/env/lib/python3.6/site-packages/rest_framework/serializers.py",
>>>> line 188, in save
>>>> "'commit' is not a valid keyword argument to the 'save()' method. "
>>>> AssertionError: 'commit' is not a valid keyword argument to the
>>>> 'save()' method. If you need to access data before committing to the
>>>> database then inspect 'serializer.validated_data' instead. You can also
>>>> pass additional keyword arguments to 'save()' if you need to set extra
>>>> attributes on the saved model instance. For example:
>>>> 'serializer.save(owner=request.user)'.'
>>>>
>>>>
>>>> please help me guys for this issue!!!
>>>>
>>>> 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...@googlegroups.com.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/38571245-f03d-454b-8d8b-5258af7ee8b3%40googlegroups.com
>>> <https://groups.google.com/d/msg

is_friend relation

2019-07-28 Thread Soumen Khatua
Hi Folks,

I want to do something like if I'm creating a resource it should show
is_friend  equaks to True for me but for others it should be False using
Django Rest Framework.Please help me,guys.


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/CAPUw6WY8%3Db29Gy462BQ_RFeV5Pn9ktStMSiB29AqwXarg-J2TA%40mail.gmail.com.


Re: is_friend relation

2019-07-28 Thread Soumen Khatua
Hi Pradeep,
Im trying to complete this task , can You help me do that. Actually I'm new
django Rest Framework

1. Model Specifications:
- a custom user model called 'Profile' which has following fields
(other than name, email, etc.)
- phone number (must be unique)
- gender (choices are: male, female, other)
- profile pic (an image upload field)
- date of birth (a date or datetime field)
- permanent address (must be a one-to-one field of Address 
model)
- company address (must be a one-to-one field of Address model)
- friends (must be a many-to-many field of Profile model)

- the 'Address' model must contain following fields:
- street address
- city
- state
- pincode
- country


2. Admin Customizations:
- In the Profile table:
- user's profile pic must be visible
- option to search users by name
- option to filter users on the basis of
- gender
- address city


3. APIs:
- Implement following authentication APIs (use Token as well as Basic
Authentication):
- Register new user with basic details like
- name (required)
- email (required)
- phone no. (required)
- password (required)
- gender (optional)
- date of birth (optional)
- Login
- Logout

- Profile APIs (all requests can be made only by authenticated users,
referred by 'me' below):
- Retreive my profile details
- Patch my profile details (any possible detail must be editable
using this API)
- List profiles of other users:
- profile detail should contain follwoing fields only:
- id,
- name,
- gender,
- profile pic url,
- permanent address city,
- is person my frienc,
- count of mutual friends.
- option to filter API results on the basis of gender, 
permanent address city
- Add/Remove any user to/from my friends list



Thank You.


Regards,

Soumen


On Sun, Jul 28, 2019 at 6:41 PM Pradeep Sukhwani 
wrote:

> Your question is vague. Share an example may be piece of a code or a
> scenario that can help us to understand product requirement more clearly.
>
> --
> 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/fdefae3e-ab89-4630-92b4-e583f8d328e9%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/CAPUw6Wa-_ikemtONhkPz5-Ay3bVb1t%3DdUyg4Qtj5w1Wq62_4Ew%40mail.gmail.com.


Django inbuilt Model

2019-07-28 Thread Soumen Khatua
Hi Folks,
I Extended Profile Model from dajngo inbuilt User model but Now I want call
all the details those are associated with Username in Profile model. I got
the username but how i cann call it in Profile model.

Ex:
class Profile(models.Model):
user = models.ForeignKey(User,related_name = 'user_model,..)

data = Profile.objects.filter(user = username)

But it's not working please help me guys.

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/CAPUw6WY%2BUNTU6UOAKyOxMWg24dAsmc7eB7%3D9kZTDjiukn3%2BKJQ%40mail.gmail.com.


Re: Django inbuilt Model

2019-07-29 Thread Soumen Khatua
Thank you for your response.

Regards,
Soumen

On Sun, 28 Jul 2019, 23:27 Juhana Jauhiainen, 
wrote:

> Hi Soumen,
>
> You could try with
>
> profiles = Profile.objects.filter(user__username=username)
>
>
> I would also suggest changing your model definition to something like
>
> class Profile(models.Model):
> user = models.OneToOneField(User, on_delete=models.CASCADE)
>
> Then you will have exactly one Profile per User and you can also access
> the Profile from user object with
>
> user.profile
>
> FYI, related_name defines the name of reverse relation. So in your case it
> would mean you can access the profile from a user object with
>
> user.user_model
>
> Which is probably not what you want..
>
> -Juhana
>
> On Sun, Jul 28, 2019 at 7:49 PM Soumen Khatua 
> wrote:
>
>> Hi Folks,
>> I Extended Profile Model from dajngo inbuilt User model but Now I want
>> call all the details those are associated with Username in Profile model. I
>> got the username but how i cann call it in Profile model.
>>
>> Ex:
>> class Profile(models.Model):
>> user = models.ForeignKey(User,related_name = 'user_model,..)
>>
>> data = Profile.objects.filter(user = username)
>>
>> But it's not working please help me guys.
>>
>> 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/CAPUw6WY%2BUNTU6UOAKyOxMWg24dAsmc7eB7%3D9kZTDjiukn3%2BKJQ%40mail.gmail.com
>> <https://groups.google.com/d/msgid/django-users/CAPUw6WY%2BUNTU6UOAKyOxMWg24dAsmc7eB7%3D9kZTDjiukn3%2BKJQ%40mail.gmail.com?utm_medium=email&utm_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/CABScFx851WQseNsCYf%3DYdW6eAYiPW05EQg-qEk%2B%2BTSZNVAXGuQ%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CABScFx851WQseNsCYf%3DYdW6eAYiPW05EQg-qEk%2B%2BTSZNVAXGuQ%40mail.gmail.com?utm_medium=email&utm_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/CAPUw6WY%3DX6_moHtc%2BdJYqE2R3TnKVuc-SNPfXHx_d9oGqVCd-g%40mail.gmail.com.


Django Rest Framework

2019-07-29 Thread Soumen Khatua
Hi Folks,
I extended User model by Profile Model but mu requirement is like If I'm
creating any resource it should is_your_friend equals True or yes but for
others it should show  is_your_friend equals to False or No. Also one
column is there called mutual friend if this friend common for me and
others it should show Mutual Friend equals to friend name like that. How i
can do that using Django Rest Framework,Please help me guys,it's urgent!!!


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/CAPUw6WZsbQ%2By9bjhwLnk3TqpBwrPAjh3V47LzdyFeEVm3u5OEg%40mail.gmail.com.


  1   2   >