Re: Django multi table on same model

2017-07-14 Thread Guilherme Leal
That kind of table partitioning, usualy is made on the database level, not on the application level. You should check your database documentation to learn how implement that logic. On PostgreSQL, check this . 2017-07-14 6:18 GMT-03

Re: Bug: Manually changing "_meta.db_table" for model causes "missing FROM-clause entry for table" error

2017-07-13 Thread Guilherme Leal
I don't think that sould be possible to change real table name "on the fly". If I'm not mistaken, that kind of attribute is used by model's meta class during class creation process to populate the django model cache, which in turn only occurs during the django configuration step. 2017-07-13 14:08

Re: Django + React: Shared Model Consistency

2017-07-05 Thread Guilherme Leal
es were provided should help (at least the developers trying to use > your API). > > Em 05/07/2017 15:17, Guilherme Leal escreveu: > > I'm starting a new project that uses Django (with DRF) as backend and > React as frontend but I have some concerns about data consistency acro

Re: Django + React: Shared Model Consistency

2017-07-05 Thread Guilherme Leal
, an invalid gender, you can validate that in your > DRF and just spit out the errors for the client. > > But there is no other way (that I can see) to let the client configure > itself, without having a valid values list for that. > > On Wed, Jul 5, 2017 at 3:17 PM, Guilherme Leal

Django + React: Shared Model Consistency

2017-07-05 Thread Guilherme Leal
I'm starting a new project that uses Django (with DRF) as backend and React as frontend but I have some concerns about data consistency across what the API endpoints might expect, and what the client with React could provide. Exemple: Lets say I have the following model: class Person(models.Mode

Re: Database validation error - Even after manage.py flush.

2017-06-30 Thread Guilherme Leal
Hey man, if you have any problem, ALWAYS check the django documentation in the first place. IMO, its preaty extensive and complete, and always helped me through the 4~5 years I'm developing with django. After that, stackoverflow always help ( =P ). And if the things still goes badly, django-users

Re: Database validation error - Even after manage.py flush.

2017-06-30 Thread Guilherme Leal
Np man, always glad to help! Just to seal the case, that happened because django dont edit the migration files itself (well, not through the normal cycle of "makemigrations">"migrate"). You generated a migration with an invalid config, and didnt even mattered if you tried to correct that "default

Re: Database validation error - Even after manage.py flush.

2017-06-30 Thread Guilherme Leal
Just to clarify: Change the default value to "False"; Delete the migration file (0012_auto_20170630_1027); Run makemigrations; Run migrate. 2017-06-30 15:08 GMT-03:00 Guilherme Leal : > Have you re-ran the "makemigrations"? If that didnt work, dele

Re: Database validation error - Even after manage.py flush.

2017-06-30 Thread Guilherme Leal
Have you re-ran the "makemigrations"? If that didnt work, delete the migration file (0012_auto_20170630_1027) and run "makemigrations" again. 2017-06-30 15:04 GMT-03:00 : > I also did the "If all else fails, reboot your computer" and still have > the same problem. Haha. I think I'm screwed. > >

Re: Database validation error - Even after manage.py flush.

2017-06-30 Thread Guilherme Leal
>>>django.core.exceptions.ValidationError: [u"'' value must be either True or False."] Have you tried to set the default value of the BooleanField as True or False? BooleanFields must have a valid boolean as default value and so happends that empty string is not a valid boolean. Change the d

Re: First models.py needs tuning

2017-06-29 Thread Guilherme Leal
y (literally is the value that is saved on the DB field), and the value is the "display value". Em 29 de jun de 2017 7:14 PM, "Rich Shepard" escreveu: > On Thu, 29 Jun 2017, Guilherme Leal wrote: > > It wouldn't be the case to use the field choices?

Re: First models.py needs tuning

2017-06-29 Thread Guilherme Leal
It wouldn't be the case to use the field choices? https://docs.djangoproject.com/en/1.11/ref/models/fields/#django.db.models.Field.choices 2017-06-29 18:07 GMT-03:00 Rich Shepard : > On Wed, 19 Apr 2017, Mike Dewhirst wrote: > > Second, I have a couple of fields with postgres check constraints;

Re: Dynamic Models

2017-01-10 Thread Guilherme Leal
Well, some more context then: I've worked at a company that have exactly the same logic writen in perl and using an ORM built inside the company. The ideia was to build a plataform to interact with the DB, and with this interaction, extend the information about the table been created/modified or t

Re: Dynamic Models

2017-01-10 Thread Guilherme Leal
ivial, though with any kind of > dynamics you'll going to loose most of the ORM goodies. > > This kind of leads to question that is Django ORM really needed for you at > all? How about having NoSQL databases like ArangoDB to handle all the > dynamics? > > On 04.01.2017 22:

Re: Dynamic Models

2017-01-06 Thread Guilherme Leal
@Michal Petrucha That was one of the insights that I've been wanted. One way or another I will try, but will keep in mind these points. Thank you! -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving

Re: Dynamic Models

2017-01-05 Thread Guilherme Leal
aybe 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 Python including its models, though it’s not Django. > > > > *From:* django-users@googlegroups.com [mailto:django-users

Re: Dynamic Models

2017-01-05 Thread Guilherme Leal
> > - No ORM unless you implement it > > - You have to be careful keeping the index entries updated when needed > > - Limited to basic data types (int, char, decimal, date, file) > > - No DB integrity checks > > > > On 1/5/17, Guilherme Leal wrote: > >&g

Re: Dynamic Models

2017-01-05 Thread Guilherme Leal
#x27;s models > - Querying via ElasticSearch is not so bad and is quite fast > > Cons: > - Quite slow when you need to update data in the database > - No ORM unless you implement it > - You have to be careful keeping the index entries updated when needed > - Limited to basic data typ

Re: Dynamic Models

2017-01-05 Thread Guilherme Leal
5 14:05 GMT-02:00 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

Re: Dynamic Models

2017-01-05 Thread Guilherme Leal
u 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 U

Re: Dynamic Models

2017-01-05 Thread Guilherme Leal
ith 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: > >>

Dynamic Models

2017-01-04 Thread Guilherme Leal
)" or something similar) into the cache "on the fly". Guilherme Leal -- 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: Define Django Base Model Class

2016-12-28 Thread Guilherme Leal
ish this, but I would advise > against it. > > Instead of having implicit or hidden behaviour you should instruct your > developers to use from myproject import models instead of from django.db > import models > > > On Wed, Dec 28, 2016 at 7:13 PM, Guilherme Leal > wrote

Define Django Base Model Class

2016-12-28 Thread Guilherme Leal
In one of my django projects, I have a base model (that inherits from django.db.models.Model), and is the base model class that all my models uses. I would like to "override" the base model class from django, so everytime a developer would import the base model class with "from django.db.models

Re: REST Beginner's Tutorial

2015-05-12 Thread Guilherme Leal
The get status 500 "per se" may or may not be an error. Please, send the traceback of the error, otherwise, we can't help you much. Em ter, 12 de mai de 2015 às 10:00, Guilherme Leal escreveu: > Sorry, but despite the fact that you have unapplied migrations, there is >

Re: REST Beginner's Tutorial

2015-05-12 Thread Guilherme Leal
o issues (0 silenced). > > You have unapplied migrations; your app may not work properly until they > are app > lied. > Run 'python manage.py migrate' to apply them. > May 12, 2015 - 18:07:40 > Django version 1.8.1, using settings 'tutorial.settings' > Start

Re: REST Beginner's Tutorial

2015-05-12 Thread Guilherme Leal
The shortest way to go is to pick a complete framework for RESTfull apps, like Django Rest Framework . Its complete out of the box, and yet simple as it works as the Django Class Based Views. There are others frameworks ofcourse, or you can do it yourself wit

Re: Sending Data from client side(another computer) to Django(my computer) using Socket library

2015-05-11 Thread Guilherme Leal
e wrote: >> >> > Meaning write JavaScript code to make a request? >> > how can achieve it other than writing JavaScript code? >> > >> > >> > On Mon, May 11, 2015 at 3:13 PM, Guilherme Leal >> wrote: >> > >> > > The "navig

Re: Sending Data from client side(another computer) to Django(my computer) using Socket library

2015-05-11 Thread Guilherme Leal
Its fairly trivial, and JQuery makes it even simpler <https://api.jquery.com/jquery.post/>. 2015-05-11 10:18 GMT-03:00 steve malise : > Meaning write JavaScript code to make a request? > how can achieve it other than writing JavaScript code? > > > On Mon, May 11, 2015 at 3

Re: Sending Data from client side(another computer) to Django(my computer) using Socket library

2015-05-11 Thread Guilherme Leal
The "navigation" of your browser always performs a GET method. If you're trying to test that kind of request in the browser, the best aproach would be open the JavaScript and make the request there. 2015-05-11 10:09 GMT-03:00 steve malise : > client code: > import httplib > import urllib > > data

Django Logging Send Email on Openshift

2015-04-06 Thread Guilherme Leal
Is anybody using OpenShift for Django hosting? I'm having trouble configuring the Logging engine to send emails on errors and could use some help. -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving

Re: Import error - No module named http

2015-03-18 Thread Guilherme Leal
Nivin and Shinto, You are forgetting to instantiate the HTTPConnection object: Exemple: *import httplib* *from xml.dom import minidom* *http = httplib.HTTPConnection("http://mydomain.com ")* *http.request("POST", "/path/to/my/webservice", body=xml, headers = {* *"Host

Re: Import error - No module named http

2015-03-18 Thread Guilherme Leal
you didnt instanciated the HttpConnection Object Check the docs. https://docs.python.org/2/library/httplib.html#httpconnection-objects Em qua, 18 de mar de 2015 às 13:24, Nivin Paul escreveu: > I need to call a web service that written using SOAP from a django > application , to do that i used

Re: Reload App

2015-03-18 Thread Guilherme Leal
django app, > without even closing the socket FD, meaning your users won't notice, well > they may notice that will be a little delay on one request, but tht will be > transparent, they won't see > > On Tue, Mar 17, 2015 at 3:27 PM, Guilherme Leal > wrote: > >> Is

Re: implementing dynamic models

2015-03-17 Thread Guilherme Leal
I came up with the same conclusion. Em ter, 17 de mar de 2015 10:56, Django User escreveu: > yes, i did. however, none of those approaches look compelling for a > production system. > > > On Tuesday, March 17, 2015 at 6:06:11 PM UTC+5:30, Guilherme Leal wrote: > >> did

Reload App

2015-03-17 Thread Guilherme Leal
Is there a way to "reload" a django app? What i need is basically, re-run the Apps.populate, to trigger the discover of new apps and models. and now you're asking "What would he want this?". Basically, i'm trying to create a feature where the users of my project (who also will be devellopers) can

Re: implementing dynamic models

2015-03-17 Thread Guilherme Leal
did you looked into some of these <http://stackoverflow.com/questions/7933596/django-dynamic-model-fields/7934577#7934577> aproaches? Em ter, 17 de mar de 2015 às 09:07, Guilherme Leal escreveu: > I REALLY would appreciate some feature like this. If some > developer/engeneer has

Re: implementing dynamic models

2015-03-17 Thread Guilherme Leal
I REALLY would appreciate some feature like this. If some developer/engeneer has implemented something like it, please share your knowledge. The first thing i would test, is to save the model in a .py file (i think that saving the model might be important for the performance, since the python int

Re: Load Template without rendering/parsing

2015-03-16 Thread Guilherme Leal
. Perhaps "angular_templates"? > > On Mon, Mar 16, 2015 at 10:24 AM, Guilherme Leal > wrote: > >> Just to clarify the things a little bit more to Avraham.. i DO want the >> request to pass through django >> >> what i dont want is that django treat

Re: Load Template without rendering/parsing

2015-03-16 Thread Guilherme Leal
Just to clarify the things a little bit more to Avraham.. i DO want the request to pass through django what i dont want is that django treat this particular html as a template. Em seg, 16 de mar de 2015 às 11:15, Guilherme Leal escreveu: > Can you give me an exemple? > > Em seg,

Re: Load Template without rendering/parsing

2015-03-16 Thread Guilherme Leal
> > you can not use render to return on the view, instead return the file > without loading it in the template renderer > > On Mon, Mar 16, 2015 at 3:55 PM, Guilherme Leal > wrote: > >> and the {% ssi %} was the winner :) >> >> the only thing that i didn

Re: Load Template without rendering/parsing

2015-03-16 Thread Guilherme Leal
jango routes ‘/‘ to that view > and it renders the home page. > > Or you could use {% ssi %} to include the angular stuff. > > François > > > > On Mar 16, 2015, at 9:01 AM, Guilherme Leal wrote: > > > > This solution crossed my mind, and the only down side

Re: Load Template without rendering/parsing

2015-03-16 Thread Guilherme Leal
4() > ># Return the file > return HttpResponse(content=fileHandle.read(), > content_type=’text/html') > > François > > > > On Mar 16, 2015, at 8:49 AM, Guilherme Leal wrote: > > > > Hello! > > > > Anyone knows a way to load a templa

Load Template without rendering/parsing

2015-03-16 Thread Guilherme Leal
Hello! Anyone knows a way to load a template file WITHOUT parsing/rendering it? To ilustrate a bit more: I have a django app serving a restfull api, and everithing is just fine with it. The front end that consumes this api, is an Angular.js single page app. To centralize the routing logic, what

Re: subdomains and HOST in settings.py?

2015-02-05 Thread Guilherme Leal
> > On Thu, Feb 5, 2015 at 9:37 PM, Guilherme Leal > wrote: > >> I've made something similar. The app had multiple databases, and the >> database that was connected was based on the subdomain of the request. >> Basically, if you tried to log in with "h

Re: subdomains and HOST in settings.py?

2015-02-05 Thread Guilherme Leal
I've made something similar. The app had multiple databases, and the database that was connected was based on the subdomain of the request. Basically, if you tried to log in with "http://test.exemple.com";, the database that would be used would be "test". The key to this feature was that the auth

Re: subdomains and HOST in settings.py?

2015-02-05 Thread Guilherme Leal
Basiacally, what you want to do is change the request subdomain based on the user that logs on to the app. Ex: the url that hosts the login form (or whatever it is) is like "http://exemple.com/login";. After the user correctly logs in, every request will be made to de url "http://.exemple.com"

Re: Create Django token-based Authentication

2015-01-30 Thread Guilherme Leal
Django REST Framework already implements token authentication (check this out). The rest of the logic is preaty much implementation by the "client" site. But if you do want

Re: Deploying Django on Docker

2015-01-08 Thread Guilherme Leal
Honestly, i dont have the time to participate on this project right now, but i would use a tool like this for small projects. FOR SURE. Em Thu Jan 08 2015 at 08:45:56, Anssi Kääriäinen escreveu: For a long time I have been battling with the following problem: how to > deploy Django in an easy, m

Re: Django vs ExtJS

2014-12-30 Thread Guilherme Leal
, especially when the requirement is > to have these devs on-site (.nl / .be area). > > > > Op 30 dec. 2014 om 11:36 heeft Ariel Calzada > het volgende geschreven: > > DJANGO + Tastypie is your TEAM for REST Services, forget Java :) > > 2014-12-30 5:34 GMT-05:00 Guilher

Re: Django vs ExtJS

2014-12-30 Thread Guilherme Leal
o create REST services in java for each > backend and use ExtJS to query and visualize the results. With DJango I'm > trying to combine these into one, whilst staying compatible by using > tastypie as a REST service (so ExtJS can connect to that). > > joris > > >

Re: Django vs ExtJS

2014-12-29 Thread Guilherme Leal
Sincerely, I can't see the ExtJS's Models as true models on an MVC (or MVT for instance) context, since the only real uses I've seen of them is to bind form controls to any "model like" (basically anything) structure. Therefore, the best comparsion for the ExtJS would be AngularJS (this is my point

Re: Can't open manage.py

2014-12-19 Thread Guilherme Leal
Are you sure that your shell is running on the same folder that contains the manage.py? Em Fri Dec 19 2014 at 09:53:05, Valéria Pacheco escreveu: > I ran this command $ python manage.py migrate > > and the following error occurs > > python: can't open file 'manage.py': [Errno 2] No such file or