How can I change the way of defining/binding namespaces for string array in zeep library?

2021-10-25 Thread Sencer Hamarat
generate string array XML like the format above? Regards, Sencer HAMARAT -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@google

Re: How to filter and get all vendor details using category

2021-12-08 Thread Sencer Hamarat
category = CategorySerializer() class Meta: model = Vendor fields = ["vendor_id", "vendor_name", "vendor_location", "category"] You can filter by category now. Regards, Sencer HAMARAT On Wed, Dec 8, 2021 at 4:59 PM Gautam Ankul wrote:

Re: Why does django throw TypeError when sending requests through Apache WSGI?

2021-12-08 Thread Sencer Hamarat
Hi, I think this is not related with apache It seems like class object property is called as a method somehow. Unfortunately the error does not reveal the property name. Regards, Sencer HAMARAT On Wed, Dec 8, 2021 at 4:59 PM Kyle Paterson wrote: > Started a new project after not us

AttributeError: 'Values' object has no attribute 'link_base' in building sphinx documentation.

2021-12-09 Thread Sencer Hamarat
4.0, sphinx 4.2.0, sphinx 4.3.1 I also opened an issue at sphinx github but they said this has to do with django admindocs instead of sphinx. Is there anybody who has resolved the AttributeError exception thrown while building documents via sphinx? Regards, Sencer HAMARAT -- You received thi

Re: AttributeError: 'Values' object has no attribute 'link_base' in building sphinx documentation.

2021-12-10 Thread Sencer Hamarat
I also opened an issue at sphinx github but they said this has to do with >> django admindocs instead of sphinx. >> >> Is there anybody who has resolved the AttributeError exception thrown >> while building documents via sphinx? >> >> Regards, >> Sencer HAMARAT &

How to compare two image field properly

2022-02-19 Thread Sencer Hamarat
) class ModelB(models.Model): image = ImageField( verbose_name=_('Product Image'), max_length=400, default=static('images/default_thumbnail.png'), ) Also, I need to figure out how to track any change in a single image field. Regards, Sencer

Re: How to compare two image field properly

2022-02-21 Thread Sencer Hamarat
Thanks but, no. I didn't mean the comparing content of the files. 19 Şub 2022 Cmt 21:55 tarihinde şunu yazdı: > OpenCV > > - Tom > > On Feb 19, 2022, at 2:27 AM, Sencer Hamarat > wrote: > >  > Hi, > > I have two different models which include image fiel

Django Rest Framework with self nested serializers

2022-04-26 Thread Sencer Hamarat
Hello people, There are two models that are related to each other. class Parent(models.Model): name = models.CharField... class Child(models.Model): parent = models.ForeignKey(Parent) value = models.CharField... And there is a serializer built on "Child" model: class ChildSerialize

How to prevent return full data response when lookup expression is not in list

2022-05-30 Thread Sencer Hamarat
ns all data instead of raising an error. Is there a way to raise an error if the lookup expression is other than specified in Meta class ('in', 'exact')? At least preventing returning full data from the Model. Kind regards, Sencer HAMARAT -- You received this message becau

Negated filtering by lookup expression sent via url query

2022-05-31 Thread Sencer Hamarat
exclude query with name argument and "john" value. Something like: self.queryset.exclude(name="john") Kind regards, Sencer HAMARAT -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and

Best approach for audit logging in Django.

2022-06-03 Thread Sencer Hamarat
leted: - who is taking this action (ForeignKey) - what is the action (Choice) - which applications model object affected (ContentType) - affected object (Generic relation) - current data in json format - previous data in json format Kind regards, Sencer HAMARAT -- You received this me

Re: Best approach for audit logging in Django.

2022-06-09 Thread Sencer Hamarat
Hi Lalit, Thanks for your reply. Actually, It must cover all models. Not certain ones. I thought middleware should be a much better place for this action, but I can't imagine how to handle it. Saygılarımla, Sencer HAMARAT On Fri, Jun 3, 2022 at 9:01 PM Lalit Suthar wrote: > H

Re: Best approach for audit logging in Django.

2022-06-09 Thread Sencer Hamarat
Hi, Mukul Never use a disk file for audit logging. Use at least a DB. On the other hand, using logging facilities or specialized tools are better options. Jason's suggestion above might lead you to the right choice. Kind Regards, Sencer HAMARAT On Mon, Jun 6, 2022 at 7:59 AM Mukul

Does django supports dynamic allowlist in EmailValidator

2022-06-14 Thread Sencer Hamarat
27;example2.com',...]) ] ) Can I dynamically fetch domains from another model and assign to allowlist? "allowlist" must be altered instantly if related domain list model records are changed. Regards, Sencer HAMARAT -- You received this message because you are subscribed to the Google Gr

How to achieve bulk soft delete in django?

2022-06-16 Thread Sencer Hamarat
it without iterating the object list? Regards, Sencer HAMARAT -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.co

Re: variable inside a template

2022-06-16 Thread Sencer Hamarat
Don use 'o' as a template variable in the template function Use {% static 'poll/'|add:o %} instead. 16 Haz 2022 Per 14:09 tarihinde luca72.b...@gmail.com < luca72.bertolo...@gmail.com> şunu yazdı: > Hello i have a list like: > mylist = ['1,png','2.png',3.jpj'] > in the template i do as follow:

How to roll back related objects if any error happened.

2022-07-04 Thread Sencer Hamarat
rent object, too? Is there any chance to make this happen in a transaction to roll back any related record? Kind regards, Sencer HAMARAT -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receivi

Re: How to roll back related objects if any error happened.

2022-07-05 Thread Sencer Hamarat
Hi, I tried that but, when child_serializer.save() throws an exception, the row created by parent_serializer.save() at the database is not rolled back. Kind regards, Sencer HAMARAT On Mon, Jul 4, 2022 at 7:59 PM Ryan Nowakowski wrote: > You can use transaction.atomic: > &

Re: How to roll back related objects if any error happened.

2022-07-05 Thread Sencer Hamarat
ta as a nested json, wrote a create method in the serializer and pushed the data through a single serializer to the db. Thus, any bad request at the serializer validation level is avoided and there is no need to go back. Anyway, If you think that my claim above is false, I would like to hear your opin

Need help on reducing cognitive complexity

2022-07-20 Thread Sencer Hamarat
that maneuver ends up with raising complexity. Can anybody help me to learn how to reduce cognitive complexity in code blocks like this? Kind regards, Sencer HAMARAT -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this

Queryset for get all objects with count of some of them.

2022-07-25 Thread Sencer Hamarat
1 Is that can be fetched by query like this? AModel.objects.all( ).annotate( c_count=Count( Amodel.objects.filter(field_two=1).count() ) ) Saygılarımla, Sencer HAMARAT -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubs

Pass or refer parent query value into subquery

2022-07-26 Thread Sencer Hamarat
e_level" @> (U0."book_id") "current_rejected_count", "books"."id", FROM "publisher" INNER JOIN "books" ON ("publisher"."book_id" = "books"."id") WHERE "publ

Re: Pass or refer parent query value into subquery

2022-07-26 Thread Sencer Hamarat
add explicit type casts. Is there a way to handle this error? How can I cast the value into an array? Regards, Sencer HAMARAT On Tue, Jul 26, 2022 at 6:34 PM Ross Meredith wrote: > > https://docs.djangoproject.com/en/4.0/ref/models/expressions/#django.db.models.OuterRef > >

Casting a variable as array in a query

2022-07-26 Thread Sencer Hamarat
I'm having a problem with this query: I believe, Q(bundle__contains=OuterRef("book_id")) part of the query is expecting an array instead of single value. I'm getting this error: ProgrammingError: operator does not exist: jsonb @> bigint LINE 1: ...lisher"."book_id") OR U0."bundle" @> ("publis

Customize serializer errors with incorrect data

2022-08-02 Thread Sencer Hamarat
the user data has no email information. This will return error like: {"email":["This field may not be blank."], "email":["This field may not be blank."], ...} I want to add error related data or at least index number to error text Is there a way to

Re: Customize serializer errors with incorrect data

2022-08-04 Thread Sencer Hamarat
Hello again, For anyone interested, more detailed version was sent to stackoverflow: https://stackoverflow.com/questions/73231297/proper-way-to-return-erroneous-data-with-serializer-error Kind regards, Sencer HAMARAT On Wed, Aug 3, 2022 at 7:58 AM Sencer Hamarat wrote: > Hi, > >

How to get last child object of a parent model by query

2022-08-05 Thread Sencer Hamarat
last childs like: last_childs = list() for parent in Parent.objects.filter(id__in=[1, 2, 3, 4]): last_childs.append(parent.child_set.last()) Kind regards, Sencer HAMARAT -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe

Is there a way to pass arbitrary argument from serializer.save to model.save method

2022-09-23 Thread Sencer Hamarat
Hi, I need to pass an arbitrary argument from the serializer.save() method to model.save() method? Such as: serialized_data = AModelSerializer(instance, data=adata_dict) if serialized_data.is_valid(): serialized_data.save(an_arg="value") class Amodel(models.Model) def save(*args, **kwar

AttributeError: 'NoneType' object has no attribute 'app_name'

2020-03-02 Thread Sencer Hamarat
Hello, The project I'm working on has it's custom template context_processor. And when unavailable URL request arrives to Django (Eg. "/wp-login.php"), the context_processor is throwing AttributeError. Which way should I use to prevent from context processor from throwing errors? Is it ok to w

Re: AttributeError: 'NoneType' object has no attribute 'app_name'

2020-03-13 Thread Sencer Hamarat
Thank you for your suggestion. And sorry fro delayed answer. My hunch is saying same thing but I want to be sure about it. Kind Regards, Sencer Hamarat 3 Mart 2020 Salı 12:24:34 UTC+3 tarihinde Naveen Arora yazdı: > > Hi, > > Can't the error be resolved ? Still, if error has

Can Length method of django.db.models.functions applicable to BigIntegerField?

2020-03-13 Thread Sencer Hamarat
I need to filter data by it's value length of a field. I can do it in a for loop, but I'm curious about if the Length method can be applicable to any type of field besides CharField -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscrib

Re: Optimized Query

2020-05-29 Thread Sencer Hamarat
I thought select_related works for only FK/M2M and prefetch_related works for only reverse relations, doesn't it? Saygılarımla, Sencer HAMARAT ‪On Fri, May 29, 2020 at 7:32 AM ‫אורי‬‎ wrote:‬ > Hi Soumen, > > Sometimes prefetch_related is much faster and more efficient than &g

Re: Templates vs. source code

2020-05-29 Thread Sencer Hamarat
ygılarımla, Sencer HAMARAT ‪On Fri, May 29, 2020 at 7:11 AM ‫אורי‬‎ wrote:‬ > Django users, > > There was a discussion in Stack Overflow related to an answer of mine - > how to access settings from templates in Django [ > https://stackoverflow.com/a/53953578/1412564]. And I wou

Re: How models.Manager is working behind the scene and calling different serialize methods?

2020-05-29 Thread Sencer Hamarat
I believe, the method "get_query*set*" name is explains what you want to know. If you filter or fetch every thing with django query, it returns queryset. The .get() query on the other hand, returns a single object. Saygılarımla, Sencer HAMARAT On Fri, May 29, 2020 at 4:43 AM dja

Re: Can You please help me out!!!

2020-05-29 Thread Sencer Hamarat
tion.message notification.date {% endfor %} Saygılarımla, Sencer HAMARAT On Fri, May 29, 2020 at 1:59 PM meera gangani wrote: > i want to fetch last 3 records for notification!! > But I only fetch last 1 record. > > Can you please help me out!!! > Can i use filters?? > > A

Re: Can someone help me??

2020-07-01 Thread Sencer Hamarat
"local()" method call. You have to check data types where the "+" operator used. And also according to the error itself, the one of that value is not a string. I think the "ModelBase" model has no '__str__'. Saygılarımla, Sencer HAMARAT On Wed, Jul 1, 2020

I've got a problem with using factory with python zeep

2021-06-28 Thread Sencer Hamarat
Would you please checkout this StackOverflow link: https://stackoverflow.com/questions/68160839/python-zeep-xml-factory-exception-with-no-namespace-defined-for-the-prefix Regards, Sencer HAMARAT -- You received this message because you are subscribed to the Google Groups "Django users&q

How to check if lock is acquired in Django pglock

2021-09-22 Thread Sencer Hamarat
Using django pglock I want to check if lock is acquired by another process How can I do it? -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr

Re: How to check if lock is acquired in Django pglock

2021-09-22 Thread Sencer Hamarat
't acquire the lock. Please mind the lock id is the same for all processes. Regards, Sencer HAMARAT On Wed, Sep 22, 2021 at 4:59 PM Sencer Hamarat wrote: > Using django pglock > I want to check if lock is acquired by another process > How can I do it? > > > -- You rece

Re: How to check if lock is acquired in Django pglock

2021-09-23 Thread Sencer Hamarat
Thanks for reply, Afterwards, I figured out it was like in your comment. Solution: lock_id = "non_unique_lock" with advisory_lock(lock_id, wait=False) as acquired: if acquired: # things to do else: raise Exception() # or whatever you want. Regards, Senc

Is there any clear integration document for OpenTelemetry for Azure?

2023-11-09 Thread Sencer Hamarat
can I achieve this? Regards, Sencer HAMARAT -- You received this message because you are subscribed to the Google Groups "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 di

Re: Directly Accessing Dictionary Values

2019-11-22 Thread Sencer Hamarat
unique_key_object = simpleformmodel.objects.filter(id=unique_key).last() You can get only one object like as querying with .get(), but lack of object is return None instead throwing exception. BTW, you don't need to use .all() if you have to use .filter() or other query methods. Regards, Sencer HAMARAT

Re: Set different value for a field when Admin creates an user

2019-11-29 Thread Sencer Hamarat
Check request.user.is_superuser. If it return True, the role of the user signed in is Admin. Saygılarımla, Sencer HAMARAT On Fri, Nov 29, 2019 at 3:41 PM Fruity Code wrote: > I have an updated user model and added two fields to it, mobile_number and > role. The field role has two o

Re: Difficulty with Tutorial Part 2

2019-12-09 Thread Sencer Hamarat
Your timedelta import is correct but usage of the timedelta is not. Replace "datetime.timedelta(days=1)" with "timedelta(days=1)" Saygılarımla, Sencer HAMARAT On Mon, Dec 9, 2019 at 11:24 AM Bruckner de Villiers wrote: > Running Django 3.0 & Python 3.7.3 &

Re: Removing Hardcoded urls in Templates

2019-12-10 Thread Sencer Hamarat
Would you please replace url name with 'polls:detail', as described at https://docs.djangoproject.com/en/3.0/topics/http/urls/#id5 Saygılarımla, Sencer HAMARAT On Tue, Dec 10, 2019 at 1:58 PM Bruckner de Villiers < bruckner.devilli...@gmail.com> wrote: > Running Django

Re: Sometime it's happening this error on server on django application

2019-12-10 Thread Sencer Hamarat
o ISP. Saygılarımla, Sencer HAMARAT On Wed, Dec 11, 2019 at 8:52 AM Rupam Hazra wrote: > > Exception happened during processing of request from ('47.11.53.147', > 47572) > Traceback (most recent call last): > File "/usr/local/lib/python3.7/socketserver.py"

Re: Duplication of Query - reg

2019-12-26 Thread Sencer Hamarat
Hi, That could be a behavior of a template tag or a "for" block in the template. You may consider to use ".select_related" and ".prefetch_related" in view. Saygılarımla, Sencer HAMARAT On Fri, Dec 27, 2019 at 4:59 AM Raja Sekar Sambath wrote: > Hi, >

Re: Calculation field - best practice

2020-01-21 Thread Sencer Hamarat
IMO this should be done in view if it's just for display purposes in rendered page. Although, the best method is doing it in a template tag. Regards, Sencer HAMARAT On Tue, Jan 21, 2020 at 3:30 PM Mario Bisiani wrote: > Good morning, > > first post here! > > I have a que