Saturday, February 29, 2020

Re: Running django admin separately

My main aim is to run separate instances of the django.admin and drf API

On Sun, Mar 1, 2020, 04:23 Stephen J. Butler <stephen.butler@gmail.com> wrote:
I think so. Haven't tested, one way should be be to have have two url.py's, one that includes only the admin URLs and one that includes only your project URLs. Then have two settings modules that look like this:

# main site settings
from .settings import *
ROOT_URLCONF = 'myproject.urls_main'


# admin site settings
from .settings import *
ROOT_URLCONF = 'myproject.urls_admin'

If you want to get even fancier you can also use the sites module support to define two different sites and set the SITE_ID in each setting file too. Although you probably don't need that.

On Sat, Feb 29, 2020 at 6:58 PM Agumba <paul.agumba@gmail.com> wrote:
Hello django users is there a way i can run django-admin separately from the main site like separate instances......any help will be appreciated 

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/4d497c5e-55dd-4074-b733-c6e6e2d8b09a%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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAD4ANxVHygN9UOfjySfWuAX%3DTbJykpOr_B_aRL_LLvsZpkh6rQ%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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAMyxNXh70gaDyqxeBVe-%3DKQsb1pv_WCxE59mwbPAVXapFOCkGg%40mail.gmail.com.

Re: Database connection not pointing to the correct database backend

Try using pymysql... Add the following in your project root __init__.py ie. 

`import pymysql
pymysql.version_info = (1, 3, 13, "final", 0)
pymysql. install_as_MySQLdb() `

On Sun, Mar 1, 2020, 07:34 karthik s <julykarthik09@gmail.com> wrote:
Hi cam, 
well I solved same problem by removing virtual environment and reinstalling all the packages again.

it worked for me then, I have now access to mysql database  .. 
afterthat you have python 2.xx version pip install <packages>
otherwise python3.xx version pip3 install <packages> 

On Sun, Mar 1, 2020 at 1:51 AM Cam <ctd1077@gmail.com> wrote:
I'm running Ubuntu and I'm trying to create a small web-app connecting to a mysql database. (I've also tried sql-server database and had the same issue)

It took me awhile the first time I did this but I was able to get it to work using
 'ENGINE': 'mysql.connector.django',


This time around I'm doing the same thing with the same database but I want to use 
'ENGINE': 'django.db.backends.mysql',


Here are the packages I've installed
pip freeze
asgiref
==3.2.3
Django==3.0
django
-mysql==3.3.0
dnspython
==1.16.0
mysqlclient
==1.4.6
protobuf
==3.6.1
PyMySQL==0.9.3
pyodbc
==4.0.28
pytz
==2019.3
six
==1.14.0
sqlparse
==0.3.0


settings.py:

DATABASES = {
   
'default': {
       
'NAME': 'inventory',
       
'ENGINE': 'django.db.backends.mysql',
       
'HOST': 'localhost',
       
'USER': 'root',
       
'PASSWORD': 'xxxx',
       
'PORT': '3306',

   
}
}




However I'm still getting this error when trying to run migrate:
Traceback (most recent call last):
 
File "/home/cam/.local/share/virtualenvs/Parts_Project-YIqPqjtZ/lib/python3.6/site-packages/django/db/utils.py", line 111, in load_backend
   
return import_module('%s.base' % backend_name)
....
django
.core.exceptions.ImproperlyConfigured: 'django.db.backends.mysql' isn't an available database backend.
Try using '
django.db.backends.XXX', where XXX is one of:
    '
oracle', 'postgresql', 'sqlite3'




I've searched this problem over and over again online, 

none of these solutions have worked for me. 

I've obviously not pointing to the correct database backend.



Any ideas?

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/3ecf8944-b73d-480a-9875-ffe12a71224c%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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CA%2BU0cJJhzWha8kFJfC53e6mGVs2KBKzBK5__tKPWpUrx-LfiBQ%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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAMyxNXg_GX-V_y-7f8k%2Bv%3DJGFtrsbW%2Bua4eTcCp%3DXpMhBN_9RA%40mail.gmail.com.

Re: Database connection not pointing to the correct database backend

Hi cam, 
well I solved same problem by removing virtual environment and reinstalling all the packages again.

it worked for me then, I have now access to mysql database  .. 
afterthat you have python 2.xx version pip install <packages>
otherwise python3.xx version pip3 install <packages> 

On Sun, Mar 1, 2020 at 1:51 AM Cam <ctd1077@gmail.com> wrote:
I'm running Ubuntu and I'm trying to create a small web-app connecting to a mysql database. (I've also tried sql-server database and had the same issue)

It took me awhile the first time I did this but I was able to get it to work using
 'ENGINE': 'mysql.connector.django',


This time around I'm doing the same thing with the same database but I want to use 
'ENGINE': 'django.db.backends.mysql',


Here are the packages I've installed
pip freeze
asgiref
==3.2.3
Django==3.0
django
-mysql==3.3.0
dnspython
==1.16.0
mysqlclient
==1.4.6
protobuf
==3.6.1
PyMySQL==0.9.3
pyodbc
==4.0.28
pytz
==2019.3
six
==1.14.0
sqlparse
==0.3.0


settings.py:

DATABASES = {
   
'default': {
       
'NAME': 'inventory',
       
'ENGINE': 'django.db.backends.mysql',
       
'HOST': 'localhost',
       
'USER': 'root',
       
'PASSWORD': 'xxxx',
       
'PORT': '3306',

   
}
}




However I'm still getting this error when trying to run migrate:
Traceback (most recent call last):
 
File "/home/cam/.local/share/virtualenvs/Parts_Project-YIqPqjtZ/lib/python3.6/site-packages/django/db/utils.py", line 111, in load_backend
   
return import_module('%s.base' % backend_name)
....
django
.core.exceptions.ImproperlyConfigured: 'django.db.backends.mysql' isn't an available database backend.
Try using '
django.db.backends.XXX', where XXX is one of:
    '
oracle', 'postgresql', 'sqlite3'




I've searched this problem over and over again online, 

none of these solutions have worked for me. 

I've obviously not pointing to the correct database backend.



Any ideas?

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/3ecf8944-b73d-480a-9875-ffe12a71224c%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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CA%2BU0cJJhzWha8kFJfC53e6mGVs2KBKzBK5__tKPWpUrx-LfiBQ%40mail.gmail.com.

Re: Running django admin separately

I think so. Haven't tested, one way should be be to have have two url.py's, one that includes only the admin URLs and one that includes only your project URLs. Then have two settings modules that look like this:

# main site settings
from .settings import *
ROOT_URLCONF = 'myproject.urls_main'


# admin site settings
from .settings import *
ROOT_URLCONF = 'myproject.urls_admin'

If you want to get even fancier you can also use the sites module support to define two different sites and set the SITE_ID in each setting file too. Although you probably don't need that.

On Sat, Feb 29, 2020 at 6:58 PM Agumba <paul.agumba@gmail.com> wrote:
Hello django users is there a way i can run django-admin separately from the main site like separate instances......any help will be appreciated 

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/4d497c5e-55dd-4074-b733-c6e6e2d8b09a%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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAD4ANxVHygN9UOfjySfWuAX%3DTbJykpOr_B_aRL_LLvsZpkh6rQ%40mail.gmail.com.

Running django admin separately

Hello django users is there a way i can run django-admin separately from the main site like separate instances......any help will be appreciated 

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

Database connection not pointing to the correct database backend

I'm running Ubuntu and I'm trying to create a small web-app connecting to a mysql database. (I've also tried sql-server database and had the same issue)

It took me awhile the first time I did this but I was able to get it to work using
 'ENGINE': 'mysql.connector.django',


This time around I'm doing the same thing with the same database but I want to use 
'ENGINE': 'django.db.backends.mysql',


Here are the packages I've installed
pip freeze
asgiref
==3.2.3
Django==3.0
django
-mysql==3.3.0
dnspython
==1.16.0
mysqlclient
==1.4.6
protobuf
==3.6.1
PyMySQL==0.9.3
pyodbc
==4.0.28
pytz
==2019.3
six
==1.14.0
sqlparse
==0.3.0


settings.py:

DATABASES = {
   
'default': {
       
'NAME': 'inventory',
       
'ENGINE': 'django.db.backends.mysql',
       
'HOST': 'localhost',
       
'USER': 'root',
       
'PASSWORD': 'xxxx',
       
'PORT': '3306',

   
}
}




However I'm still getting this error when trying to run migrate:
Traceback (most recent call last):
 
File "/home/cam/.local/share/virtualenvs/Parts_Project-YIqPqjtZ/lib/python3.6/site-packages/django/db/utils.py", line 111, in load_backend
   
return import_module('%s.base' % backend_name)
....
django
.core.exceptions.ImproperlyConfigured: 'django.db.backends.mysql' isn't an available database backend.
Try using '
django.db.backends.XXX', where XXX is one of:
    '
oracle', 'postgresql', 'sqlite3'




I've searched this problem over and over again online, 

none of these solutions have worked for me. 

I've obviously not pointing to the correct database backend.



Any ideas?

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

Validating OneToOne related forms in single Django View

Hi All,

Can someone kindly guide me to right direction I am new to Django and I've been trying whole day for this now. 

Question is posted on Stackoverflow with link below.


Regards,

Zaheer

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

Re: Serializing forms and formsets to pass to Celery task

Hi Bernd,

You could take a look at serializers section on Note part, for more information, and may be your own answer.






On Sat, Feb 29, 2020, 23:56 Naveen Arora <naveenarorakrnl@gmail.com> wrote:
Yes that would work well. You can always find a completely different way of achieving what you are trying to achieve.

On Saturday, 29 February 2020 18:52:24 UTC+5:30, Jason wrote:
As said before, you really can't do that too well with celery.  Its a good practice to keep the message body between django -> broker -> worker to be as small as possible because we don't know what your configuration for the broker is.  In addition, you should never, ever, put sensitive information in a message, just the identifier of a thing and let celery/django pull from a data store when the task starts.

what I would do is save the form data to some intermediate data store, and pass in the identifier to the celery task for retrieval.  That ensures your data integrity and security is high.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/3f1b4374-ca68-4fcd-a33a-555bc72cbae8%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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAP5HUWoh-tyPwwZviSpzu85G_eawSRkhnuDp5AzgkbW5zeogxg%40mail.gmail.com.

Re: Api

i have it attached as an attached file already 

On Sat, Feb 29, 2020 at 5:51 PM Naveen Arora <naveenarorakrnl@gmail.com> wrote:
Can you share the traceback of error you are facing ?

Cheers,

On Saturday, 29 February 2020 11:17:59 UTC+5:30, Tosin Ayoola wrote:
halo having 2 issues now
(1st) getting an integrity err
(2nd) i have a api code that return's count but still i'm not getting wat i expected
below is my codes and the err msg i'm getting

###APIView
class CartViewSet(viewsets.ModelViewSet):      serializer_class = CartDetailSerializer      queryset = CartList.objects.all()          #@detail_route(methods=['post', 'put'])      def add_item(request, self, pk=None):          cart = self.get_object()          try:              product = Product.objects.get(                  pk = request.data['product_id']              )              quantity = int(request.data['quantity'])          except Exception as e:              print (e)              return Response({'status': 'fail' })            if product.quantity < 0 or product.quantity - quantity < 0:              print('sorry check back leta')              return Response({'status': 'fail'})             existing_cart = CartList.objects.filter(product=product,                     cart=cart).first()          if existing_cart:              existing_cart.quantity +=quantity              existing_cart.save()          else:              new_cart = CartList(cart=cart, product=product,                           quantity=quantity)              new_cart.save()              product_list =                Product.Objects.filter(manufacturer=manufacturer).count()          serializer = CartSerializer(cart)          return Response(serializer.data)

Serializer

class CartDetailSerializer(serializers.ModelSerializer):      customer = UserSerializer(read_only =True)      items = serializers.StringRelatedField(many=True)        class Meta:          model = CartList          fields = ('id', 'customer', 'items', 'created', 'updated')      class CartListSerializer(serializers.ModelSerializer):      class Meta:          model = CartList          fields = ('product', 'quantity')

On Fri, Feb 28, 2020 at 1:28 PM Naveen Arora <naveena...@gmail.com> wrote:
Create an API which returns count, then use javascript to update the front end part.


On Friday, 28 February 2020 12:50:39 UTC+5:30, Tosin Ayoola wrote:
Good morning guyz,  
I need help on this one,  it on writing api that will Shows the product count for each manufacturer as users add products real time. 
I have no idea how to solve this problem,  i will any suggestion 
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...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/cf4ed839-2cd7-4517-b3d1-b51b3c7a89ee%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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/c8a99cd5-7e52-459f-9f17-8d9e5272c963%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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAHLKn72rYduBgDv6q2fkvn1Enbh9hR-h4AJbuev%3D2AbqAovzUw%40mail.gmail.com.

Re: Is it possible to extend the model in another application without explicitly changing firs-one?

Why are you trying to create the same table again and again with more or less attributes ?
I do not try to RE-create the table but to alter the existing one.

Sometimes following the pure pythonic way may limits what framework can do. But it does not mean that somewhere in the universe of the solutions there is a better way to organize things.
What I trying is to check if it is possible to use the same concepts implemented in Odoo ORM (https://github.com/odoo/odoo). I want to migrate from Odoo to Django due to the first has some limitations.

On Saturday, February 29, 2020 at 6:55:22 PM UTC+2, Naveen Arora wrote:
Hi again,

According to what i have understood the problem till now. You are trying to implement it the wrong way. This is not python, Everything is already built using classes, you are already overriding a class, then extending an overriden class seems complicated. Modularity and loose coupling can be achieved through a completely different way here. Be it clear, a model creates a table in the database. Why are you trying to create the same table again and again with more or less attributes ? 
Try implementing manytomany fields, foreign =key etc. This may solve your problem .

Regards
Naveen Arora

On Friday, 28 February 2020 18:33:20 UTC+5:30, Ol P wrote:
What are you trying to achieve with this implementation?
I want to achieve modularly and loose coupling. Separate responsibility in other words.

and What do you call a extended model ?
By extended model, I mean pat of an existing model, that implemented in one place (in out example app-A) but extended, altered or modified in another please (in out example app-B)

Instance of model1 is accesible in app2, this already means you got your model1 in app2.
Yes, but not the model itself.

On Friday, February 28, 2020 at 2:53:45 PM UTC+2, Naveen Arora wrote:
What are you trying to achieve with this implementation?
and What do you call a extended model ?
Instance of model1 is accesible in app2, this already means you got your model1 in app2.

Curious.


On Friday, 28 February 2020 18:20:12 UTC+5:30, Ol P wrote:
But how to add fields to it?

Where to put what:
from appA import model1


class ExtendedModel1(?):
   
?

    new_field
= models.CharFiled()

   
class Meta:
       
?


On Friday, February 28, 2020 at 2:23:17 PM UTC+2, Naveen Arora wrote:
Clearly Possible, 
Simply import the model first using appname.models. Hope it helps:)
You can use this as
from appA import model1
in app2

On Thursday, 27 February 2020 22:04:12 UTC+5:30, Ol P wrote:
Imagen we have app-A and app-B with model-A and model-B accordingly.
And we want to extend model-A in app-B.
What should be written in model-B to implement it?

In other words, is it possible to implement the same-table extension?

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

Re: Is it possible to extend the model in another application without explicitly changing firs-one?

This is not extending but inheritance. It will create a new table. I need to alter the existing table.

On Friday, February 28, 2020 at 8:27:26 PM UTC+2, Motaz Hejaze wrote:
You should understand that extending a model will create a new table with columns existed in parent in addition to new columns you define , so yes you can extend .. 

On Fri, 28 Feb 2020, 3:03 pm Ol P, <o...@global-mediator.com> wrote:
What are you trying to achieve with this implementation?
I want to achieve modularly and loose coupling. Separate responsibility in other words.

and What do you call a extended model ?
By extended model, I mean pat of an existing model, that implemented in one place (in out example app-A) but extended, altered or modified in another please (in out example app-B)

Instance of model1 is accesible in app2, this already means you got your model1 in app2.
Yes, but not the model itself.

On Friday, February 28, 2020 at 2:53:45 PM UTC+2, Naveen Arora wrote:
What are you trying to achieve with this implementation?
and What do you call a extended model ?
Instance of model1 is accesible in app2, this already means you got your model1 in app2.

Curious.


On Friday, 28 February 2020 18:20:12 UTC+5:30, Ol P wrote:
But how to add fields to it?

Where to put what:
from appA import model1


class ExtendedModel1(?):
   
?

    new_field
= models.CharFiled()

   
class Meta:
       
?


On Friday, February 28, 2020 at 2:23:17 PM UTC+2, Naveen Arora wrote:
Clearly Possible, 
Simply import the model first using appname.models. Hope it helps:)
You can use this as
from appA import model1
in app2

On Thursday, 27 February 2020 22:04:12 UTC+5:30, Ol P wrote:
Imagen we have app-A and app-B with model-A and model-B accordingly.
And we want to extend model-A in app-B.
What should be written in model-B to implement it?

In other words, is it possible to implement the same-table extension?

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/851d7bd0-4821-4b78-bfbf-881f0db090f5%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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/056a305e-8617-4039-bf8f-6466d56b6209%40googlegroups.com.

Re: Serializing forms and formsets to pass to Celery task

Yes that would work well. You can always find a completely different way of achieving what you are trying to achieve.

On Saturday, 29 February 2020 18:52:24 UTC+5:30, Jason wrote:
As said before, you really can't do that too well with celery.  Its a good practice to keep the message body between django -> broker -> worker to be as small as possible because we don't know what your configuration for the broker is.  In addition, you should never, ever, put sensitive information in a message, just the identifier of a thing and let celery/django pull from a data store when the task starts.

what I would do is save the form data to some intermediate data store, and pass in the identifier to the celery task for retrieval.  That ensures your data integrity and security is high.

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

Re: Is it possible to extend the model in another application without explicitly changing firs-one?

Hi again,

According to what i have understood the problem till now. You are trying to implement it the wrong way. This is not python, Everything is already built using classes, you are already overriding a class, then extending an overriden class seems complicated. Modularity and loose coupling can be achieved through a completely different way here. Be it clear, a model creates a table in the database. Why are you trying to create the same table again and again with more or less attributes ? 
Try implementing manytomany fields, foreign =key etc. This may solve your problem .

Regards
Naveen Arora

On Friday, 28 February 2020 18:33:20 UTC+5:30, Ol P wrote:
What are you trying to achieve with this implementation?
I want to achieve modularly and loose coupling. Separate responsibility in other words.

and What do you call a extended model ?
By extended model, I mean pat of an existing model, that implemented in one place (in out example app-A) but extended, altered or modified in another please (in out example app-B)

Instance of model1 is accesible in app2, this already means you got your model1 in app2.
Yes, but not the model itself.

On Friday, February 28, 2020 at 2:53:45 PM UTC+2, Naveen Arora wrote:
What are you trying to achieve with this implementation?
and What do you call a extended model ?
Instance of model1 is accesible in app2, this already means you got your model1 in app2.

Curious.


On Friday, 28 February 2020 18:20:12 UTC+5:30, Ol P wrote:
But how to add fields to it?

Where to put what:
from appA import model1


class ExtendedModel1(?):
   
?

    new_field
= models.CharFiled()

   
class Meta:
       
?


On Friday, February 28, 2020 at 2:23:17 PM UTC+2, Naveen Arora wrote:
Clearly Possible, 
Simply import the model first using appname.models. Hope it helps:)
You can use this as
from appA import model1
in app2

On Thursday, 27 February 2020 22:04:12 UTC+5:30, Ol P wrote:
Imagen we have app-A and app-B with model-A and model-B accordingly.
And we want to extend model-A in app-B.
What should be written in model-B to implement it?

In other words, is it possible to implement the same-table extension?

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

Re: Api

Can you share the traceback of error you are facing ?

Cheers,

On Saturday, 29 February 2020 11:17:59 UTC+5:30, Tosin Ayoola wrote:
halo having 2 issues now
(1st) getting an integrity err
(2nd) i have a api code that return's count but still i'm not getting wat i expected
below is my codes and the err msg i'm getting

###APIView
class CartViewSet(viewsets.ModelViewSet):      serializer_class = CartDetailSerializer      queryset = CartList.objects.all()          #@detail_route(methods=['post', 'put'])      def add_item(request, self, pk=None):          cart = self.get_object()          try:              product = Product.objects.get(                  pk = request.data['product_id']              )              quantity = int(request.data['quantity'])          except Exception as e:              print (e)              return Response({'status': 'fail' })            if product.quantity < 0 or product.quantity - quantity < 0:              print('sorry check back leta')              return Response({'status': 'fail'})             existing_cart = CartList.objects.filter(product=product,                     cart=cart).first()          if existing_cart:              existing_cart.quantity +=quantity              existing_cart.save()          else:              new_cart = CartList(cart=cart, product=product,                           quantity=quantity)              new_cart.save()              product_list =                Product.Objects.filter(manufacturer=manufacturer).count()          serializer = CartSerializer(cart)          return Response(serializer.data)

Serializer

class CartDetailSerializer(serializers.ModelSerializer):      customer = UserSerializer(read_only =True)      items = serializers.StringRelatedField(many=True)        class Meta:          model = CartList          fields = ('id', 'customer', 'items', 'created', 'updated')      class CartListSerializer(serializers.ModelSerializer):      class Meta:          model = CartList          fields = ('product', 'quantity')

On Fri, Feb 28, 2020 at 1:28 PM Naveen Arora <naveena...@gmail.com> wrote:
Create an API which returns count, then use javascript to update the front end part.


On Friday, 28 February 2020 12:50:39 UTC+5:30, Tosin Ayoola wrote:
Good morning guyz,  
I need help on this one,  it on writing api that will Shows the product count for each manufacturer as users add products real time. 
I have no idea how to solve this problem,  i will any suggestion 
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...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/cf4ed839-2cd7-4517-b3d1-b51b3c7a89ee%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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/c8a99cd5-7e52-459f-9f17-8d9e5272c963%40googlegroups.com.

Re: Issue in the API while merging the two data frames

Hi Devendra , 
Can you share the code with the exact error you are facing.?

Cheers,
Naveen Arora


On Saturday, 29 February 2020 04:35:02 UTC+5:30, Devendra reddy wrote:
Hi to all,

I have two data frames in the python django API.one dataframe we are getting from the query and one data frame we are getting the XL file.how I want map this dataframes.in this equipment name and tag name are common.while merging one tag is missing or it is going to be updated with another tag in that dataframe repetition is happening.while giving conditions like how = right or left or inner or outer the tag is missing and this tag is going to update by the another tag and this tag is coming as twice. How can I solve this?
Please suggest me solution.

Thanks and Regards.

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

WYSIWYG Editor with editable queryset (like Confluence)

Some days ago I worked with Confluence.

This tool has a great feature: You can insert a paginated queryset in a page. Without coding, all WYSIWYG:


Is there a way to get this cool feature into django?

Regards,
  Thomas


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

Re: Serializing forms and formsets to pass to Celery task

As said before, you really can't do that too well with celery.  Its a good practice to keep the message body between django -> broker -> worker to be as small as possible because we don't know what your configuration for the broker is.  In addition, you should never, ever, put sensitive information in a message, just the identifier of a thing and let celery/django pull from a data store when the task starts.

what I would do is save the form data to some intermediate data store, and pass in the identifier to the celery task for retrieval.  That ensures your data integrity and security is high.

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

Re: production setup

Okay, sure. 

Thank you for your response. 

On Sat 29 Feb, 2020, 11:33 AM Naveen Arora, <naveenarorakrnl@gmail.com> wrote:
Hi

have a look at this - https://github.com/codingforentrepreneurs/Guides/blob/master/all/Heroku_Django_Deployment_Guide.md

Cheers

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

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

Re: Is it possible to extend the model in another application without explicitly changing firs-one?

good morning am also interested in joining the class


On Thursday, February 27, 2020 at 8:34:12 AM UTC-8, Ol P wrote:
Imagen we have app-A and app-B with model-A and model-B accordingly.
And we want to extend model-A in app-B.
What should be written in model-B to implement it?

In other words, is it possible to implement the same-table extension?

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