Error: duplicate key value violates unique constraint

2022-09-23 Thread Salima Begum
Hi all,

When I am posting data in the server here we have an issue where the
primary key already exists. For example, today I posted some data . I have
the same issue. I solved the issue by deleting data from that particular
table and then I am able to post data. Next day if I try to post data I am
having the same issue with the primary key already exists. Why this is
happening I am not able to understand.  On the server I am getting this
issue where as in local I don't have any issue.
Please help me to understand why I am having this issue.
```
django.db.utils.IntegrityError: duplicate key value violates unique
constraint "trades_trade_table_pkey"
DETAIL: Key (id)=(2) already exists
```
Thank you
~Salima

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


Re: How to use Authentication in DRF

2022-07-21 Thread Salima Begum
Thanks  Ammar Mohammed for the quick response, After login to the
website  through Chrome browser, I got the response.
 But when I run from Postman to test API by mentioning Basic AUTH
credentials of which I created user models login credentials it's giving
home page html response but which I want is JSON Response. Why it's not
reading credentials I mentioned there?

Thanks
~Salima


On Thu, Jul 21, 2022 at 10:58 AM Ammar Mohammed 
wrote:

> Hey Salima
> I guess you can use access token authentication in DRF.
> But Do you recive the response without logging in?
> Please explain more please
>
> --
>
> Ammar Mohammed
> +249 113075979
> On 21 Jul 2022 07:08, "Salima Begum"  wrote:
>
>> Hi all,
>>
>> I am trying to convert my current project(It is developed in Django) to
>> DRF. So, I set up DRF into my project then I wrote an endpoint for after
>> user login on the session I need to get the response when I test the
>> my-reviews API.
>>
>> models.py
>> ```
>> class customer(models.Model):
>> cust_id = models.IntegerField(null="true")
>> email = models.CharField(max_length=100)
>> # reemail = models.CharField(max_length=100, null='true')
>> password = models.CharField(max_length=500)
>> repassword = models.CharField(max_length=500, null='true')
>> firstname = models.CharField(max_length=225)
>> lastname = models.CharField(max_length=225, null=True)
>> state = models.CharField(max_length=64, null=True)
>> city = models.CharField(max_length=64, null=True)
>> location = models.CharField(max_length=225, null=True)
>> Zip = models.CharField(max_length=64)
>> mailing = models.CharField(max_length=1000)
>> added_date = models.DateTimeField(editable=False)
>> modified_date = models.DateTimeField(null=True, blank=True)
>> last_loggedin = models.DateField()
>> ```
>> views.py
>>
>> ```
>> @api_view(['GET'])
>> def myservicereviewAPI(request):
>> # If a user session is logged out it will redirect to the home page.
>> if ((request.session.get('email') is None) or
>> (request.session.get('email') == "")):
>> # redirecting user after logged out to home page.
>> return HttpResponseRedirect("/home")
>> if request.method == 'GET':
>> students = services_review.objects.all().order_by('-added_date')
>> serializer = ServicesReviewSerializer(students, many=True)
>> return Response(serializer.data)
>> ```
>> urls.py
>> ```
>> path('myservicereviewAPI', views.myservicereviewAPI,
>> name='myservicereviewAPI'),
>> ```
>>
>> Results of Postman when I run 'myservicereviewAPI'
>>
>> After login Browser results of 'myservicereviewAPI'
>>
>> Please Help me to achieve this.
>>
>> Thanks
>> ~Salima
>>
>> --
>> 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/CAMSz6bk%2B73gVaO0Pfq3BfT4msHAprSwyxcCq-9BWtS-faT%3DYAA%40mail.gmail.com
>> <https://groups.google.com/d/msgid/django-users/CAMSz6bk%2B73gVaO0Pfq3BfT4msHAprSwyxcCq-9BWtS-faT%3DYAA%40mail.gmail.com?utm_medium=email_source=footer>
>> .
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAHs1H7vv1b5zYXTNAk-Pm9FU5r9wVCJjODi9Pmc6BCaykKRnuQ%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAHs1H7vv1b5zYXTNAk-Pm9FU5r9wVCJjODi9Pmc6BCaykKRnuQ%40mail.gmail.com?utm_medium=email_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAMSz6b%3D6HpkhJGpr5yf64GL8fta10DgfPKsbotKNVETh_d8mPA%40mail.gmail.com.


Re: Added new column to model and run migrations but not applied to database table

2022-06-15 Thread Salima Begum
Hello Django experts,

We are seeing this problem again and think that this should be a serious
bug in Django. We are wondering whether any one in this community is having
the same issue. I would appreciate it if you could share your thoughts on
this because we are really unhappy to see this problem again and again.

Thanks
~Salima

On Mon, Aug 16, 2021 at 9:47 AM Salima Begum 
wrote:

> Hi,
> I am hitting this problem again with new code merges into the
> deployment server. Last time, I fixed the issue by doing like this
>
> "I have tried all the ways what you guys suggested me But here I don't
> want change database why because it is deployment server so, when I run
> manage.py makemigrations migrations are applied and changes are reading but
> when I run manage.py migrate changes are not taken to database so, Manually
> I queried queries to add columns into respected tables into database."
>
> I really think this might not be a sustainable solution. So, I would
> really like to fix this permanently. I would appreciate it if someone could
> suggest a remedy for this issue.
>
> Thank you in advance
> ~Salima
>
> On Tue, Jul 27, 2021 at 5:18 AM guna visva  wrote:
>
>> having had the unfortunate phase of dealing with it , sorting it requires
>> some patience
>>
>> the issue is the tables in django_migrations is not in sync with rest the
>> rest of your database or migrations files.
>>
>> You have to first remove the addition in field etc and make sure the
>> database tables are first in sync with your models, then 1. delete
>> migrations files and 2. delete django_migrations. Then 3.makemigrations and
>> 4. migrate fake.  All risks are yours to take
>>
>> Then finally just add your fields and makemigrations and migrate
>>
>> The above might/or not work as it might give some content type errors
>>
>>
>>
>>
>> On Wednesday, July 21, 2021 at 2:39:56 AM UTC+8 sebasti...@gmail.com
>> wrote:
>>
>>> Is in settings.py also in installed app? Without that migrations don't
>>> work
>>>
>>> Salima Begum  schrieb am Di., 20. Juli
>>> 2021, 19:00:
>>>
>>>> Hi ,
>>>> Thank you for your responses.
>>>>  I have tried all the ways Which you people suggested I am not getting
>>>> any error while running makemigrations or migrate and
>>>> python manage.py migrate --fake-initial. But those migrations are not
>>>> applying to the database. How can I fix this issue without deleting the
>>>> database?
>>>>
>>>> Thank you
>>>> ~Salima
>>>>
>>>>
>>>> On Mon, Jul 19, 2021 at 7:02 PM Aman Vyas  wrote:
>>>>
>>>>> if it is saying no changes detected while running makemigrations and
>>>>> you are sure that you changed models.py  then these things you can try:
>>>>>
>>>>> 1: python manage.py makemigrations appname
>>>>>
>>>>> if this will not work then do that
>>>>>
>>>>> 2: delete migrations folder from your app and delete database then run
>>>>> again python manage.py makemigrations
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> On Mon, Jul 19, 2021 at 6:07 AM Salima Begum <
>>>>> sali...@rohteksolutions.com> wrote:
>>>>>
>>>>>> Hi all,
>>>>>>
>>>>>> I have added a new column to the existing model while developing.
>>>>>> Then I run makemigrations and migrate. It is not applied to the database
>>>>>> table which is created based on that model. How can I fix this issue?
>>>>>> Please help me to complete this issue.
>>>>>>
>>>>>> The below issue I am facing in deployment server after adding new
>>>>>> field and deployed into server.
>>>>>>
>>>>>> ```
>>>>>> psycopg2.errors.UndefinedColumn: column
>>>>>> shopping_ls_product_search.quality_prdct does not exist
>>>>>> LINE 1: ... Col1 FROM "shopping_ls_product_search" WHERE
>>>>>> ("shopping_...
>>>>>> ```
>>>>>> Thank you
>>>>>> ~Salima
>>>>>>
>>>>>> --
>>>>>> You received this message because you are subscribed to the Google
>>>>>> Groups "Django users" group.
>>>>>> To unsubscribe from this group and stop receiving emails f

Re: Pytest coverage report 100%

2022-05-18 Thread Salima Begum
Hi,
Thank you for your response. We are basically writing a unit test for
Account_security function with this unit test code.


Unit test code :


> def test_Account_security_url(self):
> path = reverse('account-security')
> assert resolve(path).view_name == 'account-security'

-

Here is the function for which we write above unit test, but the test is
not covering these red colored statements. So, we are wondering what could
be the issue here.

>
> def Account_security(request):
> try:
> if ((request.session.get('email') is None) or
> (request.session.get('email') == "")):
> return HttpResponseRedirect("/home")
> dict_act = {}
> email = request.session.get('email')
> email = request.session.get('email')
> # save_url = save_current_url(request, email)
> # Based on logged in user email filtering list of objects.
> account = vk_Account_history.objects.filter(email=email)
> # Calculating logged in time.
> for i in account:
> some_date = diff_time_Acnt(i)
> dict_act[i.id] = some_date
> return render(request, 'account_security.html', {'account':
> account, 'fullname': fullname(email),
> some_date = diff_time_Acnt(i)
> dict_act[i.id] = some_date
> return render(request, 'account_security.html', {'account':
> account, 'fullname': fullname(email),
>  'name':
> first_last_initial(email),
>  'time':
> settings.SESSION_IDLE_TIMEOUT,
>  'some_date':
> dict_act,
>  })
> except Exception as e:
> logging.error(e)
> return render(request, 'account_security.html', {'account':
> account, 'fullname': fullname(email),
> logging.error(e)
> return render(request, 'account_security.html', {'account':
> account, 'fullname': fullname(email),
>  'name':
> first_last_initial(email),
>  'time':
> settings.SESSION_IDLE_TIMEOUT,
>  'some_date':
> dict_act,
>      })




Likewise it's happening in other tests also.

Thank you
~Salima

On Thu, May 19, 2022 at 2:24 AM Kasper Laudrup 
wrote:

> On 18/05/2022 09.20, Salima Begum wrote:
> > How to write a test case for total function without missing any
> > statement. Please help me out how to write a test case for above
> > function.
> >
>
> You inject values in your test case to make sure all branches are covered.
>
> Sometimes that requires a bit more trickery with mocking out some things
> but in the case of the function you've shown it should be fairly simple
> to achieve 100% test coverage, at least from the point of a coverage tool.
>
> Any specific parts you're having issues with? I can't help to notice
> that you return the exact same thing to the use in the case of any
> exception but only log the exception. That seems wrong but I'm not sure
> if that's related to your question.
>
> Kind regards,
> Kasper Laudrup
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/5e56c8b0-e5f6-9c9b-a9fd-77b5eedcd0d1%40stacktrace.dk
> .
>

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


Pytest coverage report 100%

2022-05-18 Thread Salima Begum
Hi all,
How to write a pytest case to get coverage report to 100%.

```
def Account_security(request):
try:
if ((request.session.get('email') is None) or
(request.session.get('email') == "")):
return HttpResponseRedirect("/home")
dict_act = {}
email = request.session.get('email')
# save_url = save_current_url(request, email)
# Based on logged in user email filtering list of objects.
account = Account_history.objects.filter(email=email)
# Calculating logged in time.
for i in account:
some_date = diff_time_Acnt(i)
dict_act[i.id] = some_date
return render(request, 'account_security.html',
  {'account': account,

   'fullname': fullname(email),
'name': first_last_initial(email),
'time': settings.SESSION_IDLE_TIMEOUT,
 'some_date': dict_act,
 })
except Exception as e:
logging.error(e)
return render(request, 'account_security.html', {'account':
account, 'fullname': fullname(email),
 'name':
first_last_initial(email),
 'time':
settings.SESSION_IDLE_TIMEOUT,
 'some_date': dict_act,
 })
```

How to write a test case for total function without missing any
statement. Please help me out how to write a test case for above
function.

Thanks
~Salima

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


'str' object is not callable

2022-05-06 Thread Salima Begum
Hi all,
In my project I am Django messages Framework. I am always facing 'str'
object error I dont understand how to solve this problem. Previously also I
face same issue. Now it is reproduced.
I am using django 4.0.4 version.
 Python 3.9.6
```
   messages.success(request, "Welcome back")
```
```
{% if messages %}
{% for message in messages %}


×
{% if message.tags == 'error' %}

{{
message|safe }}
{% else %}

{{ message|safe
}}
{% endif %}


{% endfor %}
{% endif %}
```

Please help me to solve this issue.

Thanks
~Salima

-- 
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/CAMSz6bkPYRUwSidJd1ay-q-GdeM5Q8CKqY%2BnYU3j7wk%2BEAmYOQ%40mail.gmail.com.


'str' object is not callable

2022-05-06 Thread Salima Begum
Hi all,
In my project I am Django messages Framework. I am always facing 'str'
object error I dont understand how to solve this problem. Previously also I
face same issue. Now it is reproduced.
I am using django 4.0.4 version.
 Python 3.9.6
```
   messages.success(request, "Welcome back")
```
```
{% if messages %}
{% for message in messages %}


×
{% if message.tags == 'error' %}

{{
message|safe }}
{% else %}

{{ message|safe
}}
{% endif %}


{% endfor %}
{% endif %}
```

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


Re: Got an error creating the test database: database "" already exists

2022-03-17 Thread Salima Begum
Hi,
I am using django version 3.2.9 and Yes above you mentioned like that only
i am running migrations.
1. python manage.py makemigrations
2. python manage.py migrate
No, I am not using django build in user model. I am using my custom one.


a

On Thu, Mar 17, 2022 at 7:37 PM DJANGO DEVELOPER 
wrote:

> what version of Django are you using? and how did you make migrations?
> Should be like this:
> 1 - python manage.py makemigrations
> 2 - python manage.py migrate
> are you using custom user model? or django's built in User model?
>
> On Thu, Mar 17, 2022 at 3:42 PM Prashanth Patelc <
> prashanthpat...@gmail.com> wrote:
>
>> Check your settings.py once
>> Add auth_user='app.UserModel'
>>
>> Or
>> 1) delete database and migrations
>> 2) create new db
>> 3) python manage.py makemigration
>> 4) python manage.py migrate
>>
>>
>> On Thu, Mar 17, 2022, 9:35 AM Avinash Alanjakar <
>> avinashalanj...@gmail.com> wrote:
>>
>>>
>>> Their are lots of pre-bulit apps in django so you need to migrate them
>>> first.
>>> In your case you are using the authentication with migrating their
>>> tables with database.
>>>
>>> Try to run command in this sequence. This might be solve your problem.
>>>
>>>
>>> python manage.py migrate
>>>
>>> python manage.py makemigrations
>>>
>>> python manage.py migrate
>>>
>>>
>>> Thanks,
>>> Avinash
>>>
>>> On Thu, 17 Mar, 2022, 8:53 am Salima Begum, <
>>> salim...@rohteksolutions.com> wrote:
>>>
>>>> Yes I run migrations still I am seeing the new issue below
>>>> ```
>>>> django.db.utils.ProgrammingError: relation "auth_user" does not exist
>>>> ```
>>>> Thank you
>>>> ~Salima
>>>>
>>>> On Wed, Mar 16, 2022 at 9:23 PM DJANGO DEVELOPER <
>>>> abubakarbr...@gmail.com> wrote:
>>>>
>>>>> you need to run migrations first and then run the tests. if the issue
>>>>> still persists. let me know
>>>>>
>>>>> On Wed, Mar 16, 2022 at 2:15 PM Sebastian Jung <
>>>>> sebastian.ju...@gmail.com> wrote:
>>>>>
>>>>>> Hey salima,
>>>>>>
>>>>>> This error is strange. Django try to use a Relation in postgresql
>>>>>> which doesn't exist.
>>>>>>
>>>>>> I have only tip that you cam reset database. I would delete database
>>>>>> in postgresql and create it new with psql tool. After this you must reset
>>>>>> all migrations:
>>>>>>
>>>>>>
>>>>>> https://simpleisbetterthancomplex.com/tutorial/2016/07/26/how-to-reset-migrations.html
>>>>>>
>>>>>> And after this when you migrate it, then structure is created in new
>>>>>> database.
>>>>>>
>>>>>> I am sorry i have no idea how yoz can fix relation exception manual.
>>>>>>
>>>>>> Regards
>>>>>>
>>>>>>
>>>>>> Salima Begum  schrieb am Mi., 16. März
>>>>>> 2022, 06:51:
>>>>>>
>>>>>>> Hi all,
>>>>>>> After writing test cases I run test cases I am getting an error below
>>>>>>> ```
>>>>>>> Python manage.py behave
>>>>>>> ```
>>>>>>> After running the above command I am getting this error.
>>>>>>> ```
>>>>>>> Creating test database for alias 'default'...
>>>>>>> Got an error creating the test database: database "test_newDataBase"
>>>>>>> already exists
>>>>>>>
>>>>>>> Type 'yes' if you would like to try deleting the test database
>>>>>>> 'test_newDataBase', or 'no' to cancel: yes
>>>>>>> Destroying old test database for alias 'default'...
>>>>>>> Traceback (most recent call last):
>>>>>>>   File "C:\Users\USER
>>>>>>> 1\PycharmProjects\behaveproject\venv\lib\site-packages\django\db\backends\utils.py",
>>>>>>> line 86, in _execute
>>>>>>> return self.cursor.execute(sql, params)
>>>>>>> psycopg2.errors.UndefinedTable: relation "trades_trade_table" does
>>>>>>> n

Re: Got an error creating the test database: database "" already exists

2022-03-16 Thread Salima Begum
Yes I run migrations still I am seeing the new issue below
```
django.db.utils.ProgrammingError: relation "auth_user" does not exist
```
Thank you
~Salima

On Wed, Mar 16, 2022 at 9:23 PM DJANGO DEVELOPER 
wrote:

> you need to run migrations first and then run the tests. if the issue
> still persists. let me know
>
> On Wed, Mar 16, 2022 at 2:15 PM Sebastian Jung 
> wrote:
>
>> Hey salima,
>>
>> This error is strange. Django try to use a Relation in postgresql which
>> doesn't exist.
>>
>> I have only tip that you cam reset database. I would delete database in
>> postgresql and create it new with psql tool. After this you must reset all
>> migrations:
>>
>>
>> https://simpleisbetterthancomplex.com/tutorial/2016/07/26/how-to-reset-migrations.html
>>
>> And after this when you migrate it, then structure is created in new
>> database.
>>
>> I am sorry i have no idea how yoz can fix relation exception manual.
>>
>> Regards
>>
>>
>> Salima Begum  schrieb am Mi., 16. März
>> 2022, 06:51:
>>
>>> Hi all,
>>> After writing test cases I run test cases I am getting an error below
>>> ```
>>> Python manage.py behave
>>> ```
>>> After running the above command I am getting this error.
>>> ```
>>> Creating test database for alias 'default'...
>>> Got an error creating the test database: database "test_newDataBase"
>>> already exists
>>>
>>> Type 'yes' if you would like to try deleting the test database
>>> 'test_newDataBase', or 'no' to cancel: yes
>>> Destroying old test database for alias 'default'...
>>> Traceback (most recent call last):
>>>   File "C:\Users\USER
>>> 1\PycharmProjects\behaveproject\venv\lib\site-packages\django\db\backends\utils.py",
>>> line 86, in _execute
>>> return self.cursor.execute(sql, params)
>>> psycopg2.errors.UndefinedTable: relation "trades_trade_table" does not
>>> exist
>>> .
>>> .
>>> django.db.utils.ProgrammingError: relation "trades_vk_trade_table" does
>>> not exist
>>> ```
>>> Please help me to resolve this issue.
>>>
>>> Thank you
>>> ~Salima
>>>
>>> --
>>> 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/CAMSz6b%3DTEv%3DH25L7giQV6w%3DYw6%3D6GJrvh5zPezqQWMger3VNzQ%40mail.gmail.com
>>> <https://groups.google.com/d/msgid/django-users/CAMSz6b%3DTEv%3DH25L7giQV6w%3DYw6%3D6GJrvh5zPezqQWMger3VNzQ%40mail.gmail.com?utm_medium=email_source=footer>
>>> .
>>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CAKGT9mx2sRizWo8Qd%3Dn6yYFKUB1KvjKH%2Bi92Hj_fdoStRYc%3DWg%40mail.gmail.com
>> <https://groups.google.com/d/msgid/django-users/CAKGT9mx2sRizWo8Qd%3Dn6yYFKUB1KvjKH%2Bi92Hj_fdoStRYc%3DWg%40mail.gmail.com?utm_medium=email_source=footer>
>> .
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAKPY9pkx0hJ3U_DFCia_UUY-ecieMJ0%2BE3uE75aTziehr1KWSg%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAKPY9pkx0hJ3U_DFCia_UUY-ecieMJ0%2BE3uE75aTziehr1KWSg%40mail.gmail.com?utm_medium=email_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAMSz6b%3DZTCYy%2BY1NoRSh9t0S0UcLkwcSb_31SYqzOg95SU%2Bq6Q%40mail.gmail.com.


Got an error creating the test database: database "" already exists

2022-03-15 Thread Salima Begum
Hi all,
After writing test cases I run test cases I am getting an error below
```
Python manage.py behave
```
After running the above command I am getting this error.
```
Creating test database for alias 'default'...
Got an error creating the test database: database "test_newDataBase"
already exists

Type 'yes' if you would like to try deleting the test database
'test_newDataBase', or 'no' to cancel: yes
Destroying old test database for alias 'default'...
Traceback (most recent call last):
  File "C:\Users\USER
1\PycharmProjects\behaveproject\venv\lib\site-packages\django\db\backends\utils.py",
line 86, in _execute
return self.cursor.execute(sql, params)
psycopg2.errors.UndefinedTable: relation "trades_trade_table" does not exist
.
.
django.db.utils.ProgrammingError: relation "trades_vk_trade_table" does not
exist
```
Please help me to resolve this issue.

Thank you
~Salima

-- 
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/CAMSz6b%3DTEv%3DH25L7giQV6w%3DYw6%3D6GJrvh5zPezqQWMger3VNzQ%40mail.gmail.com.


How to make a fix backward compatible with old data?

2021-09-21 Thread Salima Begum
Hi all,
We used to allow uploading images to a market place Ad and when a user
doesn't upload one of the images we present a dummy image in the UI as well
as saving the same dummy image in the database.

Now we added a fix for not saving dummy image and just saving whatever user
uploads. That means when a user uploads 2 out of 3 images, we just upload 2
images and present them in the UI without any dummy image.

So this creates new problem now because the old Ads display dummy images in
UI and newly posted Ads don't show dummy images because of the fix that was
added. I would like to know how to make the fix backward compatible to the
old data?


Thanks
~Salima

-- 
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/CAMSz6bnBWPfr8KJJnkR_1Z-6qP3Wu7Raoo8T5aayWUj6b_5grQ%40mail.gmail.com.


'str' object is not callable error appears from Django Message Framework

2021-09-19 Thread Salima Begum
Hi all,


Our web application prompts confirmation messages when user submits the
form and users can continue to submit additional forms while they are using
application and the confirmation messages are prompted fine, but  'str'
object is not callable error appears randomly before prompting a
confirmation message and once this error starts appearing it will continue
to appear for any form submission. During our testing we observed that this
issue is happening  in Django version 3.2.7 (ubuntu 20.x), but it is not
reproducible in Django version 3.1.6 (windows10). So, we think that this
could be a bug in version 3.2.7 . We made sure our code by following this
page.

https://docs.djangoproject.com/en/3.2/ref/contrib/messages/

In views.py :

{{{
 messages.success(request, "Item is successfully removed.")
}}}


In template:

{{{
 {% for message in messages %}


×
{% if message.tags == 'error' %}

{{ message|safe }}
{% else %}

{{ message|safe
}}
{% endif %}


{% 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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAMSz6b%3DJ2OLkOiwpRw2h6H48x6ELb61REWM%3Dj913pssxBZsrhA%40mail.gmail.com.


Re: TypeError: 'str' object is not callable

2021-09-13 Thread Salima Begum
Hi,
 In my project for success confirmation messages I am using the Messages
framework from Django. Here I am always getting errors in deployment server.

https://docs.djangoproject.com/en/3.2/ref/contrib/messages/

After deploying site.when i am continuously testing site. After some time I
am getting the 'str' object is not callable error is raised. for success
confirmation messages.
In views.py we are defining confirmation messages.
```

 messages.success(request, "Item is successfully removed.")


```

In settings.py
```
MESSAGE_STORAGE = 'django.contrib.messages.storage.cookie.CookieStorage'
MESSAGE_LEVEL = message_constants.DEBUG
```

Django version 3.2.7

Can anyone please help me. how to fix this error I am facing this issue
from long time back again and again same issue is raising. where I am going
wrong i am not understanding could you please help me to fix this issue.

Thanks
~Salima

On Thu, Sep 2, 2021 at 10:27 AM Lalit Suthar 
wrote:

> cool :)
>
>
> On Tue, 31 Aug 2021 at 11:27, Salima Begum 
> wrote:
>
>> Hi all,
>> Actually this error is prompting because in my deployment site I am using
>> django version 3.2. In this version they have some issue with messages so,
>> I referred to this document and I fixed it by adding one line in the
>> settings.py file.
>> https://docs.djangoproject.com/en/3.2/ref/contrib/messages/
>>
>> On Tue, Aug 31, 2021 at 11:22 AM Lalit Suthar 
>> wrote:
>>
>>> go like this
>>>
>>> messages.add_message(request, messages.WARNING, "failure message")
>>> return HttpResponse / render
>>>
>>> On Tue, 31 Aug 2021 at 10:32, Salima Begum 
>>> wrote:
>>>
>>>> Hi, Thank you for your response.
>>>>  I have defined as below  I have mentioned snippet in all
>>>> functionalities i am getting error in every functionality  " 'str' object
>>>> is not callable ".Please help me to fix this issue.
>>>>
>>>> ```
>>>> messages.success(request, """Your Ad is successfully posted.""")
>>>> ```
>>>> Thank you
>>>> ~Salima
>>>>
>>>> On Tue, Aug 31, 2021 at 10:19 AM Salima Begum <
>>>> salim...@rohteksolutions.com> wrote:
>>>>
>>>>> Hi Thomas,
>>>>>
>>>>> The way I defined how i have written code for confirmation message
>>>>> ```
>>>>> messages.success(request, """Your Ad is successfully
>>>>> posted.""")
>>>>> ```
>>>>> Thank you
>>>>> ~Salima
>>>>>
>>>>> On Tue, Aug 31, 2021 at 9:31 AM Thomas Lockhart <
>>>>> tlockhart1...@gmail.com> wrote:
>>>>>
>>>>>> Just guessing that you need to write
>>>>>>
>>>>>> messages.success = “Your ad is successfully posted”
>>>>>>
>>>>>> But without more information from you that is only a guess.
>>>>>>
>>>>>> How is messages.success defined?
>>>>>>
>>>>>> - Tom
>>>>>>
>>>>>> On Aug 30, 2021, at 8:57 PM, Salima Begum <
>>>>>> salim...@rohteksolutions.com> wrote:
>>>>>>
>>>>>> Hi all,
>>>>>> In my project for each functionality I have written code for
>>>>>> confirmation messages. For example
>>>>>> ```
>>>>>> messages.success("Your ad is successfully posted")
>>>>>> ```
>>>>>> Every functionality is breaking because of confirmation messages
>>>>>> after deployment. How to fix it? Can anyone help me?
>>>>>>
>>>>>> Thank you
>>>>>> ~Salima
>>>>>>
>>>>>>
>>>>>> --
>>>>>> 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/CAMSz6bkOz8AXa7d%2BRFFjm0m8xmCLYOyLQNx6syy7tf-NsPTRhA%40mail.gmail.com
>>>>>> <https://groups.google.com/d/msgid/django-users/CAMSz6bkOz8AXa7d%2BRFFjm0m8xmCLYOyLQNx6syy7tf-NsPTRhA%40mail.gmail.co

Re: TypeError: 'str' object is not callable

2021-08-30 Thread Salima Begum
Hi all,
Actually this error is prompting because in my deployment site I am using
django version 3.2. In this version they have some issue with messages so,
I referred to this document and I fixed it by adding one line in the
settings.py file.
https://docs.djangoproject.com/en/3.2/ref/contrib/messages/

On Tue, Aug 31, 2021 at 11:22 AM Lalit Suthar 
wrote:

> go like this
>
> messages.add_message(request, messages.WARNING, "failure message")
> return HttpResponse / render
>
> On Tue, 31 Aug 2021 at 10:32, Salima Begum 
> wrote:
>
>> Hi, Thank you for your response.
>>  I have defined as below  I have mentioned snippet in all functionalities
>> i am getting error in every functionality  " 'str' object is not callable
>> ".Please help me to fix this issue.
>>
>> ```
>> messages.success(request, """Your Ad is successfully posted.""")
>> ```
>> Thank you
>> ~Salima
>>
>> On Tue, Aug 31, 2021 at 10:19 AM Salima Begum <
>> salim...@rohteksolutions.com> wrote:
>>
>>> Hi Thomas,
>>>
>>> The way I defined how i have written code for confirmation message
>>> ```
>>> messages.success(request, """Your Ad is successfully posted.""")
>>> ```
>>> Thank you
>>> ~Salima
>>>
>>> On Tue, Aug 31, 2021 at 9:31 AM Thomas Lockhart 
>>> wrote:
>>>
>>>> Just guessing that you need to write
>>>>
>>>> messages.success = “Your ad is successfully posted”
>>>>
>>>> But without more information from you that is only a guess.
>>>>
>>>> How is messages.success defined?
>>>>
>>>> - Tom
>>>>
>>>> On Aug 30, 2021, at 8:57 PM, Salima Begum 
>>>> wrote:
>>>>
>>>> Hi all,
>>>> In my project for each functionality I have written code for
>>>> confirmation messages. For example
>>>> ```
>>>> messages.success("Your ad is successfully posted")
>>>> ```
>>>> Every functionality is breaking because of confirmation messages after
>>>> deployment. How to fix it? Can anyone help me?
>>>>
>>>> Thank you
>>>> ~Salima
>>>>
>>>>
>>>> --
>>>> 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/CAMSz6bkOz8AXa7d%2BRFFjm0m8xmCLYOyLQNx6syy7tf-NsPTRhA%40mail.gmail.com
>>>> <https://groups.google.com/d/msgid/django-users/CAMSz6bkOz8AXa7d%2BRFFjm0m8xmCLYOyLQNx6syy7tf-NsPTRhA%40mail.gmail.com?utm_medium=email_source=footer>
>>>> .
>>>>
>>>>
>>>> --
>>>> You received this message because you are subscribed to the Google
>>>> Groups "Django users" group.
>>>> To unsubscribe from this group and stop receiving emails from it, send
>>>> an email to django-users+unsubscr...@googlegroups.com.
>>>> To view this discussion on the web visit
>>>> https://groups.google.com/d/msgid/django-users/3831F4E1-0003-4F5A-922D-F6E1534E1B87%40gmail.com
>>>> <https://groups.google.com/d/msgid/django-users/3831F4E1-0003-4F5A-922D-F6E1534E1B87%40gmail.com?utm_medium=email_source=footer>
>>>> .
>>>>
>>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CAMSz6b%3Dgrd5PeypVZJQ9L9uA90_xxijiq6eQSaqH6bdqhgNukg%40mail.gmail.com
>> <https://groups.google.com/d/msgid/django-users/CAMSz6b%3Dgrd5PeypVZJQ9L9uA90_xxijiq6eQSaqH6bdqhgNukg%40mail.gmail.com?utm_medium=email_source=footer>
>> .
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAGp2JVE6P_5qUAC2Ec%3D8Tzn6mUPTdvXhWJ4dO5XUUC2D-7vYVQ%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAGp2JVE6P_5qUAC2Ec%3D8Tzn6mUPTdvXhWJ4dO5XUUC2D-7vYVQ%40mail.gmail.com?utm_medium=email_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAMSz6bmDkQio%3DYD9jxHxthnuupwkR80sjWgLEY4E6-SPZ5ofxQ%40mail.gmail.com.


Re: TypeError: 'str' object is not callable

2021-08-30 Thread Salima Begum
Hi, Thank you for your response.
 I have defined as below  I have mentioned snippet in all functionalities i
am getting error in every functionality  " 'str' object is not callable
".Please help me to fix this issue.

```
messages.success(request, """Your Ad is successfully posted.""")
```
Thank you
~Salima

On Tue, Aug 31, 2021 at 10:19 AM Salima Begum 
wrote:

> Hi Thomas,
>
> The way I defined how i have written code for confirmation message
> ```
> messages.success(request, """Your Ad is successfully posted.""")
> ```
> Thank you
> ~Salima
>
> On Tue, Aug 31, 2021 at 9:31 AM Thomas Lockhart 
> wrote:
>
>> Just guessing that you need to write
>>
>> messages.success = “Your ad is successfully posted”
>>
>> But without more information from you that is only a guess.
>>
>> How is messages.success defined?
>>
>> - Tom
>>
>> On Aug 30, 2021, at 8:57 PM, Salima Begum 
>> wrote:
>>
>> Hi all,
>> In my project for each functionality I have written code for confirmation
>> messages. For example
>> ```
>> messages.success("Your ad is successfully posted")
>> ```
>> Every functionality is breaking because of confirmation messages after
>> deployment. How to fix it? Can anyone help me?
>>
>> Thank you
>> ~Salima
>>
>>
>> --
>> 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/CAMSz6bkOz8AXa7d%2BRFFjm0m8xmCLYOyLQNx6syy7tf-NsPTRhA%40mail.gmail.com
>> <https://groups.google.com/d/msgid/django-users/CAMSz6bkOz8AXa7d%2BRFFjm0m8xmCLYOyLQNx6syy7tf-NsPTRhA%40mail.gmail.com?utm_medium=email_source=footer>
>> .
>>
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/3831F4E1-0003-4F5A-922D-F6E1534E1B87%40gmail.com
>> <https://groups.google.com/d/msgid/django-users/3831F4E1-0003-4F5A-922D-F6E1534E1B87%40gmail.com?utm_medium=email_source=footer>
>> .
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAMSz6b%3Dgrd5PeypVZJQ9L9uA90_xxijiq6eQSaqH6bdqhgNukg%40mail.gmail.com.


Re: TypeError: 'str' object is not callable

2021-08-30 Thread Salima Begum
Hi Thomas,

The way I defined how i have written code for confirmation message
```
messages.success(request, """Your Ad is successfully posted.""")
```
Thank you
~Salima

On Tue, Aug 31, 2021 at 9:31 AM Thomas Lockhart 
wrote:

> Just guessing that you need to write
>
> messages.success = “Your ad is successfully posted”
>
> But without more information from you that is only a guess.
>
> How is messages.success defined?
>
> - Tom
>
> On Aug 30, 2021, at 8:57 PM, Salima Begum 
> wrote:
>
> Hi all,
> In my project for each functionality I have written code for confirmation
> messages. For example
> ```
> messages.success("Your ad is successfully posted")
> ```
> Every functionality is breaking because of confirmation messages after
> deployment. How to fix it? Can anyone help me?
>
> Thank you
> ~Salima
>
>
> --
> 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/CAMSz6bkOz8AXa7d%2BRFFjm0m8xmCLYOyLQNx6syy7tf-NsPTRhA%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAMSz6bkOz8AXa7d%2BRFFjm0m8xmCLYOyLQNx6syy7tf-NsPTRhA%40mail.gmail.com?utm_medium=email_source=footer>
> .
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/3831F4E1-0003-4F5A-922D-F6E1534E1B87%40gmail.com
> <https://groups.google.com/d/msgid/django-users/3831F4E1-0003-4F5A-922D-F6E1534E1B87%40gmail.com?utm_medium=email_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAMSz6bnyEHFg6oV2M%2Be1pMvktqaKc8WqRRZwek7-WscekmrbOQ%40mail.gmail.com.


TypeError: 'str' object is not callable

2021-08-30 Thread Salima Begum
Hi all,
In my project for each functionality I have written code for confirmation
messages. For example
```
messages.success("Your ad is successfully posted")
```
Every functionality is breaking because of confirmation messages after
deployment. How to fix it? Can anyone help me?

Thank you
~Salima

-- 
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/CAMSz6bkOz8AXa7d%2BRFFjm0m8xmCLYOyLQNx6syy7tf-NsPTRhA%40mail.gmail.com.


Re: Added new column to model and run migrations but not applied to database table

2021-08-15 Thread Salima Begum
Hi,
I am hitting this problem again with new code merges into the
deployment server. Last time, I fixed the issue by doing like this

"I have tried all the ways what you guys suggested me But here I don't want
change database why because it is deployment server so, when I run
manage.py makemigrations migrations are applied and changes are reading but
when I run manage.py migrate changes are not taken to database so, Manually
I queried queries to add columns into respected tables into database."

I really think this might not be a sustainable solution. So, I would really
like to fix this permanently. I would appreciate it if someone could
suggest a remedy for this issue.

Thank you in advance
~Salima

On Tue, Jul 27, 2021 at 5:18 AM guna visva  wrote:

> having had the unfortunate phase of dealing with it , sorting it requires
> some patience
>
> the issue is the tables in django_migrations is not in sync with rest the
> rest of your database or migrations files.
>
> You have to first remove the addition in field etc and make sure the
> database tables are first in sync with your models, then 1. delete
> migrations files and 2. delete django_migrations. Then 3.makemigrations and
> 4. migrate fake.  All risks are yours to take
>
> Then finally just add your fields and makemigrations and migrate
>
> The above might/or not work as it might give some content type errors
>
>
>
>
> On Wednesday, July 21, 2021 at 2:39:56 AM UTC+8 sebasti...@gmail.com
> wrote:
>
>> Is in settings.py also in installed app? Without that migrations don't
>> work
>>
>> Salima Begum  schrieb am Di., 20. Juli
>> 2021, 19:00:
>>
>>> Hi ,
>>> Thank you for your responses.
>>>  I have tried all the ways Which you people suggested I am not getting
>>> any error while running makemigrations or migrate and
>>> python manage.py migrate --fake-initial. But those migrations are not
>>> applying to the database. How can I fix this issue without deleting the
>>> database?
>>>
>>> Thank you
>>> ~Salima
>>>
>>>
>>> On Mon, Jul 19, 2021 at 7:02 PM Aman Vyas  wrote:
>>>
>>>> if it is saying no changes detected while running makemigrations and
>>>> you are sure that you changed models.py  then these things you can try:
>>>>
>>>> 1: python manage.py makemigrations appname
>>>>
>>>> if this will not work then do that
>>>>
>>>> 2: delete migrations folder from your app and delete database then run
>>>> again python manage.py makemigrations
>>>>
>>>>
>>>>
>>>>
>>>> On Mon, Jul 19, 2021 at 6:07 AM Salima Begum <
>>>> sali...@rohteksolutions.com> wrote:
>>>>
>>>>> Hi all,
>>>>>
>>>>> I have added a new column to the existing model while developing. Then
>>>>> I run makemigrations and migrate. It is not applied to the database table
>>>>> which is created based on that model. How can I fix this issue? Please 
>>>>> help
>>>>> me to complete this issue.
>>>>>
>>>>> The below issue I am facing in deployment server after adding new
>>>>> field and deployed into server.
>>>>>
>>>>> ```
>>>>> psycopg2.errors.UndefinedColumn: column
>>>>> shopping_ls_product_search.quality_prdct does not exist
>>>>> LINE 1: ... Col1 FROM "shopping_ls_product_search" WHERE ("shopping_...
>>>>> ```
>>>>> Thank you
>>>>> ~Salima
>>>>>
>>>>> --
>>>>> 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...@googlegroups.com.
>>>>> To view this discussion on the web visit
>>>>> https://groups.google.com/d/msgid/django-users/CAMSz6bnLkeN001UnxO3PdCg06Jc%3Dcr22kZXc71KL4w5CbYq_Cw%40mail.gmail.com
>>>>> <https://groups.google.com/d/msgid/django-users/CAMSz6bnLkeN001UnxO3PdCg06Jc%3Dcr22kZXc71KL4w5CbYq_Cw%40mail.gmail.com?utm_medium=email_source=footer>
>>>>> .
>>>>>
>>>> --
>>>> You received this message because you are subscribed to the Google
>>>> Groups "Django users" group.
>>>> To unsubscribe from this group and stop receiving emails from it, send
>>>> an email to django-users..

Re: Wish list functionality in products listing page.

2021-07-29 Thread Salima Begum
Hi all,

Here I have an issue based on the product id we are saving into the wish
list table. if that particular id is deleted from the product table in the
wishlist that particular product will be there right. how to handle
wishlist functionality in this case.

On Thu, Jul 29, 2021 at 6:16 PM DJANGO DEVELOPER 
wrote:

> I think you have to save the products in your wishlist feature just by
> doing the same way as we do in saving things in django
>
> On Thu, Jul 29, 2021 at 10:07 AM Salima Begum <
> salim...@rohteksolutions.com> wrote:
>
>> Hi all,
>> In my project I want to implement wishlist functionality in products
>> listing pages.
>> Is there any django packages to implement in my project and any ideas
>> please let me know
>>
>> Thank you
>> ~Salima
>>
>> --
>> 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/CAMSz6bmra3%2BdQxxBHL9%2B1K_7-mXhKf88QF67kK_4Q1a%2B%3DuB1Fg%40mail.gmail.com
>> <https://groups.google.com/d/msgid/django-users/CAMSz6bmra3%2BdQxxBHL9%2B1K_7-mXhKf88QF67kK_4Q1a%2B%3DuB1Fg%40mail.gmail.com?utm_medium=email_source=footer>
>> .
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAKPY9pmOKnHyuw%3D4dTgH%3DbcXn%3DP7X_SU%3DM%2Bi6%2BHDd4mc5PQU0w%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAKPY9pmOKnHyuw%3D4dTgH%3DbcXn%3DP7X_SU%3DM%2Bi6%2BHDd4mc5PQU0w%40mail.gmail.com?utm_medium=email_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAMSz6bmO4CTsc4u%3DT3HAPXzg2_wYis0wqMgPZe6tv_doEBQgTQ%40mail.gmail.com.


Wish list functionality in products listing page.

2021-07-28 Thread Salima Begum
Hi all,
In my project I want to implement wishlist functionality in products
listing pages.
Is there any django packages to implement in my project and any ideas
please let me know

Thank you
~Salima

-- 
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/CAMSz6bmra3%2BdQxxBHL9%2B1K_7-mXhKf88QF67kK_4Q1a%2B%3DuB1Fg%40mail.gmail.com.


Re: Added new column to model and run migrations but not applied to database table

2021-07-20 Thread Salima Begum
Hi ,
Thank you for your responses.
 I have tried all the ways Which you people suggested I am not getting any
error while running makemigrations or migrate and
python manage.py migrate --fake-initial. But those migrations are not
applying to the database. How can I fix this issue without deleting the
database?

Thank you
~Salima


On Mon, Jul 19, 2021 at 7:02 PM Aman Vyas  wrote:

> if it is saying no changes detected while running makemigrations and you
> are sure that you changed models.py  then these things you can try:
>
> 1: python manage.py makemigrations appname
>
> if this will not work then do that
>
> 2: delete migrations folder from your app and delete database then run
> again python manage.py makemigrations
>
>
>
>
> On Mon, Jul 19, 2021 at 6:07 AM Salima Begum 
> wrote:
>
>> Hi all,
>>
>> I have added a new column to the existing model while developing. Then I
>> run makemigrations and migrate. It is not applied to the database table
>> which is created based on that model. How can I fix this issue? Please help
>> me to complete this issue.
>>
>> The below issue I am facing in deployment server after adding new field
>> and deployed into server.
>>
>> ```
>> psycopg2.errors.UndefinedColumn: column
>> shopping_ls_product_search.quality_prdct does not exist
>> LINE 1: ... Col1 FROM "shopping_ls_product_search" WHERE ("shopping_...
>> ```
>> Thank you
>> ~Salima
>>
>> --
>> 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/CAMSz6bnLkeN001UnxO3PdCg06Jc%3Dcr22kZXc71KL4w5CbYq_Cw%40mail.gmail.com
>> <https://groups.google.com/d/msgid/django-users/CAMSz6bnLkeN001UnxO3PdCg06Jc%3Dcr22kZXc71KL4w5CbYq_Cw%40mail.gmail.com?utm_medium=email_source=footer>
>> .
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAKZY6%3DAgrWzCmrBHpouSJG_Vfy7i6LQu81Q7EWBRq44Yf3053A%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAKZY6%3DAgrWzCmrBHpouSJG_Vfy7i6LQu81Q7EWBRq44Yf3053A%40mail.gmail.com?utm_medium=email_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAMSz6bmQ5KAQ2SFHCMbf8UHkg34itZPFZ1OksP-2C3t5wAwTJQ%40mail.gmail.com.


Re: Added new column to model and run migrations but not applied to database table

2021-07-19 Thread Salima Begum
Hi Abhishek, What you suggested will work but I don't want to change my
database without changing databases. I want to fix this issue. How can I
achieve this? Please help me out.

Thank you very much for your quick response.

Thank you
~Salima

On Mon, Jul 19, 2021 at 11:45 AM Abhishek Choudhury <
choudhuryabhishe...@gmail.com> wrote:

> Hi Salima,
>
> If you're in a hurry and trying it on development, I think you can create
> a new database and run the migrate command. This will recreate the schema
> and your issue will be resolved in no time.
>
> Thanks and regards,
> Abhishek Choudhury
>
> On Mon, 19 Jul 2021 at 10:37 AM, Salima Begum <
> salim...@rohteksolutions.com> wrote:
>
>> Hi all,
>>
>> I have added a new column to the existing model while developing. Then I
>> run makemigrations and migrate. It is not applied to the database table
>> which is created based on that model. How can I fix this issue? Please help
>> me to complete this issue.
>>
>> The below issue I am facing in deployment server after adding new field
>> and deployed into server.
>>
>> ```
>> psycopg2.errors.UndefinedColumn: column
>> shopping_ls_product_search.quality_prdct does not exist
>> LINE 1: ... Col1 FROM "shopping_ls_product_search" WHERE ("shopping_...
>> ```
>> Thank you
>>
>> ~Salima
>>
>> --
>> 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/CAMSz6bnLkeN001UnxO3PdCg06Jc%3Dcr22kZXc71KL4w5CbYq_Cw%40mail.gmail.com
>> <https://groups.google.com/d/msgid/django-users/CAMSz6bnLkeN001UnxO3PdCg06Jc%3Dcr22kZXc71KL4w5CbYq_Cw%40mail.gmail.com?utm_medium=email_source=footer>
>> .
>>
> --
> Thanks and regards,
> Abhishek Choudhury
> Mobile: +91 7903717967
>
> --
> 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%2B3kJUY6ZWPYtQtp_gVB9Ax8%3DK%3Dgh_hV%3D_OXfvt1iOv8QnvtHg%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CA%2B3kJUY6ZWPYtQtp_gVB9Ax8%3DK%3Dgh_hV%3D_OXfvt1iOv8QnvtHg%40mail.gmail.com?utm_medium=email_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAMSz6b%3DJROx2d1FWj%3DvB7_xZ%2Bwga2_RVPwL_xvfgfdY1%2BFcR-A%40mail.gmail.com.


Added new column to model and run migrations but not applied to database table

2021-07-18 Thread Salima Begum
Hi all,

I have added a new column to the existing model while developing. Then I
run makemigrations and migrate. It is not applied to the database table
which is created based on that model. How can I fix this issue? Please help
me to complete this issue.

The below issue I am facing in deployment server after adding new field and
deployed into server.

```
psycopg2.errors.UndefinedColumn: column
shopping_ls_product_search.quality_prdct does not exist
LINE 1: ... Col1 FROM "shopping_ls_product_search" WHERE ("shopping_...
```
Thank you
~Salima

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


How to parse JSON data in python and Django

2021-06-29 Thread Salima Begum
Hi all,

>From below json data to parse this data to fetch categoryId and
categoryName in four levels of data I used for loop for fetching data and
inserting into database table. Is there any better way to do this in python
and Django?

Please Help me to achieve this. Let me know if you have any suggestions.

```
response = requests.request("GET", url, headers=headers_name, data=payload)
response.json()
json_encoded_e = json.dumps(response.json(), indent=4)
json_decode_e = json.loads(json_encoded_e)
categoryTreeId = json_decode_e["categoryTreeId"]
categoryTreeVersion = json_decode_e["categoryTreeVersion"]
rootCategoryNode = json_decode_e["rootCategoryNode"]
json_encoded_e1 = json.dumps(rootCategoryNode, indent=4)
json_decode_e1 = json.loads(json_encoded_e1)
category_1 = json_decode_e1["childCategoryTreeNodes"]
for i in category_1:
cat_id = i['category']['categoryId']
cat_name = i['category']['categoryName']
category_child = i['childCategoryTreeNodes']
saveForm = Some_data_table(categoryTreeId=categoryTreeId,
categoryTreeVersion=categoryTreeVersion,
categoryId=cat_id,
categoryName=cat_name,
parent_id=cat_id, parent_name=cat_name,
)
saveForm.save()
for child in category_child:
cat_ch_id = child['category']['categoryId']
cat_ch_name = child['category']['categoryName']
saveForm = Some_data_table(categoryTreeId=categoryTreeId,

categoryTreeVersion=categoryTreeVersion,
categoryId=cat_ch_id,
categoryName=cat_ch_name,
parent_id=cat_id,
parent_name=cat_name,
)
saveForm.save()
if 'childCategoryTreeNodes' in child:
cat_subch= child['childCategoryTreeNodes']
for subch in cat_subch:
cat_subch_id = subch['category']['categoryId']
cat_subch_name = subch['category']['categoryName']
saveForm =
Some_data_table(categoryTreeId=categoryTreeId,

categoryTreeVersion=categoryTreeVersion,
categoryId=cat_subch_id,
categoryName=cat_subch_name,
parent_id=cat_ch_id,
parent_name=cat_ch_name,
)
saveForm.save()
if 'childCategoryTreeNodes' in subch:
cat_subch_subch = subch['childCategoryTreeNodes']
for subch_subch in cat_subch_subch:
cat_subch_subch_id =
subch_subch['category']['categoryId']
cat_subch_subch_name =
subch_subch['category']['categoryName']
saveForm =
Some_data_table(categoryTreeId=categoryTreeId,

categoryTreeVersion=categoryTreeVersion,

categoryId=cat_subch_subch_id,

categoryName=cat_subch_subch_name,

parent_id=cat_subch_id, parent_name=cat_subch_name,
)
saveForm.save()

else:
continue
else:
continue

```

```
{'categoryTreeId': '0',
 'categoryTreeVersion': 'some',
 'rootCategoryNode': {'category': {'categoryId': '0', 'categoryName':
'Root'},
 'childCategoryTreeNodes':
 [{'category': {'categoryId': '1', 'categoryName': 'Collectibles'},
'parentCategoryTreeNodeHref': 'https://api.example.com/',
'childCategoryTreeNodes':
[{'category': {'categoryId': '34', 'categoryName': 'Advertising'},
'parentCategoryTreeNodeHref': 'https://api.example.com/category_id=1',
'childCategoryTreeNodes':
[{'category': {'categoryId': '36', 'categoryName': 'Soda'},
'parentCategoryTreeNodeHref': 'https://api.example.com/category_id=34',
'childCategoryTreeNodes':
[{'category': {'categoryId': '852', 'categoryName': 'Fountain'},
'parentCategoryTreeNodeHref': 'https://api.example.com/category_id=36',
'categoryTreeNodeLevel': 4, 'leafCategoryTreeNode': True},
{'category': {'categoryId': '853', 'categoryName': 'Canada Dry'},
'parentCategoryTreeNodeHref': 'https://api.example.com/category_id=36',
'categoryTreeNodeLevel': 4, 'leafCategoryTreeNode': True},
{'category': {'categoryId': '855', 'categoryName': '7 UP'},
'parentCategoryTreeNodeHref': 'https://api.example.com/category_id=36',
'categoryTreeNodeLevel': 4, 'leafCategoryTreeNode': True},
{'category': {'categoryId': '856', 'categoryName': 'Squirt'},
'parentCategoryTreeNodeHref': 'https://api.example.com/category_id=36',
'categoryTreeNodeLevel': 4, 'leafCategoryTreeNode': True},
{'category': {'categoryId': '857', 'categoryName': 'Hires Root Beer'},
'parentCategoryTreeNodeHref': 'https://api.example.com/category_id=36',
'categoryTreeNodeLevel': 4, 

How to write a v-if condition for comparing django accessed value "{{cust_package}}" and vue.js "<%radio_price%>"

2021-06-24 Thread Salima Begum
And here I am trying to write if  statement and also I have interpolated a
value in vue.js like "{{cust_package}}" accessed In django and
<%radio_price%> accessed in vue.js for both i am trying to write a if
condition like
"v-if="radio_price == {{cust_package}}" So this condition is not working so
How can we write condition for both django and vue.js. The main issue is i
want to write a if condition for both accessed value in django and vue.js I
want to compare both the value by using v-if


Django backend code
```
return render(request, 'postad.html', {'user_type': user_type,
   'cust_package': cust_package,
   'package_value': price_value,
   'cust_package_ads':
cust_package_ads})
```


from above code I have accessed cust_package into below template. And here
I am trying to write if  statement and also I have interpolated a value in
vue.js like "{{cust_package}}" accessed In django and <%radio_price%>
accessed in vue.js for both i am trying to write a if condition like
"v-if="radio_price == {{cust_package}}" So this condition is not working so
How can we write condition for both django and vue.js
```


   
  
$2.99 - 6
Ads/Month
  

  
$4.99 - 12
Ads/Month
  
   


{{cust_package}}
<%radio_price%>
*here I am trying to compare django and vue.js accessed Value using v-if
directive*

submit

```

-- 
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/CAMSz6bkKp7ckpvBis5NL_EwDoH_xE12va6NE7hd_M%2Be-jFHzog%40mail.gmail.com.


After uploading image is not displaying in production server.

2021-05-31 Thread Salima Begum
Hi all,
In my project after depl;oying into production server When i have uploaded
images it saves into media folder but not displaying image in template. As
well as when we go to the admin site and to display an image when I click
on the url of the image it is throwing an error like. url not found.

But in the media folder the image is saved and when I double click on that
image is opened. and when i upload an image from the admin site, the image
is displayed in a template.

Actually in development server uploading displaying images is working good.
After deploying into the production server I have this issue. Please help
me to solve this issue.

**settings.py**
```
# managing media
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
MEDIA_URL = '/media/'
```

Project urls.py

```
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
```

Thanks
~Salima

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


In Django project how to create app in subapp in apps folder.

2021-05-18 Thread Salima Begum
Hi all,

We initially developed our project with the following folder structure;

[image: old_folder_structure.PNG]

As shown in the above image we have developed and integrated everything
into a few files. Since the functionality is growing we are planning to
separate each functional module as an individual app folder structure
within the old app folder. I am thinking of creating an apps folder and
within the apps folder I want to create individual apps folder( just like
what is seen in the above image). So the new folder structure is created as
shown in the image below.

[image: within_app.PNG]
When I have run migrations after creating I am getting an error.
```
AttributeError: module 'oldapp.apps' has no attribute 'categories'
```

```
django.core.exceptions.ImproperlyConfigured: ' oldapp .apps' does not
contain a class 'categories'. Choices are: ' OldappConfig'.
```

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


Re: Folder structure for a Django project that has multi functional module.

2021-05-12 Thread Salima Begum
Thank you for your opinion.

On Wed, 12 May 2021, 11:37 am Ammar Mohammed,  wrote:

> Separating every functional module is the right way !
> You should build your website on a base module using oop and structural
> method.
>
> Good luck
>
>
> On Wed, May 12, 2021, 06:43 Salima Begum 
> wrote:
>
>> Hi,
>> We initially developed our project with the following folder structure;
>>
>> [image: old_folder_structure.PNG]
>>
>> As shown in the above image we have developed and integrated everything
>> into a few files. Since the functionality is growing we are planning to
>> separate each functional module as an individual app folder structure. That
>> means module A(app A)  will have its own default .py files that includes
>> its own models.py and views.py, whereas in the previous case everything is
>> under one app folder( just like what is seen in above image). So the new
>> folder structure is created as shown in the image below.
>>
>> [image: new_folder_structure.PNG]
>>
>> We think the new structure is going to have more advantages, like
>> performance, files organization and etc., but we really want to check with
>> experts in this community. We appreciate your valuable opinion and any
>> other suggestions to improve.
>>
>> Thanks
>> ~Salima
>>
>>
>> --
>> 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/CAMSz6b%3D5NLDcBwuvNn6_119T2SarYYpt0U-byv1qDYxmtRSLTA%40mail.gmail.com
>> <https://groups.google.com/d/msgid/django-users/CAMSz6b%3D5NLDcBwuvNn6_119T2SarYYpt0U-byv1qDYxmtRSLTA%40mail.gmail.com?utm_medium=email_source=footer>
>> .
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAHs1H7t7P5wPhuVSOG7kSMJSTh5cKTuU9OU6WGHjcagyVr9bEg%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAHs1H7t7P5wPhuVSOG7kSMJSTh5cKTuU9OU6WGHjcagyVr9bEg%40mail.gmail.com?utm_medium=email_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAMSz6b%3DE8HZV%3Dobu0g6y70CSX0Cq%2BkkTGdEqAOT_6jaD9za%2BTw%40mail.gmail.com.


Folder structure for a Django project that has multi functional module.

2021-05-11 Thread Salima Begum
Hi,
We initially developed our project with the following folder structure;

[image: old_folder_structure.PNG]

As shown in the above image we have developed and integrated everything
into a few files. Since the functionality is growing we are planning to
separate each functional module as an individual app folder structure. That
means module A(app A)  will have its own default .py files that includes
its own models.py and views.py, whereas in the previous case everything is
under one app folder( just like what is seen in above image). So the new
folder structure is created as shown in the image below.

[image: new_folder_structure.PNG]

We think the new structure is going to have more advantages, like
performance, files organization and etc., but we really want to check with
experts in this community. We appreciate your valuable opinion and any
other suggestions to improve.

Thanks
~Salima

-- 
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/CAMSz6b%3D5NLDcBwuvNn6_119T2SarYYpt0U-byv1qDYxmtRSLTA%40mail.gmail.com.


After user click on like button page should not refresh(redirect) and update count of likes

2021-05-04 Thread Salima Begum
When user click to like a post the web page should not refresh(redirect)
and count of the likes should be updated.
 How can I achieve this please help me.

Here is my block of code
```

   
```
views.py
```
def post_comment_like(request, id):
if (request.session.get('email') is None) or
(request.session.get('email') == ""):
return HttpResponseRedirect("/home")

email = request.session.get('email')
qury = Comment.objects.get(id=id)
obj_id = qury.object_id
qury_like = Comment_like.objects.filter(email=email)
qury_like = Comment_like.objects.filter(email=email, object_id=qury.id,
dislike_comment="1").first()
if qury_like:
qury_like.delete()
save_form = Comment_like(email=email,
user_name=request.session.get('name'),
content_type=qury.content_type,
object_id=qury.id,
content=qury.content,
flag_reply=qury.flag_reply,
flag_comment_id=qury.flag_comment_id,
flag_level=qury.flag_level,
like_comment='1')
save_form.save()
qury.like_comment = '1'
qury.dislike_comment = '0'
qury.save()
# return redirect(request.META.get('HTTP_REFERER'))
return HttpResponseRedirect(reverse('detail', args=[str(obj_id)]))
```

-- 
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/CAMSz6bnXp1Mh8h%2BXvmQ7aW-uyB9dxqHwSmMMd8LB34vw515BkQ%40mail.gmail.com.


Re: User filling form in login session if user logout and login again data of form not to lose.

2021-04-19 Thread Salima Begum
Hi sir. Thanks for the response but I did not get this. Can you please send
me any example resource


On Mon, Apr 19, 2021 at 11:20 AM boyuanl...@gmail.com 
wrote:

> You can do that by calling an endpoint in JavaScript. So when the field's
> been changed, automatically called the endpoint in Django and store it into
> the database. When a user's logged back in, just render the existing data
> if there's any.
>
> On Sunday, April 18, 2021, 10:09:29 PM PDT, Salima Begum <
> salim...@rohteksolutions.com> wrote:
>
>
> Hi all,
> Here we are trying. While user enters a value in form input fields the
> value should not clear if user logout the session and navigate from one
> page to other. After filling the form in django  if user fills some form
> fields and  suddenly user logout and if user login again then it should
> save the form data in form input field itself. How can we achieve this in
> django.
>
> --
> 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/CAMSz6b%3DiKZVQ7pGSOL-sFAHKAu6hC2cugvwcRvWEb%3DQg4rxw5A%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAMSz6b%3DiKZVQ7pGSOL-sFAHKAu6hC2cugvwcRvWEb%3DQg4rxw5A%40mail.gmail.com?utm_medium=email_source=footer>
> .
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/91167.2463416.1618811398738%40mail.yahoo.com
> <https://groups.google.com/d/msgid/django-users/91167.2463416.1618811398738%40mail.yahoo.com?utm_medium=email_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAMSz6bnK_pLSy3VW-dEBHJVOgzVrOOmko56iWmgbft_kOfGbAQ%40mail.gmail.com.


User filling form in login session if user logout and login again data of form not to lose.

2021-04-18 Thread Salima Begum
Hi all,
Here we are trying. While user enters a value in form input fields the
value should not clear if user logout the session and navigate from one
page to other. After filling the form in django  if user fills some form
fields and  suddenly user logout and if user login again then it should
save the form data in form input field itself. How can we achieve this in
django.

-- 
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/CAMSz6b%3DiKZVQ7pGSOL-sFAHKAu6hC2cugvwcRvWEb%3DQg4rxw5A%40mail.gmail.com.


AttributeError: 'customer' object has no attribute 'is_authenticated'

2021-04-01 Thread Salima Begum
Hi all,

How to solve this errors
```
AttributeError: 'customer' object has no attribute 'is_authenticated'
```

```
  AttributeError: 'customer' object has no attribute 'is_anonymous'
```

How can I solve this above errors. Help me.

Thanks
~Salima

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


Nested comments feature

2021-03-31 Thread Salima Begum
Hi all,

We are planning to add nested comments features in our web application and
are wondering whether Django FWK has a specific function or library that we
can make use of and customize it according to our application. I would
appreciate if you could share respective suggestions regarding
implementation.

Thanks
~Salima

-- 
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/CAMSz6b%3DMWd-wKDUyxcGp-zp9GmQCsmzh3swrach1aiUhuQF%3DmA%40mail.gmail.com.


How to upload image using django backend and vuejs form in front end

2021-03-15 Thread Salima Begum
Hi all,
I am trying to upload an image using vue.js and backend is django. but
while I am uploading the image its is showing path as a "fakepath". So due
to that i am unable to save the image at media folder. So how to solve this
issue.

Thanks
~Salima

-- 
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/CAMSz6bkc7CW4qux7s8-HDUGFyo3fDXBf2cLuPrQep-nZOwDQ4Q%40mail.gmail.com.


how to fix in Missing statements in pytest

2021-03-05 Thread Salima Begum
Hi all,
I am using pytest for testing my django application. I have written test
cases for models, views, urls all test cases are running successfully but
In the coverage report of pytest I am getting some missing statements. Is
there any packages or plugin to resolve this missing statements issue.

Thanks
~Salima

-- 
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/CAMSz6b%3DKGOTsJz0WqaonsBPcCMowunK%3DCE062jAPoNF07f202A%40mail.gmail.com.


Re: Log out all sessions for current user logged in

2021-02-28 Thread Salima Begum
New code for logging out all sessions of logged in users.

```

# Logout all devices in account security page.
def logoff_all(request):
try:
# Filtering all session objects.
session_query = Session.objects.all()

# Iterating session_query and fetching session key.
for s in session_query:
# Decoding session key and getting id from that.
var_id = s.get_decoded().get('id')
# Converting string to int data type.
var_id_user = int(var_id)
# Id from decode and logged in session id is same then
# delete that session key from Session table from database.
if var_id_user == request.session.get('id'):
s.flush()
messages.success(request, "All sessions are logged off successfully.")
return HttpResponseRedirect("/home")
except Exception as e:
logging.error(e)
print(e)
return HttpResponseRedirect("/home")

```
**Error**
```
'Session' object has no attribute 'flush'
```

On Sat, Feb 27, 2021 at 7:45 PM Ryan Nowakowski  wrote:

> Please reply with your new code and copy and paste the exact error message
> with full traceback.
>
> On February 26, 2021 6:40:28 PM CST, Salima Begum <
> salim...@rohteksolutions.com> wrote:
>>
>> Yes. I have tried that no it is not working and giving error like "Query
>> object doesn't contain flush()"
>>
>> On Sat, 27 Feb 2021, 12:35 am Ryan Nowakowski, 
>> wrote:
>>
>>> Have your tried my suggestion below? Did it work?
>>>
>>> On February 25, 2021 9:42:55 PM CST, Salima Begum <
>>> salim...@rohteksolutions.com> wrote:
>>>>
>>>> Logout all sessions belong to logged in user Can you please how can I
>>>> achieve this?
>>>>
>>>> Thanks
>>>> ~salima
>>>>
>>>> On Fri, Feb 26, 2021 at 4:56 AM Ryan Nowakowski 
>>>> wrote:
>>>>
>>>>> On Wed, Feb 17, 2021 at 08:23:08AM +0530, Salima Begum wrote:
>>>>> > Logout all sessions based on current user id and clear django
>>>>> sessions
>>>>> > table based on user id. It is logging off all sessions.
>>>>> >
>>>>> > ```
>>>>> > # Logout all devices in account security page.
>>>>> > def logoff_all(request):
>>>>> > try:
>>>>> >
>>>>> > # Filtering all session objects.
>>>>> > session_query = Session.objects.all()
>>>>> >
>>>>> > # Iterating session_query and fetching session key.
>>>>> > for s in session_query:
>>>>> > # Decoding session key and getting id from that.
>>>>> > var_id = s.get_decoded().get('id')
>>>>> > # Converting string to int data type.
>>>>> > var_id_user = int(var_id)
>>>>> > # Id from decode and logged in session id is same then
>>>>> > # delete that session key from Session table from
>>>>> database.
>>>>> > if var_id_user == request.session.get('id'):
>>>>> > s.delete()
>>>>> > messages.success(request, "All sessions are logged off
>>>>> > successfully.")
>>>>> > return HttpResponseRedirect("/home")
>>>>> > except Exception as e:
>>>>> > logging.error(e)
>>>>> > print(e)
>>>>> > return HttpResponseRedirect("/home")
>>>>> > ```
>>>>>
>>>>> I would call s.flush() instead of s.delete().  That's what Django's
>>>>> normal logout function does[1].
>>>>>
>>>>> [1]
>>>>> https://github.com/django/django/blob/a948d9df394aafded78d72b1daa785a0abfeab48/django/contrib/auth/__init__.py#L149
>>>>>
>>>>> --
>>>>> 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/20210225232524.GG19963%40fattuba.com
>>>>> .
>>>>>
>>>> --
&g

Re: Log out all sessions for current user logged in

2021-02-26 Thread Salima Begum
Yes. I have tried that no it is not working and giving error like "Query
object doesn't contain flush()"

On Sat, 27 Feb 2021, 12:35 am Ryan Nowakowski,  wrote:

> Have your tried my suggestion below? Did it work?
>
> On February 25, 2021 9:42:55 PM CST, Salima Begum <
> salim...@rohteksolutions.com> wrote:
>>
>> Logout all sessions belong to logged in user Can you please how can I
>> achieve this?
>>
>> Thanks
>> ~salima
>>
>> On Fri, Feb 26, 2021 at 4:56 AM Ryan Nowakowski 
>> wrote:
>>
>>> On Wed, Feb 17, 2021 at 08:23:08AM +0530, Salima Begum wrote:
>>> > Logout all sessions based on current user id and clear django sessions
>>> > table based on user id. It is logging off all sessions.
>>> >
>>> > ```
>>> > # Logout all devices in account security page.
>>> > def logoff_all(request):
>>> > try:
>>> >
>>> > # Filtering all session objects.
>>> > session_query = Session.objects.all()
>>> >
>>> > # Iterating session_query and fetching session key.
>>> > for s in session_query:
>>> > # Decoding session key and getting id from that.
>>> > var_id = s.get_decoded().get('id')
>>> > # Converting string to int data type.
>>> > var_id_user = int(var_id)
>>> > # Id from decode and logged in session id is same then
>>> > # delete that session key from Session table from database.
>>> > if var_id_user == request.session.get('id'):
>>> > s.delete()
>>> > messages.success(request, "All sessions are logged off
>>> > successfully.")
>>> > return HttpResponseRedirect("/home")
>>> > except Exception as e:
>>> > logging.error(e)
>>> > print(e)
>>> > return HttpResponseRedirect("/home")
>>> > ```
>>>
>>> I would call s.flush() instead of s.delete().  That's what Django's
>>> normal logout function does[1].
>>>
>>> [1]
>>> https://github.com/django/django/blob/a948d9df394aafded78d72b1daa785a0abfeab48/django/contrib/auth/__init__.py#L149
>>>
>>> --
>>> 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/20210225232524.GG19963%40fattuba.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/A440B5D5-3000-4004-9093-0F685D23BAD2%40fattuba.com
> <https://groups.google.com/d/msgid/django-users/A440B5D5-3000-4004-9093-0F685D23BAD2%40fattuba.com?utm_medium=email_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAMSz6bnpp90k0vr1-_iZKFVxcKbge2gv1XJJ_ztUp0Prjo-4zw%40mail.gmail.com.


Re: Log out all sessions for current user logged in

2021-02-25 Thread Salima Begum
Logout all sessions belong to logged in user Can you please how can I
achieve this?

Thanks
~salima

On Fri, Feb 26, 2021 at 4:56 AM Ryan Nowakowski  wrote:

> On Wed, Feb 17, 2021 at 08:23:08AM +0530, Salima Begum wrote:
> > Logout all sessions based on current user id and clear django sessions
> > table based on user id. It is logging off all sessions.
> >
> > ```
> > # Logout all devices in account security page.
> > def logoff_all(request):
> > try:
> >
> > # Filtering all session objects.
> > session_query = Session.objects.all()
> >
> > # Iterating session_query and fetching session key.
> > for s in session_query:
> > # Decoding session key and getting id from that.
> > var_id = s.get_decoded().get('id')
> > # Converting string to int data type.
> > var_id_user = int(var_id)
> > # Id from decode and logged in session id is same then
> > # delete that session key from Session table from database.
> > if var_id_user == request.session.get('id'):
> > s.delete()
> > messages.success(request, "All sessions are logged off
> > successfully.")
> > return HttpResponseRedirect("/home")
> > except Exception as e:
> > logging.error(e)
> > print(e)
> > return HttpResponseRedirect("/home")
> > ```
>
> I would call s.flush() instead of s.delete().  That's what Django's
> normal logout function does[1].
>
> [1]
> https://github.com/django/django/blob/a948d9df394aafded78d72b1daa785a0abfeab48/django/contrib/auth/__init__.py#L149
>
> --
> 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/20210225232524.GG19963%40fattuba.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/CAMSz6bnC0q08HP%3DNMxXqMd82UVvv9a_U2_tvUukMJYe5p5KRAw%40mail.gmail.com.


How to use .vue files in Django project

2021-02-25 Thread Salima Begum
Hi all,
I have developed a project by using django and for front end functionality
I am using vuejs so, how to use .vue files in django project in my project
.vue files are not accepting.

Thanks
~salima

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


Sorting by distance and date from classifieds page.

2021-02-24 Thread Salima Begum
Hi all,

1. After posting an Ad it will display in the classifieds page. After user
logged in user zip code and based on classifieds ad zip code distance we
are showing in classifieds page.
2. Based on distance and added date of Ad we need to show a listing in the
classifieds page.
3. within 40 miles first we need to show listings of Ads and then in that
again within 40 miles based on the added date we need to show in
classifieds page.
4. And next 80 miles and then in that added by date in the classifieds page.

Example:-
title  logged   Adzip distance  added_date

Testing post Ad   80023   80027  10.5 mi
 2021-01-2213:37:44.32801+05:30


Can anyone help me to achieve this? Thank you

Thanks
~Salima

-- 
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/CAMSz6bn%3D6wZ%2BAoLQOkM6Dxr7Bx4%2BvVKY79mq4JUvydcqOq8YDg%40mail.gmail.com.


Re: Classifieds page loading is to slow

2021-02-15 Thread Salima Begum
Thanks, How to design a database to store into a table calculated distance
API . Please Help me to achieve this thank you.

On Tue, Feb 2, 2021 at 10:59 AM Benny M  wrote:

> You could try caching your results, or even store them in the table, or
> related table. If the ads location doesn’t change, there doesn’t seem to be
> a need to call the api every single time. Additionally, if the results
> aren’t needed right away, you could queue the job of calling the api, such
> that even if the api round-trip takes a while, the user can continue
> uninterrupted, while the queued job does the work of fetching and storing
> the results.
>
> Benny
>
> On Feb 1, 2021, at 11:07 PM, Salima Begum 
> wrote:
>
> 
> Thank you everyone. We identified the issue.
> Basically we are using an API which calculates distance
> between two different ads using zip code value and this help us
> to show the distance of the ad from logged-in users location.
> So when classifies page is being loaded, this API is called for each and
> every.
> Ad and taking time to process distance calculation for each Ad.
> So we need to avoid this somehow and we are looking for any advanced
> method or package to achieve this.
>
> --
> 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/CAMSz6b%3DzPyf8_p8zxKw2DRMpcdmVeVXoAaSGnxo%2BLa4t2yaTQg%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAMSz6b%3DzPyf8_p8zxKw2DRMpcdmVeVXoAaSGnxo%2BLa4t2yaTQg%40mail.gmail.com?utm_medium=email_source=footer>
> .
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CH2PR14MB3913BDBA42CF0F356DDCD8D6C0B59%40CH2PR14MB3913.namprd14.prod.outlook.com
> <https://groups.google.com/d/msgid/django-users/CH2PR14MB3913BDBA42CF0F356DDCD8D6C0B59%40CH2PR14MB3913.namprd14.prod.outlook.com?utm_medium=email_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAMSz6b%3DRnaJourewAS7oe0O4cd6Ar8fp46vBQqkrKrWoZGLUbA%40mail.gmail.com.


How to design database for saving data into table

2021-02-15 Thread Salima Begum
Hi all,

By using API calculating Distance between two Zip codes(post codes) But
Here is my question. When user loading page always running API is not good
coding so, I want to save that into one table and show that data into
classifieds page( items listings). So, Here We are calculating distance
between logged in user zip code and Ad posted by user Zip code. In
classifieds page we have number of ads so, How can I achieve this Can any
one help me to achieve this Thank you.

```
   def classifieds(request):
global dict_time, distance_var, list_names_qury
try:
dict_time = {}
email = request.session.get('email')

list_names_qury = Wishlist_cl.objects.filter(email=email,

itegration="Classifieds").values_list('name',

  flat=True).count()
print("list_names_qury")
print(list_names_qury)
# Here we are displaying the classified ads "order by date".
The ads will be sorted by latest date.
classifieds =
classifieds.objects.filter(class_status='1').order_by('-added_date')
cl_list = list(classifieds)

for i in classifieds:
# diff_time is a child method. By passing 'i' as object in
diff_time.
difrnc_date = diff_time(i)
dict_time[i.id] = difrnc_date

qury_list = list(classifieds)
# By default first page
page = request.GET.get('page', 1)
# print("page = ", str(page))
# Per page setting 40 objects.
paginator = Paginator(list(classifieds), 40)
# print("paginator = ", str(paginator))
classified_p = paginator.page(page)
# print(classified_p)
except PageNotAnInteger:
classified_p = paginator.page(1)
except EmptyPage:
classified_p = paginator.page(paginator.num_pages)
except Exception as e:
logging.error(e)
return render(request, "classifieds.html",
  {'msg_count': msg_count_cl(email),
   'qury_list': qury_list,
   'list_names_qury':
Classifieds_list_names_count(email),
   'wishlist_names':
wishlist_names_Classifieds(email),
   "error": error, 'banners': bestDeals(),
   'form': HomeForm(), 'fullname': fullname(email),
   "Classifieds": classified_p,
   # distance parsing to classifieds page.
   "distance": classifieds_dist(email),
   'name': first_last_initial(email),
   'time': settings.SESSION_IDLE_TIMEOUT,
   'id': request.session.get('id'),
   'some_date': dict_time,

   })
return render(request, "classifieds.html", {'msg_count':
msg_count_cl(email),
'list_names_qury':
Classifieds_list_names_count(email),
'wishlist_names':
wishlist_names_Classifieds(email),
"Classifieds":
classified_p, 'qury_list': qury_list,
# distance parsing to
classifieds page.
"distance":
classifieds_dist(email),

'id':
request.session.get('id'),
'some_date': dict_time,

})

```

```

def classifieds_dist(email):
global frm, km
l1 = []
dict_distance = {}

qury = customer.objects.filter(email=email).first()
if qury:
# From above qury variable we are getting zip of customer.
frm = qury.Zip
# importing json package to calculate the distance
url = "some url"
headers = {
'Authorization': "some key",
'User-Agent': "some agent",
'Accept': "*/*",
'Cache-Control': "no-cache",
'Postman-Token': "some token",
'Host': "maps.googleapis.com",
'Accept-Encoding': "gzip, deflate",
'Connection': "keep-alive",
'cache-control': "no-cache"
}
classifieds =
classifieds.objects.filter(class_status='1').order_by('-added_date')
for i in classifieds:
# while a user login through his login email we capture his
complete detail into an variable which we given as "qury"
# and after the details are stored into the variable from there
we will filter his starting and destination point as zipcode

# After login his/her based on email we are filtering in
vk_customer table. Then storing in qury variable.

# This zip is getting from 

Re: Classifieds page loading is to slow

2021-02-01 Thread Salima Begum
Thank you everyone. We identified the issue.
Basically we are using an API which calculates distance
between two different ads using zip code value and this help us
to show the distance of the ad from logged-in users location.
So when classifies page is being loaded, this API is called for each and
every.
Ad and taking time to process distance calculation for each Ad.
So we need to avoid this somehow and we are looking for any advanced method
or package to achieve this.

-- 
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/CAMSz6b%3DzPyf8_p8zxKw2DRMpcdmVeVXoAaSGnxo%2BLa4t2yaTQg%40mail.gmail.com.


Re: Classifieds page loading is to slow

2021-01-21 Thread Salima Begum
  Hi all,

We are building website, Here I have written functionality for classifieds
page.
It is loading to slow because of We are prompting distance calculation in
classifieds page. By using distance API matrix based on logged in user zip
code and individual Ad zip codes from query set(database).

```
def classifieds(request):
global dict_time
try:
dict_time = {}
email = request.session.get('email')

# Here we are displaying the classified ads "order by date".
The ads will be sorted by latest date.
classifieds =
vk_classifieds.objects.filter(class_status='1').order_by('-added_date')

count =
vk_classifieds.objects.filter(class_status='1').order_by('-added_date').count()
for i in classifieds:
# diff_time is a child method. By passing 'i' as object in
diff_time.
difrnc_date = diff_time(i)
dict_time[i.id] = difrnc_date

# Pagination for classifieds page.
# classified = random.sample(list(classifieds), k=count)
# print("classified = ", str(classified))
# By default first page
page = request.GET.get('page', 1)
# print("page = ", str(page))
# Per page setting 40 objects.
paginator = Paginator(list(classifieds), 40)
# print("paginator = ", str(paginator))
classified_p = paginator.page(page)
# print(classified_p)
except PageNotAnInteger:
classified_p = paginator.page(1)
except EmptyPage:
classified_p = paginator.page(paginator.num_pages)
except Exception as e:
logging.error(e)
return render(request, "classifieds.html",
  {"Classifieds": classified_p,
 # distance calculation
   "distance": classifieds_dist(email),
   'some_date': dict_time,
   })
return render(request, "classifieds.html", {"Classifieds":
classified_p,
"distance":
classifieds_dist(email),
'some_date': dict_time,
})
```

```

def classifieds_dist(email):
global frm, km
dict_distance = {}

qury = vk_customer.objects.filter(email=email).first()

# From above qury variable we are getting zip of customer.
frm = qury.Zip
# importing json package to calculate the distance
url = "
https://maps.googleapis.com/maps/api/distancematrix/json?units=imperial;
headers = {
'Authorization': "Bearer somevalue",
'User-Agent': "some value",
'Accept': "*/*",
'Cache-Control': "no-cache",
'Postman-Token': "some value",
'Host': "maps.googleapis.com",
'Accept-Encoding': "gzip, deflate",
'Connection': "keep-alive",
'cache-control': "no-cache"
}
classifieds =
vk_classifieds.objects.filter(class_status='1').order_by('-added_date')
for i in classifieds:
# while a user login through his login email we capture his
complete detail into an variable which we given as "qury"
# and after the details are stored into the variable from there we
will filter his starting and destination point as zipcode

# After login his/her based on email we are filtering in
vk_customer table. Then storing in qury variable.

# This zip is getting from vk_classifieds(model in models.py) table.
# 'i' attribute is getting from classifieds() function.
to = i.zip

origin_list = [to]
desination_list = [frm]
# here we used api for calculating the source and destination point
querystring = {"origins": origin_list, "destinations":
desination_list, "departure_time": "now",
   "key": "AIzaSyDhlCiMAEEfoYhkPcOyP0PLqpHsVMmYEXM"}
# here we are passing these headers to the api

# we are capturing the response in variable called response
response = requests.request("GET", url, headers=headers,
params=querystring)
jsondata = response.text
obj = json.loads(jsondata)
list = obj['rows']
if list:
a = list[0].get('elements')
obj2 = a[0].get("distance")
if obj2 is None:
km = "None"
else:
km = obj2["text"]
dict_distance[i.id] = km
l1.append(i.id)
print("id = ", str(i.id))
print("km = ", str(km))
return dict_distance


```

Because of this loading time of classifieds page is to slow. Please help me
to solve this issue.

Thanks
~Salima

-- 
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 

[no subject]

2021-01-20 Thread Salima Begum
Hi all,

We are building website, Here I have written functionality for classifieds
page.
It is loading to slow because of We are prompting distance calculation in
classifieds page. By using distance API matrix based on logged in user zip
code and individual Ad zip codes from query set(database).

```
def classifieds(request):
global dict_time
try:
dict_time = {}
email = request.session.get('email')

# Here we are displaying the classified ads "order by date".
The ads will be sorted by latest date.
classifieds =
vk_classifieds.objects.filter(class_status='1').order_by('-added_date')

count =
vk_classifieds.objects.filter(class_status='1').order_by('-added_date').count()
for i in classifieds:
# diff_time is a child method. By passing 'i' as object in
diff_time.
difrnc_date = diff_time(i)
dict_time[i.id] = difrnc_date

# Pagination for classifieds page.
# classified = random.sample(list(classifieds), k=count)
# print("classified = ", str(classified))
# By default first page
page = request.GET.get('page', 1)
# print("page = ", str(page))
# Per page setting 40 objects.
paginator = Paginator(list(classifieds), 40)
# print("paginator = ", str(paginator))
classified_p = paginator.page(page)
# print(classified_p)
except PageNotAnInteger:
classified_p = paginator.page(1)
except EmptyPage:
classified_p = paginator.page(paginator.num_pages)
except Exception as e:
logging.error(e)
return render(request, "classifieds.html",
  {"Classifieds": classified_p,
 # distance calculation
   "distance": classifieds_dist(email),
   'some_date': dict_time,
   })
return render(request, "classifieds.html", {"Classifieds":
classified_p,
"distance":
classifieds_dist(email),
'some_date': dict_time,
})
```

```

def classifieds_dist(email):
global frm, km
dict_distance = {}

qury = vk_customer.objects.filter(email=email).first()

# From above qury variable we are getting zip of customer.
frm = qury.Zip
# importing json package to calculate the distance
url = "
https://maps.googleapis.com/maps/api/distancematrix/json?units=imperial;
headers = {
'Authorization': "Bearer somevalue",
'User-Agent': "some value",
'Accept': "*/*",
'Cache-Control': "no-cache",
'Postman-Token': "some value",
'Host': "maps.googleapis.com",
'Accept-Encoding': "gzip, deflate",
'Connection': "keep-alive",
'cache-control': "no-cache"
}
classifieds =
vk_classifieds.objects.filter(class_status='1').order_by('-added_date')
for i in classifieds:
# while a user login through his login email we capture his
complete detail into an variable which we given as "qury"
# and after the details are stored into the variable from there we
will filter his starting and destination point as zipcode

# After login his/her based on email we are filtering in
vk_customer table. Then storing in qury variable.

# This zip is getting from vk_classifieds(model in models.py) table.
# 'i' attribute is getting from classifieds() function.
to = i.zip

origin_list = [to]
desination_list = [frm]
# here we used api for calculating the source and destination point
querystring = {"origins": origin_list, "destinations":
desination_list, "departure_time": "now",
   "key": "AIzaSyDhlCiMAEEfoYhkPcOyP0PLqpHsVMmYEXM"}
# here we are passing these headers to the api

# we are capturing the response in variable called response
response = requests.request("GET", url, headers=headers,
params=querystring)
jsondata = response.text
obj = json.loads(jsondata)
list = obj['rows']
if list:
a = list[0].get('elements')
obj2 = a[0].get("distance")
if obj2 is None:
km = "None"
else:
km = obj2["text"]
dict_distance[i.id] = km
l1.append(i.id)
print("id = ", str(i.id))
print("km = ", str(km))
return dict_distance


```

Because of this loading time of classifieds page is to slow. Please help me
to solve this issue.

Thanks
~Salima

-- 
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 

Classifieds page loading is to slow

2021-01-14 Thread Salima Begum
Hi all,

We are building a Web application, We have a classifieds page that is
loading too slow. How to fix this issue. how to reduce loading time of
classifieds page.

Thanks
~Salima

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


Re: Built in views how to change in django watson package.

2020-12-09 Thread Salima Begum
Hi Omkar parab ,
I have followed the suggested path but Still it is not giving the search
results.
 what I have to write in views.py in home function.

Thanks
~salima


On Wed, Dec 9, 2020 at 3:11 PM Omkar Parab  wrote:

> Here's the link for template tag 
>
> https://github.com/etianen/django-watson/wiki/Template-tags
>
> This tag will return the searched list 
>
> {% search_results search_entry_list %}
>
>
> Here's the link for the frontend structure 
>
>
> https://github.com/etianen/django-watson/blob/master/watson/templates/watson/search_results.html
>
> Front-end code
> 
>  Search results {% if query %} for . {{query}}{%
> endif %}
>
>
> {% if search_results %}
>
> {% search_results search_results %}
>
> {% else %}
>
> {% if query %}
>
> There are no results to display.
>
> Try entering a less specific search term.
>
> {% else %}
>
> Please enter a query in the search form.
> {% endif %}
>
> {% endif %}
>
> 
>
> On Wed, Dec 9, 2020, 2:35 PM Salima Begum 
> wrote:
>
>> Thank you @Omkar Parab, I have tried your suggestion. It is working but
>> the only thing i want is how to show the result search list in the front
>> end page in template.
>>
>> Please can you help me out in this also.
>>
>> Thanks
>> ~Salima
>>
>> On Wed, Dec 9, 2020 at 11:16 AM Omkar Parab 
>> wrote:
>>
>>> Here's the link for the built-in-views,
>>>
>>> https://github.com/etianen/django-watson/wiki/Built-in-views
>>>
>>> To return search results on the home page, you need to add your,
>>>
>>> {℅ Url "your_home_namespace" ℅}
>>>
>>> in
>>>
>>> 
>>>
>>> On Wed, Dec 9, 2020, 9:35 AM Salima Begum 
>>> wrote:
>>>
>>>> Hi all,
>>>>
>>>> I am using the django watson package in my project. How to achieve to
>>>> change built in views to change default template rendering and to search
>>>> results in the home page.
>>>>
>>>> This is url of django watson
>>>>
>>>> '''https://github.com/etianen/django-watson/wiki/Built-in-views'''
>>>>
>>>> Please Help me out to achieve this, Thank you in advance,
>>>>
>>>> Thanks
>>>> ~Salima
>>>>
>>>> --
>>>> 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/CAMSz6bk2iK6X7sL25%3DDefbMxgcfzzokpW-T3yNoJgZp%3D8LN4jA%40mail.gmail.com
>>>> <https://groups.google.com/d/msgid/django-users/CAMSz6bk2iK6X7sL25%3DDefbMxgcfzzokpW-T3yNoJgZp%3D8LN4jA%40mail.gmail.com?utm_medium=email_source=footer>
>>>> .
>>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Django users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to django-users+unsubscr...@googlegroups.com.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/CAJY8mfwf_gcAM2ZnkUNbhh4VRFua-SYqo8nPMtaoPzawVk%3DGTw%40mail.gmail.com
>>> <https://groups.google.com/d/msgid/django-users/CAJY8mfwf_gcAM2ZnkUNbhh4VRFua-SYqo8nPMtaoPzawVk%3DGTw%40mail.gmail.com?utm_medium=email_source=footer>
>>> .
>>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CAMSz6bky_0Lk78ose2Fu7nCfHrz0VHH_-wiyK2K%3DP%2BO45JACYA%40mail.gmail.com
>> <https://groups.google.com/d/msgid/django-users/CAMSz6bky_0Lk78ose2Fu7nCfHrz0VHH_-wiyK2K%3DP%2BO45JACYA%40mail.gmail.com?utm_medium=email_source=footer>
>> .
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAJY8mfx5h4W62qwbv7C5G0F%2BH__XMtSm%3DnGgnmjOqe_wH1RgaA%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAJY8mfx5h4W62qwbv7C5G0F%2BH__XMtSm%3DnGgnmjOqe_wH1RgaA%40mail.gmail.com?utm_medium=email_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAMSz6bkfyfABtF0J8hfC8_YEA2qGH1qrDgOVdjg4gc%2BNEspLKQ%40mail.gmail.com.


Re: Built in views how to change in django watson package.

2020-12-09 Thread Salima Begum
Thank you @Omkar Parab, I have tried your suggestion. It is working but the
only thing i want is how to show the result search list in the front end
page in template.

Please can you help me out in this also.

Thanks
~Salima

On Wed, Dec 9, 2020 at 11:16 AM Omkar Parab  wrote:

> Here's the link for the built-in-views,
>
> https://github.com/etianen/django-watson/wiki/Built-in-views
>
> To return search results on the home page, you need to add your,
>
> {℅ Url "your_home_namespace" ℅}
>
> in
>
> 
>
> On Wed, Dec 9, 2020, 9:35 AM Salima Begum 
> wrote:
>
>> Hi all,
>>
>> I am using the django watson package in my project. How to achieve to
>> change built in views to change default template rendering and to search
>> results in the home page.
>>
>> This is url of django watson
>>
>> '''https://github.com/etianen/django-watson/wiki/Built-in-views'''
>>
>> Please Help me out to achieve this, Thank you in advance,
>>
>> Thanks
>> ~Salima
>>
>> --
>> 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/CAMSz6bk2iK6X7sL25%3DDefbMxgcfzzokpW-T3yNoJgZp%3D8LN4jA%40mail.gmail.com
>> <https://groups.google.com/d/msgid/django-users/CAMSz6bk2iK6X7sL25%3DDefbMxgcfzzokpW-T3yNoJgZp%3D8LN4jA%40mail.gmail.com?utm_medium=email_source=footer>
>> .
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAJY8mfwf_gcAM2ZnkUNbhh4VRFua-SYqo8nPMtaoPzawVk%3DGTw%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAJY8mfwf_gcAM2ZnkUNbhh4VRFua-SYqo8nPMtaoPzawVk%3DGTw%40mail.gmail.com?utm_medium=email_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAMSz6bky_0Lk78ose2Fu7nCfHrz0VHH_-wiyK2K%3DP%2BO45JACYA%40mail.gmail.com.


Built in views how to change in django watson package.

2020-12-08 Thread Salima Begum
Hi all,

I am using the django watson package in my project. How to achieve to
change built in views to change default template rendering and to search
results in the home page.

This is url of django watson

'''https://github.com/etianen/django-watson/wiki/Built-in-views'''

Please Help me out to achieve this, Thank you in advance,

Thanks
~Salima

-- 
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/CAMSz6bk2iK6X7sL25%3DDefbMxgcfzzokpW-T3yNoJgZp%3D8LN4jA%40mail.gmail.com.


How to save all fields in form in single row into the database.

2020-11-23 Thread Salima Begum
Hi,

We are trying to save fields in html form into one row into a database.

models.py

class master(models.Model):
STATUS = (
('1', 'Active'),
('0', 'InActive'),
)
question_code = models.IntegerField()
question_description = models.CharField(max_length=160)
category_id = models.IntegerField()
status = models.CharField(max_length=10, choices=STATUS, default='0')
question_type = models.CharField(max_length=160)
added_date = models.DateTimeField()

def __str__(self):
return self.questionCode

class Transaction_table(models.Model):
classifieds_id = models.IntegerField()
category_id = models.IntegerField()
question_code = models.IntegerField()
question_description = models.CharField(max_length=160)
question_answer = models.CharField(max_length=160)

def __str__(self):
return self.classifieds_id

This html form and these are fields these all fields need to save in one
row. after submitting the form. Please help me out to achieve this.


{% csrf_token %}
  Square ft:
  
  Area:
  
  Landmark:
  
  Price:
  
  Make:
  
  Model:
  
  Yearofmake:
  
  Warranty:
  
  Screensize:
  
  


I have a sample data file I am attaching below. In that format I need to
save data into the database can anyone please help me out to achieve this.


Thank you
~Salima

-- 
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/CAMSz6bkAP2oHLKRgbpCmc1eFO3rW_yiyfUK2TTaSuG-DeMY%2BOQ%40mail.gmail.com.


Sample.xlsx
Description: MS-Excel 2007 spreadsheet


pages.models.vk_ls_product_search.DoesNotExist: vk_ls_product_search matching query does not exist.

2020-10-16 Thread Salima Begum
Hi all,

I have written test case for ProductDetails_ls for views

*views.py*
  ```
class onClickSearch():

def ProductDetails_ls(request, id):
# product_ls = vk_ls_product_search.objects.get(id=id)
product_ls = get_object_or_404(vk_ls_product_search, id=id)
email = request.session.get('email')
return render(request, "productdetails_ls.html", {
'product_ls': product_ls,'msg_count': msg_count_cl(email),
  'time':
settings.SESSION_IDLE_TIMEOUT,
  'name':
first_last_initial(email),
  'fullname':
fullname(email),
  })
```

*urls.py*

*```*
 path('ProductDetails_ls/', views.onClickSearch.ProductDetails_ls,
name='ProductDetails_ls'),
*```*
*test_views.py*

*```*

@pytest.mark.django_db
class TestViews:

def test_product_detail_ls_authenticated(self):
mixer.blend('pages.vk_ls_product_search')
path = reverse('ProductDetails_ls', kwargs={'id': 19})
request = RequestFactory().get(path)
request.user = mixer.blend(vk_customer)

response = onClickSearch.ProductDetails_ls(request, id=19)
print(response)
assert response.status_code == 200
*```*

*Here, I am getting this error please anyone can help me out to solve this
error,*

*```*
=
FAILURES
=
__
TestViews.test_product_detail_ls_authenticated
__

klass = , args = (), kwargs =
{'id': 19}, queryset = ]>

def get_object_or_404(klass, *args, **kwargs):
"""
Use get() to return an object, or raise a Http404 exception if the
object
does not exist.

klass may be a Model, Manager, or QuerySet object. All other passed
arguments and keyword arguments are used in the get() query.

Like with QuerySet.get(), MultipleObjectsReturned is raised if more
than
one object is found.
"""
queryset = _get_queryset(klass)
if not hasattr(queryset, 'get'):
klass__name = klass.__name__ if isinstance(klass, type) else
klass.__class__.__name__
raise ValueError(
"First argument to get_object_or_404() must be a Model,
Manager, "
"or QuerySet, not '%s'." % klass__name
)
try:
>   return queryset.get(*args, **kwargs)

c:\users\user\appdata\local\programs\python\python38\lib\site-packages\django\shortcuts.py:76:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
_ _ _ _ _ _

self = ]>, args =
(), kwargs = {'id': 19}, clone = , limit = 21, num = 0

def get(self, *args, **kwargs):
"""
Perform the query and return a single object matching the given
keyword arguments.
"""
clone = self._chain() if self.query.combinator else
self.filter(*args, **kwargs)
if self.query.can_filter() and not self.query.distinct_fields:
clone = clone.order_by()
limit = None
if not clone.query.select_for_update or
connections[clone.db].features.supports_select_for_update_with_limit:
limit = MAX_GET_RESULTS
clone.query.set_limits(high=limit)
num = len(clone)
if num == 1:
return clone._result_cache[0]
if not num:
>   raise self.model.DoesNotExist(
"%s matching query does not exist." %
self.model._meta.object_name
)
E   pages.models.vk_ls_product_search.DoesNotExist:
vk_ls_product_search matching query does not exist.

c:\users\user\appdata\local\programs\python\python38\lib\site-packages\django\db\models\query.py:415:
DoesNotExist

During handling of the above exception, another exception occurred:

self = 

def test_product_detail_ls_authenticated(self):
mixer.blend('pages.vk_ls_product_search')
path = reverse('ProductDetails_ls', kwargs={'id': 19})
request = RequestFactory().get(path)
request.user = mixer.blend(vk_customer)

>   response = onClickSearch.ProductDetails_ls(request, id=19)

pages\tests\test_views.py:32:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
_ _ _ _ _ _
pages\views.py:2795: in ProductDetails_ls
product_ls = get_object_or_404(vk_ls_product_search, id=id)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
_ _ _ _ _ _

klass = , args = 

Re: ImportError: cannot import name 'ProductDetails' from 'pages.views'

2020-10-16 Thread Salima Begum
nClickSearch  with method
> ProductDetails . So you can't import a method of a class. To use the method
> you need to import class.
> So in place of importing  from pages.views import ProductDetails  in
> test_views.py do from pages.views import onClickSearch  & then use it's
> method as onClickSearch. ProductDetails   as per your need in your code
>
> On Friday, 16 October, 2020 at 3:33:11 pm UTC+5:30
> sali...@rohteksolutions.com wrote:
>
>> Inside pages folder I already have views.py
>>
>> Thanks
>> ~salima
>>
>> On Fri, Oct 16, 2020 at 1:28 PM Akinfolarin Stephen <
>> akinfolar...@gmail.com> wrote:
>>
>>> The problem is you are trying to import views from where you have not
>>> created it I guess the page is  a folder then create the views.py inside of
>>> it
>>>
>>> On Fri, Oct 16, 2020, 08:10 Salima Begum 
>>> wrote:
>>>
>>>> urls.py
>>>>
>>>>  path('ProductDetails/', views.onClickSearch.ProductDetails,
>>>> name='ProductDetails'),
>>>>
>>>> views.py
>>>>
>>>>
>>>> class onClickSearch():
>>>>
>>>> def ProductDetails(request, id):
>>>> try:
>>>> email = request.session.get('email')
>>>> proddtls = vk_master_table.objects.filter(id=id).first()
>>>> if proddtls:
>>>> banners = Extras().bestDeals_cat(proddtls.category_desc)
>>>>
>>>> # print(banners.product_name)
>>>> except Exception as e:
>>>> logging.error(e)
>>>> return render(request, "ProductDetails.html", {'error':
>>>> error, 'form': HomeForm(),
>>>>'time':
>>>> settings.SESSION_IDLE_TIMEOUT,
>>>>'name':
>>>> first_last_initial(email),
>>>>'msg_count':
>>>> msg_count_cl(email),
>>>>'fullname':
>>>> fullname(email), 'ProductDetails': proddtls,
>>>>
>>>>  'signinForm': SigninForm(), 'signupForm': CustomerForm()})
>>>> return render(request, "ProductDetails.html",
>>>> {'ProductDetails': proddtls, 'fbanners': banners,
>>>>        'form':
>>>> HomeForm(), 'signinForm': SigninForm(),
>>>>'name':
>>>> first_last_initial(email),
>>>>'msg_count':
>>>> msg_count_cl(email),
>>>>'fullname':
>>>> fullname(email),
>>>>'time':
>>>> settings.SESSION_IDLE_TIMEOUT,
>>>>'signupForm':
>>>> CustomerForm()})
>>>>
>>>>
>>>>
>>>>
>>>> On Fri, Oct 16, 2020 at 12:32 PM Dhwanil Shah 
>>>> wrote:
>>>>
>>>>> Can you post your views.py code
>>>>>
>>>>> On Fri, 16 Oct 2020 at 12:26, Salima Begum <
>>>>> sali...@rohteksolutions.com> wrote:
>>>>>
>>>>>> Hi all,
>>>>>> vikreya
>>>>>> mysite
>>>>>>     .cache
>>>>>> .idea
>>>>>>.pytest_cache
>>>>>> logs
>>>>>> media
>>>>>> mysite
>>>>>> __init__.py
>>>>>>manage.py
>>>>>>settings.py
>>>>>>urls.py
>>>>>>wsgi.py
>>>>>>  pages
>>>>>> .cache
>>>>>> migrations
>>>>>> static
>>>>>> templates
>>>>>> tests
>>>>>> test_views.py
>>>>>>__init__.py
>>>>>> admin.py
>>>>>> apps.py
>>>>>> cron.py
>>>>>> Forms.

Re: ImportError: cannot import name 'ProductDetails' from 'pages.views'

2020-10-16 Thread Salima Begum
Inside pages folder I already have views.py

Thanks
~salima

On Fri, Oct 16, 2020 at 1:28 PM Akinfolarin Stephen <
akinfolarinsteph...@gmail.com> wrote:

> The problem is you are trying to import views from where you have not
> created it I guess the page is  a folder then create the views.py inside of
> it
>
> On Fri, Oct 16, 2020, 08:10 Salima Begum 
> wrote:
>
>> urls.py
>>
>>  path('ProductDetails/', views.onClickSearch.ProductDetails,
>> name='ProductDetails'),
>>
>> views.py
>>
>>
>> class onClickSearch():
>>
>> def ProductDetails(request, id):
>> try:
>> email = request.session.get('email')
>> proddtls = vk_master_table.objects.filter(id=id).first()
>> if proddtls:
>> banners = Extras().bestDeals_cat(proddtls.category_desc)
>>
>> # print(banners.product_name)
>> except Exception as e:
>> logging.error(e)
>> return render(request, "ProductDetails.html", {'error':
>> error, 'form': HomeForm(),
>>'time':
>> settings.SESSION_IDLE_TIMEOUT,
>>'name':
>> first_last_initial(email),
>>'msg_count':
>> msg_count_cl(email),
>>'fullname':
>> fullname(email), 'ProductDetails': proddtls,
>>'signinForm':
>> SigninForm(), 'signupForm': CustomerForm()})
>> return render(request, "ProductDetails.html", {'ProductDetails':
>> proddtls, 'fbanners': banners,
>>'form':
>> HomeForm(), 'signinForm': SigninForm(),
>>'name':
>> first_last_initial(email),
>>'msg_count':
>> msg_count_cl(email),
>>'fullname':
>> fullname(email),
>>        'time':
>> settings.SESSION_IDLE_TIMEOUT,
>>'signupForm':
>> CustomerForm()})
>>
>>
>>
>>
>> On Fri, Oct 16, 2020 at 12:32 PM Dhwanil Shah 
>> wrote:
>>
>>> Can you post your views.py code
>>>
>>> On Fri, 16 Oct 2020 at 12:26, Salima Begum 
>>> wrote:
>>>
>>>> Hi all,
>>>> vikreya
>>>> mysite
>>>> .cache
>>>> .idea
>>>>.pytest_cache
>>>> logs
>>>> media
>>>> mysite
>>>> __init__.py
>>>>manage.py
>>>>settings.py
>>>>urls.py
>>>>wsgi.py
>>>>  pages
>>>> .cache
>>>> migrations
>>>> static
>>>> templates
>>>> tests
>>>>     test_views.py
>>>>__init__.py
>>>> admin.py
>>>> apps.py
>>>> cron.py
>>>> Forms.py
>>>>functions.py
>>>>models.py
>>>>   urls.py
>>>>   views.py
>>>>
>>>> On Fri, Oct 16, 2020 at 12:09 PM Salima Begum <
>>>> salim...@rohteksolutions.com> wrote:
>>>>
>>>>> Hi  @Akinfolarin Stephen,
>>>>>
>>>>>
>>>>>
>>>>> On Fri, Oct 16, 2020 at 11:10 AM Akinfolarin Stephen <
>>>>> akinfolarinsteph...@gmail.com> wrote:
>>>>>
>>>>>> First I will like you to tell me the folder where test.py is and
>>>>>> views.py
>>>>>>
>>>>>> On Fri, Oct 16, 2020, 06:27 Salima Begum <
>>>>>> salim...@rohteksolutions.com> wrote:
>>>>>>
>>>>>>> Hi all,
>>>>>>>
>>>>>>> I have written test case for views for details page. Here is below
>>>>>>> code I have written
>>>>>>>
>>>>>>> ```
>>>>>>> from django.test import RequestFactor

Re: ImportError: cannot import name 'ProductDetails' from 'pages.views'

2020-10-16 Thread Salima Begum
urls.py

 path('ProductDetails/', views.onClickSearch.ProductDetails,
name='ProductDetails'),

views.py


class onClickSearch():

def ProductDetails(request, id):
try:
email = request.session.get('email')
proddtls = vk_master_table.objects.filter(id=id).first()
if proddtls:
banners = Extras().bestDeals_cat(proddtls.category_desc)

# print(banners.product_name)
except Exception as e:
logging.error(e)
return render(request, "ProductDetails.html", {'error': error,
'form': HomeForm(),
   'time':
settings.SESSION_IDLE_TIMEOUT,
   'name':
first_last_initial(email),
   'msg_count':
msg_count_cl(email),
   'fullname':
fullname(email), 'ProductDetails': proddtls,
   'signinForm':
SigninForm(), 'signupForm': CustomerForm()})
return render(request, "ProductDetails.html", {'ProductDetails':
proddtls, 'fbanners': banners,
   'form': HomeForm(),
'signinForm': SigninForm(),
   'name':
first_last_initial(email),
   'msg_count':
msg_count_cl(email),
   'fullname':
fullname(email),
   'time':
settings.SESSION_IDLE_TIMEOUT,
   'signupForm':
CustomerForm()})




On Fri, Oct 16, 2020 at 12:32 PM Dhwanil Shah  wrote:

> Can you post your views.py code
>
> On Fri, 16 Oct 2020 at 12:26, Salima Begum 
> wrote:
>
>> Hi all,
>> vikreya
>> mysite
>> .cache
>> .idea
>>.pytest_cache
>> logs
>> media
>> mysite
>> __init__.py
>>manage.py
>>settings.py
>>urls.py
>>wsgi.py
>>  pages
>> .cache
>> migrations
>> static
>> templates
>> tests
>> test_views.py
>>__init__.py
>> admin.py
>> apps.py
>> cron.py
>> Forms.py
>>functions.py
>>models.py
>>   urls.py
>>   views.py
>>
>> On Fri, Oct 16, 2020 at 12:09 PM Salima Begum <
>> salim...@rohteksolutions.com> wrote:
>>
>>> Hi  @Akinfolarin Stephen,
>>>
>>>
>>>
>>> On Fri, Oct 16, 2020 at 11:10 AM Akinfolarin Stephen <
>>> akinfolarinsteph...@gmail.com> wrote:
>>>
>>>> First I will like you to tell me the folder where test.py is and
>>>> views.py
>>>>
>>>> On Fri, Oct 16, 2020, 06:27 Salima Begum 
>>>> wrote:
>>>>
>>>>> Hi all,
>>>>>
>>>>> I have written test case for views for details page. Here is below
>>>>> code I have written
>>>>>
>>>>> ```
>>>>> from django.test import RequestFactory
>>>>> from django.urls import reverse
>>>>> from django.contrib.auth.models import User
>>>>> from pages.models import vk_customer
>>>>> from mixer.backend.django import mixer
>>>>> import pytest
>>>>>
>>>>> from pages.views import ProductDetails
>>>>>
>>>>>
>>>>> @pytest.mark.django_db
>>>>> class TestViews:
>>>>>
>>>>> def test_product_detail_authenticated(self):
>>>>> mixer.blend('pages.vk_master_table')
>>>>> path = reverse('detail', kwargs={'pk': 1516})
>>>>> request = RequestFactory().get(path)
>>>>> request.user = mixer.blend(vk_customer)
>>>>>
>>>>> response = ProductDetails(request, pk=1516)
>>>>> print(response)
>>>>> assert response.status_code == 200
>>>>> ```
>>>>> *This the error i am getting.*
>>>>>  ERROR
>>>>> collecting pages/tests/test_views.py
>>>>> 
>>>>&g

Re: ImportError: cannot import name 'ProductDetails' from 'pages.views'

2020-10-16 Thread Salima Begum
Hi all,
vikreya
mysite
.cache
.idea
   .pytest_cache
logs
media
mysite
__init__.py
   manage.py
   settings.py
   urls.py
   wsgi.py
 pages
.cache
migrations
static
templates
tests
test_views.py
   __init__.py
admin.py
apps.py
cron.py
Forms.py
   functions.py
   models.py
  urls.py
  views.py

On Fri, Oct 16, 2020 at 12:09 PM Salima Begum 
wrote:

> Hi  @Akinfolarin Stephen,
>
>
>
> On Fri, Oct 16, 2020 at 11:10 AM Akinfolarin Stephen <
> akinfolarinsteph...@gmail.com> wrote:
>
>> First I will like you to tell me the folder where test.py is and views.py
>>
>> On Fri, Oct 16, 2020, 06:27 Salima Begum 
>> wrote:
>>
>>> Hi all,
>>>
>>> I have written test case for views for details page. Here is below code
>>> I have written
>>>
>>> ```
>>> from django.test import RequestFactory
>>> from django.urls import reverse
>>> from django.contrib.auth.models import User
>>> from pages.models import vk_customer
>>> from mixer.backend.django import mixer
>>> import pytest
>>>
>>> from pages.views import ProductDetails
>>>
>>>
>>> @pytest.mark.django_db
>>> class TestViews:
>>>
>>> def test_product_detail_authenticated(self):
>>> mixer.blend('pages.vk_master_table')
>>> path = reverse('detail', kwargs={'pk': 1516})
>>> request = RequestFactory().get(path)
>>> request.user = mixer.blend(vk_customer)
>>>
>>> response = ProductDetails(request, pk=1516)
>>> print(response)
>>> assert response.status_code == 200
>>> ```
>>> *This the error i am getting.*
>>>  ERROR
>>> collecting pages/tests/test_views.py
>>> 
>>> ImportError while importing test module
>>> 'H:\vikreya\mysite\pages\tests\test_views.py'.
>>> Hint: make sure your test modules/packages have valid Python names.
>>> Traceback:
>>> c:\users\user\appdata\local\programs\python\python38\lib\importlib\__init__.py:127:
>>> in import_module
>>> return _bootstrap._gcd_import(name[level:], package, level)
>>> pages\tests\test_views.py:8: in 
>>> from pages.views import ProductDetails
>>> E   ImportError: cannot import name 'ProductDetails' from 'pages.views'
>>> (H:\vikreya\mysite\pages\views.py)
>>>
>>> Please help me out to solve this error,
>>>
>>> Thank you,
>>> ~Salima
>>>
>>> --
>>> 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/CAMSz6bk187G0NSr%2Bza9RKAFnk475Z8nhxVRF%2BFk4iKtzwLXGxg%40mail.gmail.com
>>> <https://groups.google.com/d/msgid/django-users/CAMSz6bk187G0NSr%2Bza9RKAFnk475Z8nhxVRF%2BFk4iKtzwLXGxg%40mail.gmail.com?utm_medium=email_source=footer>
>>> .
>>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CAFujGLw%3DTZhX-moO6pdp3Ng%3D4LJZ2UQLfE9Y2GmOGsCpxTyVBQ%40mail.gmail.com
>> <https://groups.google.com/d/msgid/django-users/CAFujGLw%3DTZhX-moO6pdp3Ng%3D4LJZ2UQLfE9Y2GmOGsCpxTyVBQ%40mail.gmail.com?utm_medium=email_source=footer>
>> .
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAMSz6bm1WKP8qjSzSz5Ouhf%2Bc2K9-pLM4Wc%3DfgSsyUek3KKmqA%40mail.gmail.com.


Re: ImportError: cannot import name 'ProductDetails' from 'pages.views'

2020-10-16 Thread Salima Begum
Hi all,

my project structure
vikreya
mysite
.cache
.idea
.pytest_cache
logs
media
mysute
__init__.py
manage.py
settings.py
urls.py
wsgi.py
pages
.cache
migrations
static
templates
tests
test_views.py
__init__.py
admin.py
apps.py
cron.py
Forms.py
functions.py
models.py
urls.py
views.py

On Fri, Oct 16, 2020 at 12:09 PM Salima Begum 
wrote:

> Hi  @Akinfolarin Stephen,
>
>
>
> On Fri, Oct 16, 2020 at 11:10 AM Akinfolarin Stephen <
> akinfolarinsteph...@gmail.com> wrote:
>
>> First I will like you to tell me the folder where test.py is and views.py
>>
>> On Fri, Oct 16, 2020, 06:27 Salima Begum 
>> wrote:
>>
>>> Hi all,
>>>
>>> I have written test case for views for details page. Here is below code
>>> I have written
>>>
>>> ```
>>> from django.test import RequestFactory
>>> from django.urls import reverse
>>> from django.contrib.auth.models import User
>>> from pages.models import vk_customer
>>> from mixer.backend.django import mixer
>>> import pytest
>>>
>>> from pages.views import ProductDetails
>>>
>>>
>>> @pytest.mark.django_db
>>> class TestViews:
>>>
>>> def test_product_detail_authenticated(self):
>>> mixer.blend('pages.vk_master_table')
>>> path = reverse('detail', kwargs={'pk': 1516})
>>> request = RequestFactory().get(path)
>>> request.user = mixer.blend(vk_customer)
>>>
>>> response = ProductDetails(request, pk=1516)
>>> print(response)
>>> assert response.status_code == 200
>>> ```
>>> *This the error i am getting.*
>>>  ERROR
>>> collecting pages/tests/test_views.py
>>> 
>>> ImportError while importing test module
>>> 'H:\vikreya\mysite\pages\tests\test_views.py'.
>>> Hint: make sure your test modules/packages have valid Python names.
>>> Traceback:
>>> c:\users\user\appdata\local\programs\python\python38\lib\importlib\__init__.py:127:
>>> in import_module
>>> return _bootstrap._gcd_import(name[level:], package, level)
>>> pages\tests\test_views.py:8: in 
>>> from pages.views import ProductDetails
>>> E   ImportError: cannot import name 'ProductDetails' from 'pages.views'
>>> (H:\vikreya\mysite\pages\views.py)
>>>
>>> Please help me out to solve this error,
>>>
>>> Thank you,
>>> ~Salima
>>>
>>> --
>>> 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/CAMSz6bk187G0NSr%2Bza9RKAFnk475Z8nhxVRF%2BFk4iKtzwLXGxg%40mail.gmail.com
>>> <https://groups.google.com/d/msgid/django-users/CAMSz6bk187G0NSr%2Bza9RKAFnk475Z8nhxVRF%2BFk4iKtzwLXGxg%40mail.gmail.com?utm_medium=email_source=footer>
>>> .
>>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CAFujGLw%3DTZhX-moO6pdp3Ng%3D4LJZ2UQLfE9Y2GmOGsCpxTyVBQ%40mail.gmail.com
>> <https://groups.google.com/d/msgid/django-users/CAFujGLw%3DTZhX-moO6pdp3Ng%3D4LJZ2UQLfE9Y2GmOGsCpxTyVBQ%40mail.gmail.com?utm_medium=email_source=footer>
>> .
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAMSz6b%3DbFwx8O05g0xh6Nj35iVxZu72Us6CT5aTLiTAkeUGB-A%40mail.gmail.com.


Re: ImportError: cannot import name 'ProductDetails' from 'pages.views'

2020-10-16 Thread Salima Begum
Hi  @Akinfolarin Stephen,



On Fri, Oct 16, 2020 at 11:10 AM Akinfolarin Stephen <
akinfolarinsteph...@gmail.com> wrote:

> First I will like you to tell me the folder where test.py is and views.py
>
> On Fri, Oct 16, 2020, 06:27 Salima Begum 
> wrote:
>
>> Hi all,
>>
>> I have written test case for views for details page. Here is below code I
>> have written
>>
>> ```
>> from django.test import RequestFactory
>> from django.urls import reverse
>> from django.contrib.auth.models import User
>> from pages.models import vk_customer
>> from mixer.backend.django import mixer
>> import pytest
>>
>> from pages.views import ProductDetails
>>
>>
>> @pytest.mark.django_db
>> class TestViews:
>>
>> def test_product_detail_authenticated(self):
>> mixer.blend('pages.vk_master_table')
>> path = reverse('detail', kwargs={'pk': 1516})
>> request = RequestFactory().get(path)
>> request.user = mixer.blend(vk_customer)
>>
>> response = ProductDetails(request, pk=1516)
>> print(response)
>> assert response.status_code == 200
>> ```
>> *This the error i am getting.*
>>  ERROR
>> collecting pages/tests/test_views.py
>> 
>> ImportError while importing test module
>> 'H:\vikreya\mysite\pages\tests\test_views.py'.
>> Hint: make sure your test modules/packages have valid Python names.
>> Traceback:
>> c:\users\user\appdata\local\programs\python\python38\lib\importlib\__init__.py:127:
>> in import_module
>> return _bootstrap._gcd_import(name[level:], package, level)
>> pages\tests\test_views.py:8: in 
>> from pages.views import ProductDetails
>> E   ImportError: cannot import name 'ProductDetails' from 'pages.views'
>> (H:\vikreya\mysite\pages\views.py)
>>
>> Please help me out to solve this error,
>>
>> Thank you,
>> ~Salima
>>
>> --
>> 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/CAMSz6bk187G0NSr%2Bza9RKAFnk475Z8nhxVRF%2BFk4iKtzwLXGxg%40mail.gmail.com
>> <https://groups.google.com/d/msgid/django-users/CAMSz6bk187G0NSr%2Bza9RKAFnk475Z8nhxVRF%2BFk4iKtzwLXGxg%40mail.gmail.com?utm_medium=email_source=footer>
>> .
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAFujGLw%3DTZhX-moO6pdp3Ng%3D4LJZ2UQLfE9Y2GmOGsCpxTyVBQ%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAFujGLw%3DTZhX-moO6pdp3Ng%3D4LJZ2UQLfE9Y2GmOGsCpxTyVBQ%40mail.gmail.com?utm_medium=email_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAMSz6bkTxp%3DabagmH%2BzwTzhYcusXzubYOLVOkh-6wujxb5L%2B3Q%40mail.gmail.com.


ImportError: cannot import name 'ProductDetails' from 'pages.views'

2020-10-15 Thread Salima Begum
Hi all,

I have written test case for views for details page. Here is below code I
have written

```
from django.test import RequestFactory
from django.urls import reverse
from django.contrib.auth.models import User
from pages.models import vk_customer
from mixer.backend.django import mixer
import pytest

from pages.views import ProductDetails


@pytest.mark.django_db
class TestViews:

def test_product_detail_authenticated(self):
mixer.blend('pages.vk_master_table')
path = reverse('detail', kwargs={'pk': 1516})
request = RequestFactory().get(path)
request.user = mixer.blend(vk_customer)

response = ProductDetails(request, pk=1516)
print(response)
assert response.status_code == 200
```
*This the error i am getting.*
 ERROR
collecting pages/tests/test_views.py

ImportError while importing test module
'H:\vikreya\mysite\pages\tests\test_views.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
c:\users\user\appdata\local\programs\python\python38\lib\importlib\__init__.py:127:
in import_module
return _bootstrap._gcd_import(name[level:], package, level)
pages\tests\test_views.py:8: in 
from pages.views import ProductDetails
E   ImportError: cannot import name 'ProductDetails' from 'pages.views'
(H:\vikreya\mysite\pages\views.py)

Please help me out to solve this error,

Thank you,
~Salima

-- 
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/CAMSz6bk187G0NSr%2Bza9RKAFnk475Z8nhxVRF%2BFk4iKtzwLXGxg%40mail.gmail.com.


Ajax, jQuery and Django

2020-10-05 Thread Salima Begum
Hi all,
I have database of zip code for example,
INSERT INTO pages_zip_code (id, zip, city, st) VALUES
(1, '00501', 'Holtsville', 'NY'),
(2, '00544', 'Holtsville', 'NY'),
(3, '00601', 'Adjuntas', 'PR'),
(4, '00602', 'Aguada', 'PR'),
(5, '00603', 'Aguadilla', 'PR'),
(6, '00604', 'Aguadilla', 'PR'),
(7, '00605', 'Aguadilla', 'PR'),
(8, '00606', 'Maricao', 'PR'),
(9, '00610', 'Anasco', 'PR'),
(10, '00611', 'Angeles', 'PR'),
(11, '00612', 'Arecibo', 'PR'),
(12, '00613', 'Arecibo', 'PR'),
(13, '00614', 'Arecibo', 'PR'),
(14, '00616', 'Bajadero', 'PR'),
(15, '00617', 'Barceloneta', 'PR'),
(16, '00622', 'Boqueron', 'PR'),
(17, '00623', 'Cabo Rojo', 'PR'),
(18, '00624', 'Penuelas', 'PR'),
(19, '00627', 'Camuy', 'PR');
If user enters zipcode, Then state and city column should be auto fill by
using database of zip code in django and jQuery .
Please let me know how to do this.

Thank You,
~Salima

-- 
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/CAMSz6b%3DceNs7rk3zY4aNAS2MpUtAnamPi%2BzsfBx5maK9NZPo%2Bw%40mail.gmail.com.


Ajax, jQuery and Django

2020-10-05 Thread Salima Begum
Hi all,
I have database of zip code for example,
INSERT INTO pages_zip_code (id, zip, city, st) VALUES
(1, '00501', 'Holtsville', 'NY'),
(2, '00544', 'Holtsville', 'NY'),
(3, '00601', 'Adjuntas', 'PR'),
(4, '00602', 'Aguada', 'PR'),
(5, '00603', 'Aguadilla', 'PR'),
(6, '00604', 'Aguadilla', 'PR'),
(7, '00605', 'Aguadilla', 'PR'),
(8, '00606', 'Maricao', 'PR'),
(9, '00610', 'Anasco', 'PR'),
(10, '00611', 'Angeles', 'PR'),
(11, '00612', 'Arecibo', 'PR'),
(12, '00613', 'Arecibo', 'PR'),
(13, '00614', 'Arecibo', 'PR'),
(14, '00616', 'Bajadero', 'PR'),
(15, '00617', 'Barceloneta', 'PR'),
(16, '00622', 'Boqueron', 'PR'),
(17, '00623', 'Cabo Rojo', 'PR'),
(18, '00624', 'Penuelas', 'PR'),
(19, '00627', 'Camuy', 'PR');
If user enters zipcode, Then state and city column should be auto fill by
using database of zip code in django and jQuery .
Please let me know how to do this

-- 
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/CAMSz6b%3DM-_czipdp%2BpcfE6ytaweJe6Dw_ZCie4n4-VY-ZakLjg%40mail.gmail.com.


Re: capture client side location in Django

2020-09-25 Thread Salima Begum
Hi all,

I tried use https://docs.djangoproject.com/en/3.1/ref/contrib/gis/geoip2/
and This particular package requires
GeoLite2-Country.mmdb.gz
GeoLite2-City.mmdb.gz
These databases are not free. We are looking for an open source API or
package for our web application.

I appreciate if someone can share suitable pointers.

Thanks
~Salima


On Fri, Sep 25, 2020 at 2:48 AM Kasper Laudrup 
wrote:

> On 25/09/2020 06.10, Stats Student wrote:
> > You can read the client's IP address with -
> >
> > request.META['REMOTE_ADDR']  -- ( not sure how it handles proxies, etc )
> >
>
> Proxies should set the X-Forwarded-For header:
>
> https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Forwarded-For
>
> the value of which will then be used in the META dictionary.
>
> Worth noticing that it's trivially possible for any client to set that
> header as well and there's no way to reliably get the actual IP address
> of the client simply because of how HTTP works.
>
> Of course that's just a variation of "never trust the client" :-)
>
> Kind regards,
>
> Kasper Laudrup
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/c5aedd33-9611-0624-2dd4-7d3589b03c7d%40stacktrace.dk
> .
>

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


capture client side location in Django

2020-09-24 Thread Salima Begum
Hi all,

How to capture client side location in django can any one help to achieve
this?


Thank you
~Salima

-- 
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/CAMSz6bnm%3D7AjMNTpR3TowCPZjRPsVfSLTzYk%2Byo5hERmkiYfqw%40mail.gmail.com.


Account activity How to logout a particular device to logout.

2020-09-14 Thread Salima Begum
Hi all,
By using python and django.


   1. User Login with one account in different devices.
   2. If he login into another device we sent user to email. Saying that
   New device login.
   3. After we show user in his/her account activity page With that account
   how many devices are login.
   4. Then if user clicks on sign-out to a particular device then that
   particular device should be logoff and deleted from activity list.
   5. The only remain thing is that signout to a particular device.
   6. How to do signout to a particular device from his activity list.

  For example, User has 2 devices and He/She login from 2 devices with one
account. In his account activity it will show 2 devices how to signout
another device from his account activity. In python and django

Thank You in advance
~ Salima

-- 
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/CAMSz6bkQhOy8bA%3D1XgUZ6%2BXryhu0cf%3Dr%2BXGJ5UVNPZdxL6n90g%40mail.gmail.com.


Re: How to get client or user side details

2020-09-03 Thread Salima Begum
Hi, RANGA BHARATH JINKA
I need any library in python or django.

Thank you

On Wed, Sep 2, 2020 at 10:31 PM RANGA BHARATH JINKA <
bharathjink...@gmail.com> wrote:

> Hi,
>
> There is a javascript library called Detect.js
> Detect.js Github: https://github.com/darcyclarke/Detect.js
> Video Tutorial : https://youtu.be/QukFW1qymSA
>
> All the best
>
>
> On Thu, Sep 3, 2020 at 10:49 AM Salima Begum 
> wrote:
>
>> Hi,
>> We are trying to extract new login attempts done by application users
>> from new devices. That means if an application user tries to login other
>> than their regular devices ( laptop, mobile phone etc.), we need to extract
>> that particular new device details. So the details that we need are
>> 1. Browser Name
>> 2. IP address of the client's device
>> 3. Location from where login is attempted
>> 4. Date and Time Stamp
>>
>> Is there any suitable and latest package available in Django to achieve
>> the above use case?
>>
>> Thank You
>> ~ Salima
>>
>> --
>> 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/CAMSz6b%3D0-LT69BroKq3u%3DOsG5NaVNNkzoRhW5pvMuAp%2BNOrZNA%40mail.gmail.com
>> <https://groups.google.com/d/msgid/django-users/CAMSz6b%3D0-LT69BroKq3u%3DOsG5NaVNNkzoRhW5pvMuAp%2BNOrZNA%40mail.gmail.com?utm_medium=email_source=footer>
>> .
>>
>
>
> --
> Thanks and Regards
>
> J. Ranga Bharath
> cell: 9110334114
>
> --
> 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/CAK5m316WMfJPXpC9Z7Y_hsnuToReB60SKj5rgvkhM_qD_mH8AQ%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAK5m316WMfJPXpC9Z7Y_hsnuToReB60SKj5rgvkhM_qD_mH8AQ%40mail.gmail.com?utm_medium=email_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAMSz6bmtZrnx78V2qDUB-Jiyd2GkE1p2Hmb5_53Bhg18fswq3A%40mail.gmail.com.


How to get client or user side details

2020-09-02 Thread Salima Begum
Hi,
We are trying to extract new login attempts done by application users from
new devices. That means if an application user tries to login other than
their regular devices ( laptop, mobile phone etc.), we need to extract that
particular new device details. So the details that we need are
1. Browser Name
2. IP address of the client's device
3. Location from where login is attempted
4. Date and Time Stamp

Is there any suitable and latest package available in Django to achieve the
above use case?

Thank You
~ Salima

-- 
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/CAMSz6b%3D0-LT69BroKq3u%3DOsG5NaVNNkzoRhW5pvMuAp%2BNOrZNA%40mail.gmail.com.


Not found media/some.jpg

2020-07-21 Thread Salima Begum
Hi all,
Here, i am using three image fields in PostAd form. Images are not saved to
the media folder. Can anyone help me please.

In models.py

class classifieds(models.Model):
title = models.CharField(max_length=60)
description = models.CharField(max_length=600)
price = models.IntegerField()
image = models.ImageField(upload_to='photo/', null=True, blank=True)
image2 = models.ImageField(upload_to='photo/', null=True, blank=True)
image3 = models.ImageField(upload_to='photo/', null=True, blank=True)
added_date = models.DateTimeField(editable=False)
modified_date = models.DateTimeField()

In settings.py:

MEDIA_ROOT = os.path.join(BASE_DIR,'media')
MEDIA_URL = *'/media/'*

In urls.py(project urls):

urlpatterns += static(settings.MEDIA_URL,
document_root=settings.MEDIA_ROOT)

In views.py:

snippet of views.py

if request.method == 'POST':
title = request.POST['title']
description = request.POST['description']
price = request.POST['price']
image = request.POST['image']
image1 = request.POST['image1']
image2 = request.POST['image2']

I am getting this error

Thanks 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/CAMSz6bmvebQcTgy5gSviOGDSfB_8454D%2BJVetdY%3D1cqiYz9xAg%40mail.gmail.com.


Postgresql and mysql

2020-05-18 Thread Salima Begum
Hi ,
Mysql query which we used previously now we moved to postgresql,
Here is the below query in mysql , Can anyone help me to write
similar query in postgresql.

query = "LOAD DATA LOCAL INFILE '41098_category_list.txt' INTO TABLE
pages_rim_ls_categories FIELDS TERMINATED BY '|' LINES TERMINATED BY '\n' "

Thanks
~salima

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