using serializers with POST requests

2020-06-24 Thread Arpana Mehta
https://stackoverflow.com/questions/62561906/django-adding-a-new-row-in-a-table-based-on-a-foreign-key-value-using-serializ


Please visit this link!! I have posted my question with details there. It's 
super urgent.

-- 
You received this message because you are subscribed to the Google Groups 
"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/a8957681-396a-4e78-b0ae-526d577f3eb8o%40googlegroups.com.


Re: django.db.utils.ProgrammingError: relation "ops_sightseeing" already exists

2020-06-29 Thread Arpana Mehta
This is because those tables exist in your database probably. And thus when
you migrate it is showing error.

On Mon, 29 Jun 2020, 19:42 rishi kalsi,  wrote:

> Hi,
>
> I am very new to Django or to web programming.
> Somehow i have learnt from Django documentation to create models.
>
> django.db.utils.ProgrammingError: relation "ops_sightseeing" already exists
> I have deleted my entire model due to the above mentioned error
> after deleting I ran makemigrations which was fine.
>
> but when i run migrate it gives this error
>
> django.db.utils.ProgrammingError: relation "ops_sightseeing" already exists
>
>
> Please help me on this
>
>
> Regards
>
> Rishi
>
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "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/32eca0bd-4276-469c-9f3d-013a14c07049n%40googlegroups.com
> 
> .
>

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


Re: django.db.utils.ProgrammingError: relation "ops_sightseeing" already exists

2020-06-29 Thread Arpana Mehta
You are right sir. Perhaps, if we could see the settings and models file..
it would help

On Mon, 29 Jun 2020 at 23:30, maninder singh Kumar <
maninder.s.ku...@gmail.com> wrote:

> This could be a case for cleaning the database up.  Is there kinda too
> much data in it,  and which one is it ?
>
> Normally when you use multiple databases,  the routers could also cause
> the problem
>
> Without knowing all this and the code,  it might be difficult to take a
> decision
>
> Regds
>
> Sent from my iPhone
>
> On Jun 29, 2020, at 11:17 PM, Arpana Mehta 
> wrote:
>
> This is because those tables exist in your database probably. And thus
> when you migrate it is showing error.
>
> On Mon, 29 Jun 2020, 19:42 rishi kalsi, 
> wrote:
>
>> Hi,
>>
>> I am very new to Django or to web programming.
>> Somehow i have learnt from Django documentation to create models.
>>
>> django.db.utils.ProgrammingError: relation "ops_sightseeing" already
>> exists
>> I have deleted my entire model due to the above mentioned error
>> after deleting I ran makemigrations which was fine.
>>
>> but when i run migrate it gives this error
>>
>> django.db.utils.ProgrammingError: relation "ops_sightseeing" already
>> exists
>>
>>
>> Please help me on this
>>
>>
>> Regards
>>
>> Rishi
>>
>>
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "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/32eca0bd-4276-469c-9f3d-013a14c07049n%40googlegroups.com
>> <https://groups.google.com/d/msgid/django-users/32eca0bd-4276-469c-9f3d-013a14c07049n%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAGyqUuUVoVSf%2BafLLsviHrqs8HfUic3OJzr36nAVvAAAx-G_eA%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAGyqUuUVoVSf%2BafLLsviHrqs8HfUic3OJzr36nAVvAAAx-G_eA%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/346676BD-D5F3-4846-B74E-B938EC088A08%40gmail.com
> <https://groups.google.com/d/msgid/django-users/346676BD-D5F3-4846-B74E-B938EC088A08%40gmail.com?utm_medium=email&utm_source=footer>
> .
>

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


Re: Custom-DRF-Response

2020-07-04 Thread Arpana Mehta
You can use a function which

returns Response({'status': 'SUCCESS'})

On Sat, 4 Jul 2020, 03:24 Ronaldo Mata,  wrote:

> Hi Guys
>
> Somebody can help me?
>
> I want to create a custom response with the follow format:
>
> {
>   "status": true,
>   "message": "Any message",
>   "data": []}
>
>
> but I don't want create a custom_response function because I must to
> modified all Api class based views response. What is the best way to deal
> with 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/CAP%3DoziQW9yHM74Pyc2bYzik0RJFQua1-qWNuE%2B%2B4OU%2BGoutRZA%40mail.gmail.com
> 
> .
>

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


Re: how to give permission to a logged in specific user in a list of users profile

2020-07-05 Thread Arpana Mehta
You can user permission classes in your code. Or decorators before the
function view you want to be only visible to logged in users.

from django.contrib.auth.decorators import login_required


@login_required

def your_view_here(request):



On Mon, 6 Jul 2020 at 01:28, Exactly musty  wrote:

> how can i specify a user in django templates, for example i have a page
> which consist of list of users available but i want it to show "Talk to a
> patient" for only the logged in user on his own profile here is what am
> saying in picture and here is my code, i actually don't know how to put the
> code i have tried many code but it does show Talk to a patient for every
> users or it wont show at all,i attached a picture to it,that shows what am
> saying,i checked the doc but couldn't find anything to use,so i wanted to
> try the custom templates tags,but i still don't how to comport the code in
> the templatetags views
>
> *Models.py*
>
>
>
> class Doctor(models.Model):
> GENDER_CHOICES = (
> ('Male', 'Male'),
> ('Female', 'Female'),
> )
> user = models.OneToOneField(CustomUser, on_delete=models.CASCADE, null=
> True, related_name="doctor")
> image = models.ImageField(default='jazeera.jpg', upload_to='
> profile_pics')
> full_name = models.CharField(max_length=100)
> bio = models.TextField()
> speciality = models.CharField(max_length=300)
> describtion = models.CharField(max_length=100)
> status = models.ManyToManyField(Status)
> gender = models.CharField(max_length=6, choices=GENDER_CHOICES)
> location = models.CharField(max_length=100)
> certification = models.CharField(max_length=300)
> place_of_work = models.CharField(max_length=300)
>
>
>
>
>
> *##template*
> {% if request.user == doctor %}
> Talk to a Patient
>   {% 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/4278d2eb-53a1-4b9c-89fa-a5d09f96c458o%40googlegroups.com
> 
> .
>

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


Re: how to give permission to a logged in specific user in a list of users profile

2020-07-05 Thread Arpana Mehta
https://www.django-rest-framework.org/tutorial/4-authentication-and-permissions/
[image: Screenshot from 2020-07-06 03-15-34.png]

On Mon, 6 Jul 2020 at 03:13, Arpana Mehta  wrote:

> You can user permission classes in your code. Or decorators before the
> function view you want to be only visible to logged in users.
>
> from django.contrib.auth.decorators import login_required
>
>
> @login_required
>
> def your_view_here(request):
>
>
>
> On Mon, 6 Jul 2020 at 01:28, Exactly musty 
> wrote:
>
>> how can i specify a user in django templates, for example i have a page
>> which consist of list of users available but i want it to show "Talk to a
>> patient" for only the logged in user on his own profile here is what am
>> saying in picture and here is my code, i actually don't know how to put the
>> code i have tried many code but it does show Talk to a patient for every
>> users or it wont show at all,i attached a picture to it,that shows what am
>> saying,i checked the doc but couldn't find anything to use,so i wanted to
>> try the custom templates tags,but i still don't how to comport the code in
>> the templatetags views
>>
>> *Models.py*
>>
>>
>>
>> class Doctor(models.Model):
>> GENDER_CHOICES = (
>> ('Male', 'Male'),
>> ('Female', 'Female'),
>> )
>>
>> user = models.OneToOneField(CustomUser, on_delete=models.CASCADE, null=
>> True, related_name="doctor")
>> image = models.ImageField(default='jazeera.jpg', upload_to='
>> profile_pics')
>> full_name = models.CharField(max_length=100)
>> bio = models.TextField()
>> speciality = models.CharField(max_length=300)
>> describtion = models.CharField(max_length=100)
>> status = models.ManyToManyField(Status)
>> gender = models.CharField(max_length=6, choices=GENDER_CHOICES)
>> location = models.CharField(max_length=100)
>> certification = models.CharField(max_length=300)
>> place_of_work = models.CharField(max_length=300)
>>
>>
>>
>>
>>
>> *##template*
>> {% if request.user == doctor %}
>> Talk to a Patient
>>   {% 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/4278d2eb-53a1-4b9c-89fa-a5d09f96c458o%40googlegroups.com
>> <https://groups.google.com/d/msgid/django-users/4278d2eb-53a1-4b9c-89fa-a5d09f96c458o%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>

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


Using primary key to update via POST request.

2020-07-19 Thread Arpana Mehta
Hi,
I have a class with a GET and a POST request. I am sending the data ( with
pk of the object ) in my GET request and I want the frontend to use that pk
to refer to the exact instance of the model whenever doing any operation.

In my POST request I am only sending the `choice field` value. How do I use
the pk received in GET?

Thanks and regards,
Arpana Mehta

-- 
You received this message because you are subscribed to the Google Groups 
"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/CAGyqUuV%3DAeyL4N8XOsU6PsTQ8udfQBf5%3D2evzPG-PRCuhsR1_w%40mail.gmail.com.


Re: Invalid syntax on line 16 of manage.py

2020-07-20 Thread Arpana Mehta
Creating a virtual environment and then working might solve this issue.

On Mon, 20 Jul 2020 at 15:28, Douglas Ii  wrote:

> While following the tutorial for creating your first Django app, I run
> into a problem when entering the command line "python manage.py runserver"
> into my terminal. I am using a mac and I get the Error message:
>
>
> File "manage.py", line 16
>
> ) from exc
>
>  ^
>
> SyntaxError: invalid syntax
>
>
> What can I do to resolve this issue
>
> --
> You received this message because you are subscribed to the Google Groups
> "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/834b6043-1440-48a6-9d86-a22322f10847o%40googlegroups.com
> 
> .
>

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


Re: Why Django ValidationError not raising error?

2020-08-20 Thread Arpana Mehta
You can try

forming.is_valid(raise_exception=True)


On Thu, 20 Aug 2020 at 19:29, Ahmed Yasin  wrote:

>
> Well I believe you are more expert and experienced personality than me. I
> am having an error and i am using django 3.0.3 and python 3.8.5 and VS code
> as an IDE. I am using validationError to raise error. in forms.py i am
> using condition if email and varify_email fields are not match than raise
> error but its not raising error I am so tired and getting no help from
> anywhere.
>
> here is my code ___
>
> --forms.py---
> class FormName(forms.Form):
>   name = forms.CharField( required=True)
>   email = forms.EmailField( required=True)
>   vmail = forms.EmailField( required=True)
>   text = forms.CharField(widget = forms.Textarea)
>
> def clean(value):
>cleaned_data = super().clean()
>name = cleaned_data.get("name")
>email = cleaned_data.get("email")
>vmail = cleaned_data.get("vmail")
>if email != vmail:
>raise ValidationError("Emails are not match")
>
> views.py-
>
> def forms_web(request):
>forming = forms.FormName()
>if request.method == 'POST':
>forming = forms.FormName(request.POST)
>if forming.is_valid():
>
>
>
>
>
>
> #
>
> --
> You received this message because you are subscribed to the Google Groups
> "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/2ad02f2f-68ff-4d65-bb3b-7d01caa1f5dbn%40googlegroups.com
> 
> .
>

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


URGENT ---- Third party API integration basics

2020-08-21 Thread Arpana Mehta
Hello everybody,
I wanted to know if there's anybody who can help me integrate a very simple
third party API using client ID and secret key.

I just want to know the basic steps of where to add the key and ID in
settings file so I can access that API from my app in django-project.

*It's kind of urgent. Any help will be appreciated.*
Many thanks,
Arpana Mehta

-- 
You received this message because you are subscribed to the Google Groups 
"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/CAGyqUuW-zx8-cfVt0Oq%2B3E9WwcA8w%3DgsKg3xjtC9-vvuR9pHfw%40mail.gmail.com.


Re: URGENT ---- Third party API integration basics

2020-08-21 Thread Arpana Mehta
Thanks a lot for the super fast response! 🤩

On Fri, 21 Aug 2020, 15:40 RANGA BHARATH JINKA, 
wrote:

> Hi,
>
> create a variable like APIKEY = 'value' in settings.py.
> If you want to access that api key in views just use this import "from
> django.conf import settings"
> In views.py:
>   api_key = settings.APIKEY
>
>All the best.
>
> On Fri, Aug 21, 2020 at 3:33 PM Ogunsanya Opeyemi <
> ogunsanyaopeye...@gmail.com> wrote:
>
>> You just need to add define the key in your settings file Key_Name= "key"
>> OGUNSANYA OPEYEMI
>>
>>
>> On Fri, Aug 21, 2020 at 10:55 AM Arpana Mehta 
>> wrote:
>>
>>> Hello everybody,
>>> I wanted to know if there's anybody who can help me integrate a very
>>> simple third party API using client ID and secret key.
>>>
>>> I just want to know the basic steps of where to add the key and ID in
>>> settings file so I can access that API from my app in django-project.
>>>
>>> *It's kind of urgent. Any help will be appreciated.*
>>> Many thanks,
>>> Arpana Mehta
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "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/CAGyqUuW-zx8-cfVt0Oq%2B3E9WwcA8w%3DgsKg3xjtC9-vvuR9pHfw%40mail.gmail.com
>>> <https://groups.google.com/d/msgid/django-users/CAGyqUuW-zx8-cfVt0Oq%2B3E9WwcA8w%3DgsKg3xjtC9-vvuR9pHfw%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CABJxPrHhY0pGi9MoEQz7CHcdkFGmdWoz87BtG5Ky4SaQ_dtFFg%40mail.gmail.com
>> <https://groups.google.com/d/msgid/django-users/CABJxPrHhY0pGi9MoEQz7CHcdkFGmdWoz87BtG5Ky4SaQ_dtFFg%40mail.gmail.com?utm_medium=email&utm_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/CAK5m316arXyCUwcvvjRzRVv3-xAAvttCRUgmv6AqkqJ6dCuSWw%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAK5m316arXyCUwcvvjRzRVv3-xAAvttCRUgmv6AqkqJ6dCuSWw%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>

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


Re: URL configuration error for a beginner

2020-08-31 Thread Arpana Mehta
You need to replace apps.url with the name of the app ( which you might
have created using python manage.py startapp  and have a urls.py
file in that app folder)
 In the tutorial also, they first create an app 'polls' and then include
'polls.url'

It would be easier to solve your problem if you can post the directory
structure here.

Regards,
Arpana

On Tue, 1 Sep 2020 at 04:29, Manal Helal  wrote:

> Hi
>
> I am using DJango to the first time and appreciate some explanation to the
> error I am receiving. I followed the steps in the polls app tutorial:
>
> https://docs.djangoproject.com/en/3.1/intro/tutorial01/
>
> and getting the following error when running: python manage.py runserver
>
> *path('app/', include('app.urls')),*
>
> *  File
> "/home/me/website/venv/lib/python3.8/site-packages/django/urls/conf.py",
> line 34, in include*
>
> *urlconf_module = import_module(urlconf_module)*
>
> *  File "/home/me/opt/python-3.8.1/lib/python3.8/importlib/__init__.py",
> line 127, in import_module*
>
> *return _bootstrap._gcd_import(name[level:], package, level)*
>
> *  File "", line 1014, in _gcd_import*
>
> *  File "", line 991, in _find_and_load*
>
> *  File "", line 973, in
> _find_and_load_unlocked*
>
> *ModuleNotFoundError: No module named 'app.urls'*
>
> I tried adding
>
> from app import views
>
>
> but not working and I am obviously have a long way understanding the
> classes and directory structure of Django and appreciate a clarification to
> make things easier,
>
>
> thank you in advance
>
>
> Manal
>
> --
> You received this message because you are subscribed to the Google Groups
> "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/a0c75269-ad22-4860-b6bd-3b9f69b8cfd7n%40googlegroups.com
> 
> .
>

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


Re: Error configuring URLs for a beginner

2020-08-31 Thread Arpana Mehta
Do you have a *urls.py* in your 'app' folder? (And app is a reserved
keyword, it would be better if you use some other name to avoid confusion
even later )

On Tue, 1 Sep 2020 at 04:29, Manal Helal  wrote:

> Hi
>
> I am using Django to the first time and followed the tutorial in:
> https://docs.djangoproject.com/en/3.1/intro/tutorial01/
>
> I changes the mysite and polls app to different project and app names, and
> followed the instructions
>
> I ended up with the following error when I run python manage.py runserver:
>
> *File "/home/me/website.com/project/project/urls.py
> ", line 21, in *
>
> *path('app/', include('app.urls')),*
>
> *  ...*
>
> *urlconf_module = import_module(urlconf_module)*
>
> * ...*
>
> *ModuleNotFoundError: No module named 'app.urls'*
>
>
> app is what is created by python3 manage.py startapp app
>
> and project is what is created by python3 venv/bin/django-admin.py
> startproject project
>
>
> can you please explain to me how to resolve? I am trying to read through
> different documentation of URL resolution and tried
>
> from app import views
>
> or
>
> from app import urls
>
>
> and did not work. It seems I have a long way to get used to the directory
> structure and naming convention and appreciate a jump start please
>
>
> thank you,
>
>
> Manal
>
> --
> You received this message because you are subscribed to the Google Groups
> "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/f8b13b31-3eac-4bda-88f4-559256b67eafn%40googlegroups.com
> 
> .
>

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


Re: Calculated feild in models

2020-09-19 Thread Arpana Mehta
You can use @property

On Sat, 19 Sep 2020, 20:45 eankomah,  wrote:

> I have two fields:
> quantity = models.FloatField()
> unit_price = models.FloatField()
>
> and i want ot do someting like this
>
>
> total_price = models.FloatField('unit_price' * 'quantity')
>
> Thanks
>
> --
> You received this message because you are subscribed to the Google Groups
> "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/a7844b0c-1db7-4c13-911d-e2e80e9a7bf6n%40googlegroups.com
> 
> .
>

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


Re: How to consume DJango Rest Api with DJango?

2020-10-04 Thread Arpana Mehta
You can googlle about `mixin` classes in Django

CreateUpdateRetrieve mixins class along with your template or API view.

On Thu, 1 Oct 2020, 05:10 Stalin Vladimir Gomez Gutierrez, <
stanleyni...@gmail.com> wrote:

> I am trying to consume a django api with django itself. Should I use class
> generic
> views or normal views. Do you know what is the best approach?
>
> Right now, to list items I am using TemplateView
>
> class RegionListView(TemplateView):
> template_name = 'region/list.html'
>
> def get(self,request):
> r = requests.get('http://127.0.0.1:8081/regions')
> regions = r.json()
> region_list = {'regions':regions}
> return render(request, self.template_name, region_list)
>
> I need help to implement create and update views to use my api methods. Do
> you guys have any idea?
>
> --
> You received this message because you are subscribed to the Google Groups
> "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/03abb212-8408-4fd7-8c5f-b78e9402bf38n%40googlegroups.com
> 
> .
>

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


API to stop/resume/terminate a long running task

2020-10-12 Thread Arpana Mehta
Hello everybody,
I am here looking for a solution to a problem commonly faced maybe.

I have like a huge amount of data that is being uploaded in a go. While I
can keep these upload tasks under atomic decorators to avoid systemic
failure but I don't have way to let the user stop the task and resume or
terminate it later.

I would need suggestions on how to go about this workflow.

Would love details in the flow. I understand the basic mechanism myself but
I want to write APIs to stop or resume any running bulk write/read task in
my system.

Thanks and regards,
Arpana

-- 
You received this message because you are subscribed to the Google Groups 
"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/CAGyqUuWfaa0_ME%2BHjQx8b6nKyB0g54F0OtA8DrEvzwpqxJ013g%40mail.gmail.com.


Re: I have one doubt

2021-04-30 Thread Arpana Mehta
Can you share the error stack in more detail? Or a screenshot?

On Thu, 29 Apr 2021, 19:53 Bheemanagowda S Gowdra, 
wrote:

> I am knew to Django
>
> I am getting below warning
>
> unresolved import 'django.contrib'
>
> --
> You received this message because you are subscribed to the Google Groups
> "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/fa706c85-e903-4c8c-a73d-0b4ddedc424bn%40googlegroups.com
> 
> .
>

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