finding get_user_model

2017-01-05 Thread Rasika
from django.contrib.auth import get_user_model why I am not able to find the code forget_user_model in auth app. While when I searched https://docs.djangoproject.com/en/dev/_modules/django/contrib/auth/#get_user_model I find this definition def get_user_model(): """ Returns the User model that

RE: Dynamic Models

2017-01-05 Thread Matthew Pava
That is fascinating. I have been thinking about a way of handling our product categories so that we could have better data validation on certain "fields" within a part category. However, I have been leaning more towards having a comma separated list or PostgreSQL ArrayField to store the multip

Re: Dynamic Models

2017-01-05 Thread Vijay Khemlani
"That was exacly the points i'm willing to avoid. Had any problems with the metaclass approach? Why did you chose the "virtual model" concept?" We had to represent multiple product categories, each with their own structure and particular fields. In the end we had around 700 virtual models, which

Re: Migration issue on Webfaction

2017-01-05 Thread Avraham Serour
> which to my understanding is saying that migration 0033 is looking for content within migration 0032, which it can't find. yes, check that you committed the file, I've had this kind of error too many times just because after creating the migration I forgot to git add If you removed your migrati

Re: Dynamic Models

2017-01-05 Thread Michal Petrucha
On Wed, Jan 04, 2017 at 06:38:54PM -0200, Guilherme Leal wrote: > Is there a way to populate Django model cache on the fly? > I was thinking about saving the model definition on some backend (database > for instance) and loading as needed. This way we can basically build a > custom admin interface

RE: Dynamic Models

2017-01-05 Thread Matthew Pava
It does sound like a fun and exciting project. Unfortunately, I rarely use the admin, and I don’t see myself using it to enter new models. However, as I type this, I might be convinced to use it. I currently use PyCharm as my IDE for Django development, and it’s decent. From: django-users@go

Re: Dynamic Models

2017-01-05 Thread Guilherme Leal
@Matthew Pava >Going down that route, we would basically be developing an IDE for Django models Well, thinking about it, we can say that literally IS an IDE for Django. That's my goal at least. (actually, i'm wishing to use graphene for graphql exposition of default manager too) Anyone intereste

RE: Dynamic Models

2017-01-05 Thread Matthew Pava
Going down that route, we would basically be developing an IDE for Django models. It would definitely be possible, but it would involve a lot of work. Maybe it could even be integrated into django-admin one day. You may want to check out http://www.web2py.com/ which does its own web IDE for P

Re: Dynamic Models

2017-01-05 Thread Guilherme Leal
@ludovic coues Like what? let the interface generate the python models? I thought about that, but it doesnt seem viable. Have any ideias? 2017-01-05 16:26 GMT-02:00 ludovic coues : > Would it work if the interface provide a download for a bunch of > models.py file ? > > 2017-01-05 19:12 GMT+01:00

Re: Dynamic Models

2017-01-05 Thread Guilherme Leal
@Vijay Khemlani - No ORM unless you implement it - No DB integrity checks That was exacly the points i'm willing to avoid. Had any problems with the metaclass approach? Why did you chose the "virtual model" concept? 2017-01-05 16:12 GMT-02:00 Vijay Khemlani : > I had to implement dynamic models

Re: Dynamic Models

2017-01-05 Thread ludovic coues
Would it work if the interface provide a download for a bunch of models.py file ? 2017-01-05 19:12 GMT+01:00 Vijay Khemlani : > I had to implement dynamic models for our project. > > In the end we represented them in four django models, two for the > "virtual models" and its fields and two for the

Re: Dynamic Models

2017-01-05 Thread Vijay Khemlani
I had to implement dynamic models for our project. In the end we represented them in four django models, two for the "virtual models" and its fields and two for the actual data We used the django model system for these four base classes, but the "virtual models" on top of them were custom (so no

Re: using django with multiple apps

2017-01-05 Thread bng0802
Thanks Kirby, I will get down to the nitty gritty and let you know what I found out. I appreciate your help - Ben On Thursday, January 5, 2017 at 12:36:36 AM UTC-8, C. Kirby wrote: > > Have you worked through the Django tutorial? Generally the django > documentation is considered to be some of t

Re: Dynamic Models

2017-01-05 Thread Guilherme Leal
I know metaclasses, and i know that the django models uses some "meta class magic" to register the models on the model cache. I gess i need to test the implication of refreshing the model cache on the fly, since it doesn't have a "natural" way to refresh itself. 2017-01-05 14:05 GMT-02:00 Avraham

Re: Dynamic Models

2017-01-05 Thread Avraham Serour
you should read about metaclasses, basically it enables you to build class definitions in runtime. http://stackoverflow.com/questions/13/what-is-a-metaclass-in-python On Thu, Jan 5, 2017 at 6:02 PM, Guilherme Leal wrote: > The "migrations on the fly" thing dont get to be a problem (since I

Re: Dynamic Models

2017-01-05 Thread Guilherme Leal
The "migrations on the fly" thing dont get to be a problem (since I gess we could call the migrations api to generate the migration). My concenrs would be contructing and refreshing the model cache (I say the "model cache" like the list accessed through django.apps.get_models() ), and the OBVIOUS p

Re: Dynamic Models

2017-01-05 Thread Beautifulloop
I think you just need to define a generic model. I dont see how what you are asking is feasible since it would require that (on the fly that migrations are made). You can write a generic model where the types can be represented by a field name. On Thursday, 5 January 2017 17:33:07 UTC+2, Guilh

Re: Dynamic Models

2017-01-05 Thread Guilherme Leal
My idea was to build an user interface for the model definition, so the developer (or in this case, the user) could define the model using a register form. Like a user interface to define the model layer, I gess. 2017-01-05 12:34 GMT-02:00 Avraham Serour : > I guess you could play with metaclass

Re: Dynamic Models

2017-01-05 Thread Avraham Serour
I guess you could play with metaclasses and generate the class definition on runtime using information from the database But why? You can save the model definition on files, why saving them to database and complicate your life? On Wed, Jan 4, 2017 at 10:38 PM, Guilherme Leal wrote: > Is there a

RE: Abridged summary of django-users@googlegroups.com - 25 updates in 12 topics

2017-01-05 Thread Matthew Pava
We don’t typically import urls.py. Why are you importing it, and where are you importing it? From: django-users@googlegroups.com [mailto:django-users@googlegroups.com] On Behalf Of Erik Mvñoz Sent: Thursday, January 5, 2017 3:03 AM To: django-users@googlegroups.com Subject: Re: Abridged summary

Re: Abridged summary of django-users@googlegroups.com - 25 updates in 12 topics

2017-01-05 Thread Erik Mvñoz
Hello, I am Erik... noob to Django... i am getting a circular import error on importing urls.py any suggestions On Wed, Jan 4, 2017 at 5:03 AM, wrote: > django-users@googlegroups.com > > Google

Re: Use case for ALLOWED_HOSTS

2017-01-05 Thread Vijay Khemlani
To prevent Host header poisoning https://www.djangoproject.com/weblog/2013/feb/19/security/#s-issue-host-header-poisoning On 1/5/17, Antonis Christofides wrote: > If Django is listening at http://mydjangoproject.com/, then the web server > is > normally configured to proxy pass mydjangoproject.c

Re: Facing performance issue bcoz of db data

2017-01-05 Thread Vijay Khemlani
You would need to execute tens of thousands of usual queries to even come close to 1 hr of execution. I'm still not sure whether you are making a huge unoptimized query or thousands of subsequent queries, but you can go through your code using pdb (or ipdb) and check which line is causing the perf

Re: good pratices to write many lines on database

2017-01-05 Thread Vijay Khemlani
You could queue the tasks in a broker (rabbitmq for example) and use a fixed number of celery workers to process them and save them to the database, assuming: - you don't have 1000 requests per second all the time - you don't need the data to be stored immediately On 1/4/17, Avraham Serour wrote

Re: browser testing

2017-01-05 Thread Mike Dewhirst
Antonis - that looks really good. Thanks for sharing ... Mike On 5/01/2017 7:20 PM, Antonis Christofides wrote: Some time ago I was in a small team of programmers and I thought it was unreasonable for everyone to learn Selenium, so I created django-selenium-clean, a front-end, which is much

Use case for ALLOWED_HOSTS

2017-01-05 Thread Antonis Christofides
If Django is listening at http://mydjangoproject.com/, then the web server is normally configured to proxy pass mydjangoproject.com requests to django. If I visit http://server_ip_address/ or http://another_domain_that_points_to_the_same_server/, nginx/Apache should normally not proxy pass the requ

Re: Multiple Fields as Primary Key in MySQL - Django 1.10

2017-01-05 Thread ramesh
Thank you very much Simone and Michal for your timely response. I made all the fields those are part of primary keys as unique and added a dummy auto-increment ID for these tables and did migrations. So far so good. Thanks, Ramesh. On Tuesday, January 3, 2017 at 5:35:07 PM UTC+5:30, ramesh wro

Re: using django with multiple apps

2017-01-05 Thread C. Kirby
Have you worked through the Django tutorial? Generally the django documentation is considered to be some of the best framework documentation there is. I sure think so. Specific to your problem, chances are you are having some trouble with either namespacing or scoping. A few things to make sur

Re: browser testing

2017-01-05 Thread Antonis Christofides
Some time ago I was in a small team of programmers and I thought it was unreasonable for everyone to learn Selenium, so I created django-selenium-clean, a front-end, which is much easier and with documentation that includes tutorial and reference. https://github.com/aptiko/django-selenium-clean/