Re: Result of queryset in Django 1.10 is not sorted

2017-09-05 Thread Antonis Christofides
Hi, if you don't specifically ask for the query results to be sorted, their order will be undefined. Differences in your Django version or the RDBMS version or the OS or the environment or anything may result in a different sort order. If you want the query to be sorted, you must either use the or

Re: How to add more fields to each ManyToMany Field in Django?

2017-09-05 Thread Omer Iqbal
Hey, Thanks for replying. I tried what you said but It's still giving the error. I've also updated the StackOverflow question with updated code. One more thing, as you said about JavaScript. I think I won't be needing it on that page because this *through *models seems to be the solution to my p

Re: Result of queryset in Django 1.10 is not sorted

2017-09-05 Thread Jani Tiainen
Hi, Unless you have applied ordering, either in model Meta, or in your query clause, results are really "in no particular order". Most of the databases do return results in order the data is read from the disk, but that's not quaranteed. If you require ordering, add .order_by() to your query

APIView or ListAPIView,RetrieveAPIView while developing a restful application

2017-09-05 Thread Rakhee Menon
I am developing a restful application with angular technology as front end and django at the back end..Please can anyone suggest which type of views should I use,Should I go for APIVIEW or separate views like ListAPIView,RetrieveAPIView or in any case go for viewset -- You received this messa

APIView or ListAPIView,RetrieveAPIView while developing a restful application.

2017-09-05 Thread Rakhee Menon
​I am developing a restful application with angular technology as front end and django at the back end..Please suggest which type of views should I use,Should I go for APIVIEW or separate views like ListAPIView,RetrieveAPIView or in any case go for viewset​?? -- You received this message bec

Dynamic model, reverse foreign key not working

2017-09-05 Thread Roman Akopov
Hello, My problem is very rare so I'll try ad add as much useful detail as possible. I am using python 3.5 and 3.6, Django 1.11.4 I am creating complex security related application and need to generate additional models based on other applications' models. In general, everything works fine,

Re: How to add more fields to each ManyToMany Field in Django?

2017-09-05 Thread Omer Iqbal
Thank you - The problem is solved. I had deleted the migration files because It was showing no table error. But on deleting the database file (db.sqlite3) and re-applying migrations, It worked. -- You received this message because you are subscribed to the Google Groups "Django users" group.

Re: Dynamic model, reverse foreign key not working

2017-09-05 Thread Michal Petrucha
On Tue, Sep 05, 2017 at 03:47:37AM -0700, Roman Akopov wrote: > Hello, > > My problem is very rare so I'll try ad add as much useful detail as > possible. > > I am using python 3.5 and 3.6, Django 1.11.4 > > I am creating complex security related application and need to generate > additional

Re: Dynamic model, reverse foreign key not working

2017-09-05 Thread Roman Akopov
On Tuesday, September 5, 2017 at 3:38:17 PM UTC+4, Michal Petrucha wrote: > > On Tue, Sep 05, 2017 at 03:47:37AM -0700, Roman Akopov wrote: > > So the deal is that each model's _meta caches a bunch of structures > storing the list of fields, reverse relations, and so on, the first > time you a

Re: Dynamic model, reverse foreign key not working

2017-09-05 Thread Michal Petrucha
On Tue, Sep 05, 2017 at 04:56:10AM -0700, Roman Akopov wrote: > Unfortulately, it did not help. I have added "model._meta._expire_cache()" > call almost everywhere, before generating dynamic model, after, between > steps, it did not help a bit, error is exactly the same. > Also, I have additional

how to write APIview to access a specific item by using APIViews only

2017-09-05 Thread Rakhee Menon
CODE: class FormList(APIView): def get(self, request, id): import ipdb;ipdb.set_trace() item_obj = ItemMaster.objects.get(id=id) serializer = ItemMasterSerializer(forms,many=False) return Response(serializer.data, content_type="application/json") def get(self,request): forms = ItemMaster.objects.a

error while creating superuser

2017-09-05 Thread Sandeep S
Hi All, I am getting error when I tried to create a superuser. I am using Cassandra 3.0 with Django 1.11.4. I used this command in Pycharm: manage.py createsuperuser error: "cassandra.protocol.SyntaxException: " What am I doing wrong? -- You received this message because you are subscribe

Re: Dynamic model, reverse foreign key not working

2017-09-05 Thread Roman Akopov
I call it on target model, the one with reverse relation missing. On Tuesday, September 5, 2017 at 4:40:02 PM UTC+4, Michal Petrucha wrote: > > On Tue, Sep 05, 2017 at 04:56:10AM -0700, Roman Akopov wrote: > > Unfortulately, it did not help. I have added > "model._meta._expire_cache()" > > call

Re: how to write APIview to access a specific item by using APIViews only

2017-09-05 Thread Vijay Khemlani
To retrieve a particular object in your API you should implement it in a method called "retrieve", not "get", if I remember correctly On Tue, Sep 5, 2017 at 10:28 AM, Rakhee Menon wrote: > CODE: > > class FormList(APIView): > def get(self, request, id): > import ipdb;ipdb.set_trace() > item_obj

Re: Dynamic model, reverse foreign key not working

2017-09-05 Thread Roman Akopov
I have investigated a bit more and looks lite it is Options._relation_tree property, it's value is calculated by _populate_directed_relation_graph only once and it is @cached_property, so I see no valid way to reset value On Tuesday, September 5, 2017 at 4:40:02 PM UTC+4, Michal Petrucha wrote:

Django security releases issued: 1.11.5 and 1.10.8

2017-09-05 Thread Tim Graham
Today the Django team issued 1.11.5 and 1.10.8 as part of our security process. These releases address a security issue, and we encourage all users to upgrade as soon as possible: https://www.djangoproject.com/weblog/2017/sep/05/security-releases/ As a reminder, we ask that potential security i

Displaying a photo from a database

2017-09-05 Thread ron_w_add via Django users
Hello I have this photo: wildlifephotos/2017/07/26/2017-06-30_Lansdowne_-_Syrphus_Sp_A_01.JPG in the project’s following folder mysite/media as per the following (simplified) tree C:. | \---mysite | db.sqlite3 | manage.py | +---media | |

Re: Displaying a photo from a database

2017-09-05 Thread James Schneider
> > However, when I try to add the photo to the page I’m getting stuck. If I > try adding ‘ > > {% block content %} > > < Back > {% if pht != None %} >{{ pht.name }} >{{ pht.location.name }} >{{ pht.description }} >{{ pht.photo_taken }} > "responsive-img"

Re: error while creating superuser

2017-09-05 Thread James Schneider
On Tue, Sep 5, 2017 at 5:42 AM, Sandeep S wrote: > Hi All, > > I am getting error when I tried to create a superuser. I am using > Cassandra 3.0 with Django 1.11.4. > > I used this command in Pycharm: manage.py createsuperuser > > error: "cassandra.protocol.SyntaxException: [Syntax error in CQL

Re: Using data migration to create initial users errors

2017-09-05 Thread Tim Huang
My instinct tells me that there may be something wrong with the classmethod normalize_username in _create_user method. What Matias suggested works. -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop recei

Re: how to write APIview to access a specific item by using APIViews only

2017-09-05 Thread Rakhee Menon
On Tuesday, September 5, 2017 at 8:06:09 PM UTC+5:30, Vijay Khemlani wrote: > > To retrieve a particular object in your API you should implement it in a > method called "retrieve", not "get", if I remember correctly > > On Tue, Sep 5, 2017 at 10:28 AM, Rakhee Menon > wrote: > >> CODE: >> >> cla

Re: how to write APIview to access a specific item by using APIViews only

2017-09-05 Thread Rakhee Menon
> > But while using APIView there is no retrieve method.We have only >> get,post,delete and put methods. >> > As there is lot of customization in my API i need to use APIViews only... > So please tell me how to access specific items using APIViews > -- You received this message because you are

Re: Using data migration to create initial users errors

2017-09-05 Thread Melvyn Sopacua
This is an old thread about 1.7. Things have improved since then: https://docs.djangoproject.com/en/1.11/topics/migrations/#model-managers On Wed, Sep 6, 2017 at 4:01 AM, Tim Huang wrote: > My instinct tells me that there may be something wrong with the classmethod > normalize_username in _create

Re: how to write APIview to access a specific item by using APIViews only

2017-09-05 Thread James Schneider
On Sep 5, 2017 6:28 AM, "Rakhee Menon" wrote: CODE: class FormList(APIView): def get(self, request, id): import ipdb;ipdb.set_trace() item_obj = ItemMaster.objects.get(id=id) serializer = ItemMasterSerializer(forms,many=False) return Response(serializer.data, content_type="application/json") def

Re: how to write APIview to access a specific item by using APIViews only

2017-09-05 Thread Rakhee Menon
Customization in the sense..I have lot of calculations to do so its not possible using viewset. -- 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+uns

Re: how to write APIview to access a specific item by using APIViews only

2017-09-05 Thread James Schneider
On Sep 5, 2017 11:21 PM, "Rakhee Menon" wrote: Customization in the sense..I have lot of calculations to do so its not possible using viewset. Ah, that isn't reflected in the example code you provided. Fair enough. Custom logic like calculations can be integrated in to any view or viewset. Oft

Re: how to write APIview to access a specific item by using APIViews only

2017-09-05 Thread James Schneider
> > > Custom logic like calculations can be integrated in to any view or > viewset. Often times the logic is broken out in to separate standalone > functions and called by some simple overrides on the view[set]. > I forgot to mention, you may want to integrate that business logic directly in to yo