Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
django Restframework _ updating instance with unique=True fileds
I have a model that has a unique field. models.py class A(models.Model): phonenumber = models.CharField(max_length=17,unique=True) serializers.py class ASerializer(serializers.ModelSerializer): class Meta: model = A fields = "__all__" def create(self, validated_data): return A.objects.create(**validated_data) def update(self, instance, validated_data): instance.phonenumber = validated_data.get('phonenumber', instance.phonenumber) instance.save() return instance in updating instance of model A .if phonenumber be the same as before.the validation error comes up.this field already exists in database.how can i exclude instance from validation error.and I already tried : extera_kwargs = { 'phonenumber' : {'validators': []}, } -
Django Rest Framework, passing parameters with GET request, classed based views
I would like a user to send a GET request to my Django REST API: 127.0.0.1:8000/model/?radius=5&longitude=50&latitude=55.1214 with his longitude/latitude and radius, passed in parameters, and get the queryset using GeoDjango. For example, currently I have: class ModelViewSet(viewsets.ModelViewSet): queryset = Model.objects.all() And what I ideally want is: class ModelViewSet(viewsets.ModelViewSet): radius = request.data['radius'] location = Point(request.data['longitude'],request.data['latitude'] query set = Model.objects.filer(location__distance_lte=(location, D(m=distance))).distance(location).order_by('distance') Now a couple of immediate errors: 1) request is not defined - should I use api_view, i.e. the function based view for this? 2) DRF page says that request.data is for POST, PUT and PATCH methods only. How can send parameters with GET? -
Django how to find view by url
I see a page in django, but i can't find it in the project templates or any folder around it by doing search by string in files, is there a way to find these html templates from a specific page by url? or there is any other way to find them? maybe they are somehow encoded idk... -
Docker container runs with docker-compose up but doesn't with docker run
First attempt into docker and I've hit a wall. I don't understand how the docker works and when my local machine is "detached" from the container. At the end the project runs with docker-compose run, but doesn't with docker run because it cannot connect to postgres. When I run docker-compose run with these settings everything works: settings.py: DATABASES = { 'default': { 'ENGINE': 'django.db.backends.postgresql_psycopg2', 'NAME': 'postgres', 'USER': 'user', 'PASSWORD': 'password', 'HOST': 'db', 'PORT': '5432', } } docker-compose.yml version: '2' services: db: image: postgres environment: - POSTGRES_USER=user - POSTGRES_PASSWORD=password ports: - '5432:5432' redis: image: redis ports: - '6379:6379' celery: build: context: . dockerfile: Dockerfile env_file: common.env command: celery -A saleor worker --app=saleor.celeryconf:app --loglevel=info volumes: - .:/app:Z links: - redis depends_on: - redis search: image: elasticsearch:5.4.3 mem_limit: 512m environment: - "ES_JAVA_OPTS=-Xms512m -Xmx512m" ports: - '127.0.0.1:9200:9200' web: build: . command: python manage.py runserver 0.0.0.0:8000 env_file: common.env depends_on: - db - redis - search ports: - '8000:8000' volumes: - .:/app:Z makemigrations: build: . command: python manage.py makemigrations --noinput volumes: - .:/app:Z migration: build: . command: python manage.py migrate --noinput volumes: - .:/app:Z However, if I run docker build -t db_test . docker run -p 4000:8000 db_test Dockerfile: FROM python:3.5 ENV PYTHONUNBUFFERED 1 RUN \ … -
django elastic search index for many for many field
I have successfully integrate elastic search in one of my django project by following this tutorial, elastic search with django the easy way i have following model structure, class Product(models.Model): product_id = models.IntegerField(default=0) product_name = models.CharField(max_length=100) description = models.CharField(max_length=500, null=True, blank=True) product_tag = models.ManyToManyField(Tag) product_unit = models.ForeignKey(Unit) def __str__(self): return str(self.product_name) class ProductKeyword(models.Model): name = models.CharField(max_length=100) product = models.ManyToManyField(Product, related_name="products") date_created = models.DateTimeField(auto_now_add=True) date_updated = models.DateTimeField(auto_now=True) def __str__(self): return str(self.name) def search_indexing(self): obj = ProductKeyWordIndex( meta={'id': self.id}, name=self.name, product=self.product.product_name, date_created=self.date_created, date_updated=self.date_updated, ) obj.save() return obj.to_dict(include_meta=True) where i have create a search_indexing method for a ProductKeyword model for elastic search indexing. when i try to create a new ProductKeyword objects, raise the following error, AttributeError: 'ManyRelatedManager' object has no attribute 'product_name' at search_indexing method where i am indexing self.product.product_name, where self.product is a m2m field, in mention, the same method work perfectly for foreign field. i have tried as following by updating the search_indexing method to solve the problem, def search_indexing(self): obj = ProductKeyWordIndex( meta={'id': self.id}, name=self.name, product=self.product.product_set.all(), date_created=self.date_created, date_updated=self.date_updated, ) obj.save() return obj.to_dict(include_meta=True) but raising the following error, AttributeError: 'ManyRelatedManager' object has no attribute 'product_set' -
How to get url of task with task id of viewflow
I want the flow url with task id of viewflow For example : http://127.0.0.1/workflow/helloworld/helloworld/12/approval/23/ -
Django dynamic header for global variable
Is there any way i can use dynamic header and footer. In my project so that i can define global variable also dynamic variable data per page. <body> <header> <My dynamic header template> </header> <content> <Page template> <content> <footer> <My dynamic footer template> <footer> -
|django| Model matching query does not exist
I received error: WARNING:logger:invoice_settings_create_new_invoice ERROR: Invoice matching query does not exist. This is error I receive when try to call .save() method for object: object = Invoice(name=so_name) for fieldname, fieldvalue in invoice_data['fields'].items(): if fieldvalue['type']=='relto': model_rel = object._meta.get_field(fieldname).rel.to setattr(object, fieldname, model_rel().objects.get(pk=int(fieldvalue['value']))) else: if (object._meta.get_field(fieldname).get_internal_type() == 'IntegerField'): setattr(object, fieldname, int(fieldvalue['value'])) if (object._meta.get_field(fieldname).get_internal_type() == 'DecimalField'): setattr(object, fieldname, float(fieldvalue['value'])) if (object._meta.get_field(fieldname).get_internal_type() == 'DateField'): setattr(object, fieldname, datetime.datetime.strptime(fieldvalue['value'], "%d.%m.%Y").date()) object.save() I didn't use something complicate. I create new object. Set value for fields of object. Tried to save it. And received an error. Why is it happening? How i can fix it? -
Deploy Django 2.0 on Apache 2.2 at ubuntu 12.04
My enviroment: ubuntu 12.04 / python3.6.4 / django 2.0 / apache 2.2.22 I want to deploy django on apache I followed django official but still not work. I want to deploy at www.domainname.com/django/ my httpd.conf WSGIScriptAlias / /home/username/django/mysite/wsgi.py WSGIPythonHome /home/username/django/virtual_env WSGIPythonPath /home/username/django <Directory /home/username/django/mysite> <Files wsgi.py> Order deny,allow Allow from all </Files> </Directory> but it doesn't work. I can see 'It works' at 127.0.0.1/ but nothing in 127.0.0.1/django/ How can I set for deploy my django site? -
password_set signal not working in Django allauth
What I am trying to do ? I am trying to redirect a new user to login dialog after user sets a password for the first time. (I am doing this because the movement user sets a password Django implicitly logout the user) What is the problem ? For some reason the password_set signal doesn't seem to work. i.e the sender function loginAfterPassChange doesn't get executed. My Code: How do I set password views.py: @receiver(user_logged_in) def getFirstTimePass(user, request, **kwargs): #this works if user.profile.provider != '' and user.profile.firstTimeLogin: user.profile.firstTimeLogin = False user.profile.save() raise ImmediateHttpResponse(render(request, 'index.html', {'type': user.profile.provider, 'email': user.email})) @receiver(password_set) def loginAfterPassChange(request, user, **kwargs): #this doesn't work data = {'msg': 'Please login with your new password.'} return HttpResponse(data) def setPassword(request): #this works data = {'errMsg': 'Something went wrong.'} if not request.user.has_usable_password(): password = request.POST.get('password') request.user.set_password(password) request.user.save() data['errMsg'] = '' return JsonResponse(data) urls.py: from django.conf.urls import url from .import views urlpatterns = [ url(r'^updatePro', views.setPassword, name='updatePro') ] models.py: class Profile(models.Model): user = models.OneToOneField(User, related_name='profile', on_delete=models.CASCADE) provider = models.CharField(max_length=256, default='') firstTimeLogin = models.BooleanField(default=True) if user.profile.provider != '' Check to see if user is logged in with social account or local account. -
Django : mptt_instance.delete() mess my tree
I make a Django Webapp, that uses tree of nested categories (I use MPTT for that). I would like to allow the user to delete the category that he/she wants, no matter where the category is in the tree. I tried a form with a "category.delete()" method, it deletes the category in my database but nothing is updated for ancestors and children, so when I try to comeback to my categories_list page, I get an error If I delete the exact same category through django admin panel, the category is deleted as well, but the database is perfectly updated, so when I go to my categories_listing page, It works perfectly. So my question is : What does django Admin "delete" action, that category.delete() doesn't ? Thank you ! -
Django Maths Editor
I am django newbie and working on a math based project. I need to save texts involving mathematical symbols like integral, sigma, product etc. At the same time, I also need to emphasize or bold some texts (and do all kinds of rich text editing) and include figures that explains a mathematical concept. At present, I am just saving all the fields in a CharField (with dummy texts and without including any mathematical symbol) and have no idea how to include such a field. If you have any idea/hint or you have worked on similar projects, please help. -
Filter one-to-many relationship
I'm using django-filter and I would like to ask you if it could filter one to many reliontionship because I did not found any doc or example even on StackOverflow., here are the model, the filter and the view class Aliens(models.Model): class Meta: db_table = 'aliens' verbose_name = ('Introduction Event') verbose_name_plural = ('Introuction Events') ordering = ['alien'] alien = models.OneToOneField(Taxonomy, verbose_name=u"Non-indigenous Species", on_delete=models.CASCADE, null=True, blank=True) #SpeciesName = models.CharField(max_length=100, verbose_name=u"Species Name", blank=True, null=True) group = models.OneToOneField(Ecofunctional, verbose_name=u"Ecofunctional Group", on_delete=models.CASCADE, blank=True, null=True, default='') firstsight = models.IntegerField(('First Mediterranean Sighting'), choices=YEAR_CHOICES, blank=True, null=True) med_citation = models.ForeignKey(biblio, verbose_name=u"Mediterranean first citation", on_delete=models.CASCADE, null=True, blank=True) origin = models.OneToOneField(Origin, on_delete=models.CASCADE, blank=True, null=True, default='', verbose_name=u"Origin") status = models.OneToOneField(SuccessType, on_delete=models.CASCADE, blank=True, null=True, default='', verbose_name=u"Establishement") created_by = CurrentUserField() created_at = models.DateField('date of inclusion', blank=True, null=True, default=datetime.datetime.now()) photo = models.ImageField(upload_to='photos', blank=True, null=True) vector = models.ManyToManyField(vectors, verbose_name=u"Vectors/Pathways") updated_at = models.DateField('date of updating', blank=True, null=True, default=datetime.datetime.now()) updated_by = models.ForeignKey(User, on_delete=models.CASCADE, related_name='%(class)s_requests_updated', default=CurrentUserField(), null=True) notes = models.TextField(verbose_name='Notes', blank=True, null=True) db_status = StateField(verbose_name='Species Status in the Db', blank=True, null=True) def __str__(self): # __unicode__ on Python 2 return self.alien.SpeciesName class Distributions(models.Model): class Meta: db_table = 'distributions' verbose_name = ('verified occurence') verbose_name_plural = ('verified occurences') alien = models.ForeignKey(Aliens, verbose_name=u"Non-Indeginous Species", related_name='distributions', on_delete=models.CASCADE, null=True, blank=True) country = models.OneToOneField(Country, on_delete=models.CASCADE, … -
Count number of objects by date in daterange
In a Django project, I have these simplified models defined: class People(models.Model): name = models.CharField(max_length=96) class Event(models.Model): name = models.CharField(verbose_name='Nom', max_length=96) date_start = models.DateField() date_end = models.DateField() participants = models.ManyToManyField(to='People', through='Participation') class Participation(models.Model): """Represent the participation of 1 people to 1 event, with information about arrival date and departure date""" people = models.ForeignKey(to=People, on_delete=models.CASCADE) event = models.ForeignKey(to=Event, on_delete=models.CASCADE) arrival_d = models.DateField(blank=True, null=True) departure_d = models.DateField(blank=True, null=True) Now, I need generate a participation graph: for each single event day, I want the corresponding total number of participations. Currently, I use this awful code: def daterange(start, end, include_last_day=False): """Return a generator for each date between start and end""" days = int((end - start).days) if include_last_day: days += 1 for n in range(days): yield start + timedelta(n) class ParticipationGraph(DetailView): template_name = 'events/participation_graph.html' model = Event def get_context_data(self, **kwargs): labels = [] data = [] for d in daterange(self.object.date_start, self.object.date_end): labels.append(formats.date_format(d, 'd/m/Y')) total_participation = self.object.participation_set .filter(arrival_d__lte=d, departure_d__gte=d).count() data.append(total_participation) kwargs.update({ 'labels': labels, 'data': data, }) return super(ParticipationGraph, self).get_context_data(**kwargs) Obviously, I run a new SQL query for each day between Event.date_start and Event.date_end. Is there a way to get the same result with a reduced number of SQL query (ideally, only one)? I tried many aggregation … -
Django: how to use a DB parameter in a default attribute of model field?
I have created a (kind of) singleton to put all the app parameters in my database: class SingletonModel(models.Model): def save(self, *args, **kwargs): self.pk = 1 super(SingletonModel, self).save(*args, **kwargs) @classmethod def load(cls): return cls.objects.all().get() class Meta: abstract = True class AppParameters(SingletonModel, models.Model): DEFAULT_BALANCE_ALERT_THRESHOLD = models.PositiveIntegerField(default=5) # other parameters... It worked pretty well, until I tried to use one of these parameters in a default attribute of a model field: class Convive(models.Model): balance_alert_threshold = models.IntegerField( default=AppParameters.load().DEFAULT_BALANCE_ALERT_THRESHOLD, blank=True, null=True) This seemed to work too, but when I use a script to reinitialise local data, the first manage.py migrate produce a DoesNotExist since my Singleton does not exist yet. It happens because of a file importing Convive model. How would you solve this? Is there a way to "delay" the evaluation of the default field? Thanks. -
Why does the attribute not exist in the POST request?
I am trying to fill a field in a forms.ModelForm using a query based on a forms.Form. Unfortunately I am getting an AttributeError that suggests the field doesn't exist, and I'm not sure why this is. The error is AttributeError: 'ElectionSuggestionForm' object has no attribute 'PostElection' Here is the views.py: def new_post(request): if request.method == 'POST': form = NewPostForm(request.POST) election_form = ElectionSuggestionForm(request.user, request.POST) if form.is_valid(): post = form.save(commit=False) post.author = Candidate.objects.get(UserID=request.user, ElectionID=election_form.PostElection) post.save() return redirect('/feed/') else: form = NewPostForm() election_form = ElectionSuggestionForm(request.user) return render(request, 'campaign/new_post.html', { "form": form, "election_form": election_form, }) Here is the forms.py: class ElectionSuggestionForm(forms.Form): PostElection = forms.ModelChoiceField(queryset=None) def __init__(self, user, *args, **kwargs): super(ElectionSuggestionForm, self).__init__(*args, **kwargs) print(Election.objects.all().filter(candidate__UserID=user)) self.fields['PostElection'].queryset = Election.objects.all().filter(candidate__UserID=user) Thanks -
Django 2: path('^$', home, name='home') not working
I am new to Django and trying to make a project, but I am facing a simple problem. I am writing a path in Django 2 for root and it's not working, but for other things it works. Can anyone point out why it's not working. What is working: path(r'home/', home, name='home'), This is not working: path(r'^$', home, name='home'), And just to be clear: I am not loading both the line together. I comment one line at a time, so no order issues. -
Epic HttpResponse Error
I'm yet to understand why I'm getting 'HttpResponse' error. Traceback (most recent call last): File "C:\Python27\Scripts\covaenv\lib\site-packages\django\core\handlers\exception.py", line 42, in inner response = get_response(request) File "C:\Python27\Scripts\covaenv\lib\site-packages\django\core\handlers\base.py", line 198, in _get_response "returned None instead." % (callback.__module__, view_name) ValueError: The view exampleapp.views.get_recieve_update didn't return an HttpResponse object. It returned None instead. This view is responsible for getting a POST request from an API and load the data and do things with it. VIEWS: @csrf_exempt def get_recieve_update(request): if request.method=="POST": man= json.loads(request.body) txId = man['hash'] uri = bgo_main_base_url + '/wallet/{}/tx/{}'.format(WALLETID, txId) rexa = requests.get(uri, headers=headers) vd = rexa.json() isMine = vd['outputs'][0]['isMine'] confirmations = vd['confirmations'] if isMine == True and confirmations > 1: address = vd['outputs'][0]['account'] value = vd['outputs'][0]['value'] try: get_adr = CPro.objects.get(address = address) except CPro.DoesNotExist: get_adr = None if not get_adr.is_used==True and get_adr.is_active==False: update_cw = CW.objects.filter(user = get_adr.user).update(current_btc_balance=F('current_btc_balance') + value , modified_date=datetime.datetime.now()) return HttpResponse('done') elif get_adr.is_used==True and get_adr.is_active==False: address = vd['outputs'][0]['account'] value = vd['outputs'][0]['value'] send_mail('Recieved on Used Address','failed to credit for {} with {} and id {}'.format(address, value, txId), DEFAULT_FROM_EMAIL,[DE_MAIL,]) else: address = vd['outputs'][0]['account'] value = vd['outputs'][0]['value'] send_mail('Recieved Callback Error','failed to credit for {} with {}'.format(address, value), DEFAULT_FROM_EMAIL,[DE_MAIL,]) What am I missing? -
Convert SQL to django ORM query
Can someone convert the following query into Django ORM query without using raw in ORM. If you can please explain usage of '__' in the answer. SELECT date from submissions where application_id in (select application_id from products where name = (select name from bank where bank_id = 'B01')); -
Django ImportError: Couldn't import Django
I have a project about django web, this project has no problem on other computers, but pycharm on my own laptop prompts for the following information ImportError: Couldn't import Django. Are you sure it's installed and available on your PYTHONPATH environment variable? Did you forget to activate a virtual environment? I use PyCharm Professional and PyCharm3 My system is Windows 10. Can someone help? -
Ordering Topic model in Django for forum app
I'm working on a forum like app. The problem I'm having is that the order of the topics of the forum is determined by query. However I want to implement custom ordering by the admins. So I thought I could have a integer field named order in my Topic model with unique=True. However I'm not able to think how I can create a form for this. Here's my approach: I want to have a up and down button in my forum for every topic. When the admin orders using JS, a invisible form is filled and submitted on pressing the submit button. My idea of the invisible form is this: I will have data in the form like this: The left is the pk of the topic and right is the ordering 1 0 2 3 3 2 4 1 I think this is too hacky and not a good implementation. Is there a better way to do it? Is this a bad design? -
Error in Django: OSError: dlopen() failed to load a library: cairo / cairo-2
After installing WeasyPrint, I am getting this error: "Error in Django: OSError: dlopen() failed to load a library: cairo / cairo-2" Here is all the details: Unhandled exception in thread started by <function check_errors.<locals>.wrapper at 0x0446DE40> Traceback (most recent call last): File "C:\Users\Kanon\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\utils\autoreload.py", line 228, in wrapper fn(*args, **kwargs) File "C:\Users\Kanon\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\core\management\commands\runserver.py", line 125, in inner_run self.check(display_num_errors=True) File "C:\Users\Kanon\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\core\management\base.py", line 359, in check include_deployment_checks=include_deployment_checks, File "C:\Users\Kanon\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\core\management\base.py", line 346, in _run_checks return checks.run_checks(**kwargs) File "C:\Users\Kanon\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\core\checks\registry.py", line 81, in run_checks new_errors = check(app_configs=app_configs) File "C:\Users\Kanon\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\core\checks\urls.py", line 16, in check_url_config return check_resolver(resolver) File "C:\Users\Kanon\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\core\checks\urls.py", line 26, in check_resolver return check_method() File "C:\Users\Kanon\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\urls\resolvers.py", line 254, in check for pattern in self.url_patterns: File "C:\Users\Kanon\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\utils\functional.py", line 35, in __get__ res = instance.__dict__[self.name] = self.func(instance) File "C:\Users\Kanon\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\urls\resolvers.py", line 405, in url_patterns patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module) File "C:\Users\Kanon\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\utils\functional.py", line 35, in __get__ res = instance.__dict__[self.name] = self.func(instance) File "C:\Users\Kanon\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\urls\resolvers.py", line 398, in urlconf_module return import_module(self.urlconf_name) File "C:\Users\Kanon\AppData\Local\Programs\Python\Python36-32\lib\importlib\__init__.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "<frozen importlib._bootstrap>", line 994, in _gcd_import File "<frozen importlib._bootstrap>", line 971, in _find_and_load File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 665, in _load_unlocked File "<frozen importlib._bootstrap_external>", line 678, in exec_module File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed File … -
Pandas apply ValueError: bad input shape() when sending POST request
I am trying to implement an API in a django framework with the following code below: def worker_label_encoder(df,selected_col): le = LabelEncoder() enc = le.fit(np.unique(df[selected_col])) df[selected_col] = df[selected_col].apply(enc.fit_transform) It works fine when I tried it in a script on Atom. But when I use postman to send POST request with this API, it returns ValueError: bad input shape () on this line: df[selected_col] = df[selected_col].apply(enc.fit_transform) What is wrong? Why does it work in a script but not in post request? -
local variable 'post' referenced before assignment
Im trying to assign the current logged in username to the existing model through a form. But facing a problem while saving the form #views.py def create(request): if request.method == "POST": form=NotForm(request.POST) if form.is_valid(): post.user = request.user.get_username() post = form.save(commit=False) post.save() return redirect('base') else: form=NotForm() return render(request, 'create.html',{'form':form}) forms.py class NotForm(forms.ModelForm): class Meta: model=Note fields = ('title', 'desc',) models.py class Note(models.Model): title=models.CharField(max_length=50) desc=models.TextField(max_length=200) user=models.ForeignKey('auth.User') -
show the result of two dictionaries
i have two dictionaries a and b a = {"xx": [{"sat": [{"sat1": [{"det": {"amount": 1111}, "help": {"cs": 0, "c": 0, "some_key": "no"}}], "value": 75}, {"sat2": [{"det": {"amount": 1111}, "help": {"cs": 0, "c": 0, "some_key": "no"}}], "value": 75},...]}} b = {"xx": [{"sat": [{"sat1": [{"det": {"amount": 2222}, "help": {"cs": 0, "c": 0, "some_key": "no"}}], "value": 75}, {"sat2": [{"det": {"amount": 1111}, "help": {"cs": 0, "c": 0, "some_key": "no"}}], "value": 75},...]}} here in dict a {"amount": 1111} and in b {"amount": 2222} ..this is the diff in a and b....i want to show this difference.. like --- diff: a = {"sat": [{"sat1": [{"det": {"amount": 1111}, "help": {"cs": 0, "c": 0, "some_key": "no"}}], "value": 75} b = {"sat": [{"sat1": [{"det": {"amount": 2222}, "help": {"cs": 0, "c": 0, "some_key": "no"}}], "value": 75} similarities : a = {"sat2": [{"det": {"amount": 1111}, "help": {"cs": 0, "c": 0, "some_key": "no"}}], "value": 75} b = {"sat2": [{"det": {"amount": 1111}, "help": {"cs": 0, "c": 0, "some_key": "no"}}], "value": 75} how can i display such result.. i have used diff(a, b)