Re: Setting default foreign key value of type UUID

2018-02-19 Thread Vinicius Assef
What's the problem? On 16 February 2018 at 15:00, Dragan Mestrovik wrote: > Hi, > > I am getting issue with setting default foreign key value of type UUID. My > models are > > import uuid > from django.db import models > > # Create your models here. > class Provider(models.Model): > id = models

Re: Admin site not working properly using passenger on shared hosting. Need help setting it up properly

2018-03-02 Thread Vinicius Assef
Some time ago I wrote this post [0] about setting Python and Django on Dreamhost. They use passenger. Maybe it's useful to you. [0] http://aprenda-python.blogspot.com.br/2016/06/setup-python-with-django-or-pyramid-on-dreamhost.html On 2 March 2018 at 04:56, Tanvir Ahmed wrote: > Hello, > >

Re: Admin site not working properly using passenger on shared hosting. Need help setting it up properly

2018-03-02 Thread Vinicius Assef
Probably you have a problem with route. Check your routes.py again. On 2 March 2018 at 10:28, wrote: > > > On Friday, March 2, 2018 at 6:24:49 PM UTC+6, Vinicius Assef wrote: >> >> Some time ago I wrote this post [0] about setting Python and Django >> on Dr

Re: Admin site not working properly using passenger on shared hosting. Need help setting it up properly

2018-03-02 Thread Vinicius Assef
My bad. It's urls.py On 2 March 2018 at 12:25, Vinicius Assef wrote: > Probably you have a problem with route. > > Check your routes.py again. > > On 2 March 2018 at 10:28, wrote: >> >> >> On Friday, March 2, 2018 at 6:24:49 PM UTC+6, Vinicius Assef wro

Re: Can anyone explain the overidding of save() of below code?

2018-03-21 Thread Vinicius Assef
You are calling save() in parent class. Read more about it here: https://docs.python.org/3/library/functions.html?highlight=super#super On 21 March 2018 at 12:52, Utpal Brahma wrote: > /* also explain super ().save() */ > > from django.db import models > > class Blog(models.Model): > name =

Re: Frontend

2018-05-15 Thread Vinicius Assef
Hi. No, Django cannot replace javascript. Django works in the backend. There are some projects bringing Python to browser. One of them is brython. Certainly there are others, too. On 15 May 2018 at 07:48, Chekib Gmt wrote: > Hello, > I would like to know if the django framework can replace

Re: Open Sqlite database file directly in django

2018-05-22 Thread Vinicius Assef
It depends. If tables have always the same schema and only their data is different, you can use `manage.py inspectdb` [0] to create models and develop your views. [0] https://docs.djangoproject.com/en/2.0/ref/django-admin/#inspectdb On 22 May 2018 at 11:01, PASCUAL Eric wrote: > Re, > > > Bu

Re: Open Sqlite database file directly in django

2018-05-24 Thread Vinicius Assef
You can use Django to access Sqlite. On 24 May 2018 at 03:22, Sourabh Jaiswal wrote: > Hi, > > Thanks a Lot for your reply. > > Using standard python lib you are saying that I should send the data from > view to template render using context dictionary.. right? > > But in my case data can be huge

Re: How to save one field value from a model to another model field

2016-08-17 Thread Vinicius Assef
Your method get_shift_date() has a syntax error. Your save() method has identation problem. Please correct them and send us the right code. On Tuesday, 16 August 2016 14:49:32 UTC-3, Md. Ohiduzzaman wrote: > > > > down votefavorite >

Re: Am I missing a design pattern? My views code somehow isn't as elegant as it should be...

2016-10-22 Thread Vinicius Assef
I'd say you're missing a service layer. It's known as a good practice to not have "business rules" in your views. IP lookup should be done in your view anyway, because it's a "web related thing". The `save_the_lead()` and email sending should be in the service layer. Extending a little bit and t

Re: Am I missing a design pattern? My views code somehow isn't as elegant as it should be...

2016-10-23 Thread Vinicius Assef
u see good examples of "programming to an interface" concept when you read about magic methods in Python docs. These "interfaces" are expected to make your own comparisons, evaluating True/False or object length and so on. See docs here: https://docs.python.org/3/reference/datam

Re: Running django on demand via my PyQt4 Standalone app

2016-10-24 Thread Vinicius Assef
Avraham. I can't imagine how settings.py would be called to configure database stuff. Could you? It made me curious about that. -- Vinicius Assef -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop r

Re: Running django on demand via my PyQt4 Standalone app

2016-10-25 Thread Vinicius Assef
Absolutely! :-D Thank you. On 24 October 2016 at 21:01, Avraham Serour wrote: > does this help? > > https://docs.djangoproject.com/en/1.10/topics/settings/#calling-django-setup-is-required-for-standalone-django-usage > > > On Tue, Oct 25, 2016 at 12:13 AM, Vinicius Assef &g

Re: Django Project Structure

2016-10-26 Thread Vinicius Assef
See this link: https://docs.djangoproject.com/en/1.10/intro/tutorial01/#creating-the-polls-app The box "Projects vs app" can help you. On 26 October 2016 at 04:35, Deep Shah wrote: > I have a django project which is a loyalty program for restaurants. The > different database tables are- Users (

Re: How to GROUP BY in django?

2016-11-03 Thread Vinicius Assef
Maybe this can help you: https://docs.djangoproject.com/en/1.10/topics/db/aggregation/ On 3 November 2016 at 08:15, Awadhesh Meshram wrote: > How to GROUP BY using any identical field in database in Django? > > -- > You received this message because you are subscribed to the Google Groups > "Dja

Re: Negative User ID's

2016-11-04 Thread Vinicius Assef
On 4 November 2016 at 15:17, wrote: > My real question was "is there any issue using > negative IDs". I'd check it with the database backend. I mean, read its documentation. And make a double check on the django side. Maybe contacting one of core developers. -- You received this message beca

Re: Opinions on permissions stategy

2016-12-12 Thread Vinicius Assef
n, it will depend on the granularity of your permissions and how much you want to allow or forbid a child override a parent permission. -- Vinicius Assef -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this grou

Re: Opinions on permissions stategy

2016-12-13 Thread Vinicius Assef
thinking that I could use a mptt for this or maybe this would be > too complicated? > Using mptt I could have hierarchical permissions and check for permissions > on an object and each parent if permissions are not defined, but I would > need to change the way permissions are stored rig

Re: Opinions on permissions stategy

2016-12-15 Thread Vinicius Assef
On 15 December 2016 at 03:43, Avraham Serour wrote: > Hi, > > I've given a lot of thought on this, I have also searched for django apps > that deal with permissions, I didn't find something that implements > hierarchical object level permissions, I have a feeling that I am > overcomplicating thing

Re: good pratices to write many lines on database

2017-01-04 Thread Vinicius Assef
ot re-make requests in case of problems in your side. -- Vinicius Assef On 4 January 2017 at 14:39, Bruno Barbosa wrote: > Hello everybody! > > I have an application that receives about 1000 POST requests per second. On > each request I writte a line on my database table. On

Re: Overriding settings in Django when used by the models

2019-01-23 Thread Vinicius Assef
I hope you already got this solved. If not, there's a way to achieve what you are looking for. Get settings.MIN_SLUG_LENGTH from an environment variable. Use it in your settings.py: MIN_SLUG_LENGTH = os.getenv('ENV_MIN_SLUG_LENGTH') You'll need to set ENV_MIN_SLUG_LENGTH before running your test

Re: Why use CustomUserManager.create_user and not CustomUserManager.create?

2019-03-19 Thread Vinicius Assef
Also, there's the create_superuser() method. On Fri, 15 Mar 2019 at 01:48, Peter of the Norse wrote: > The biggest difference is that when you call create_user, it creates a > hash of the password. Eventually, create_user does call create, but only > after setting all the values properly. > > S

Re: ManyToManyField explanation

2019-04-08 Thread Vinicius Assef
I think these ones really good: https://docs.djangoproject.com/en/2.2/topics/db/examples/many_to_many/ On Mon, 8 Apr 2019 at 14:08, Khushal Kumar wrote: > > > Hi, > > > > Can anyone please give me an example which will demonstrate how > manytomanyfield works in Django. > > > > Thanks > > Sent fr

Re: Best way to modified third party app database restrictions?

2019-04-11 Thread Vinicius Assef
Try to set default_price.max_digits=9 Or you can create your own class extending DecimalField setting your defaults. On Thu, 11 Apr 2019 at 08:46, Yongky Tria Putra wrote: > Hello everyone, > > What is the best way to modified database field restrictions in third > party app (pretix)? Currentl

Re: reg: Django model sequense of the fields

2019-05-08 Thread Vinicius Assef
Is it a problem? On Wed, 8 May 2019 at 12:52, 'Amitesh Sahay' via Django users < django-users@googlegroups.com> wrote: > Hello Users, > > I am seeing a very strange issue with my Django models. > in my models.py, I have 21 fields. Out of them , the 6th field is > DASHBoard. However, when I see th

Re: Give advice on data migrations

2019-05-10 Thread Vinicius Assef
You should update your views and forms **before** removing old fields. On Fri, 10 May 2019 at 10:43, Victor Porton wrote: > Give advice: After migrating data, should I remove old fields immediately > or after I change the views and forms to use new models instead of old ones? > > -- > You receiv

Re: i am new i want full details of Django

2019-05-16 Thread Vinicius Assef
http://docs.djangoproject.com On Thu, 16 May 2019 at 10:59, Sanjay K wrote: > could u please provide the basic books > > -- > 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, sen

Re: [Model, ORM] Disabling a field before actually removing it

2019-06-24 Thread Vinicius Assef
I would, before everything, deploy code to stop using the field. After that, I would make it nullable and, then, remove it from the table. On Mon, 24 Jun 2019 at 05:32, Matthieu Rudelle wrote: > Yep, that's what we're planning on doing. > > It's kind of hacky though, it requires to warn all con

Re: Moving from django 1.3 to 1.9

2017-01-27 Thread Vinicius Assef
I'd advise you to be aware of third-party libraries. Sometimes they are dropped or can bring some incompatibilities. On 27 January 2017 at 08:42, Andreas Kuhne wrote: > I second this. Having moved from 1.3 to 1.9 in stages - I think this is > the best way to do it. Upgrade one minor version at a

Re: good 404 vs bad 404

2017-03-01 Thread Vinicius Assef
See suggestion below. On 1 March 2017 at 13:21, guettli wrote: > > Concrete example: we render HTML mails. They often contain broken links. > I don't want to report these. I would add a query string in these links to track them. E.g., "?autogenerated=1". So, links with this query string should

Re: Request for advice on refactoring a big Django project

2017-03-06 Thread Vinicius Assef
+1 On 6 March 2017 at 08:45, Antonis Christofides wrote: > Hi, > > I, like many people, am busy. I will generally not spend too much time on > the messages of this list. I delete most of them after only reading the > subject line. If I do choose to read the body, I expect to understand what > it

Re: Do something if there’s only one entry in the QuerySet, something else otherwise

2017-06-26 Thread Vinicius Assef
Explicit is better than implicit. So, I would stick with: qs = MyModel.objects.filter(...) if len(qs) == 0: # no record found elif len(qs) == 1: # one record found else: # many records found On 26 June 2017 at 07:32, Tzu-ping Chung wrote: > Hi all, > > I’m wondering what is the

Re: django webframework

2017-07-03 Thread Vinicius Assef
s. You're right, Django docs are awesome. I personally use Linux to develop and run Django. You can run Django in a JVM with some incompatibilities. Read the documentation Vijay sent you. [1] https://docs.python.org/3/tutorial/index.html -- Vinicius Assef On 3 July 2017 at 02:48, arun kuma

Re: Domain Driven Development

2015-11-12 Thread Vinicius Assef
ncle Bob: https://www.youtube.com/watch?v=HhNIttd87xs This article (http://blog.codefx.org/design/architecture/architecture-lost-years/) makes some analysis on the talk. -- Vinicius Assef. On Wednesday, 11 November 2015 20:46:15 UTC-2, Alex Newman wrote: > > I almost hate to bring this up,

Re: Isolated virtualenv and mod_wsgi - how do I do this on Apache

2018-07-02 Thread Vinicius Assef
I second Melvyn. On top of what he wrote, Bruce, I work in an environment with exactly this limitation: a shared hosting running Apache where I don't have access to ssh. I build my environment (install libs, for that matter) locally and transfer all my pack through ftp in one shot. As Melvyn to

Re: Isolated virtualenv and mod_wsgi - how do I do this on Apache

2018-07-02 Thread Vinicius Assef
Maybe this other article helps you understand the essence of a virtualenv: http://blog.aprendapython.com.br/articles/entendendo-virtualenv-1fr69/ Again, Google Translator is your friend. On 2 July 2018 at 09:28, Vinicius Assef wrote: > I second Melvyn. > > On top of what he wrote,

Re: Django production deployment on my VPS

2018-07-03 Thread Vinicius Assef
The first thing you really should install in your VPS server is fail2ban. Read about it. On 3 July 2018 at 03:04, Kamal Sharma wrote: > is this production environment with gunicorn and nginx is robust, can i > develop a big portal and deploy into it with no problem?? > > On Sun, Jul 1, 2018 at

Re: facing issue on unit test

2019-08-13 Thread Vinicius Assef
The database is cleared after each test method. So, in a new testcase your database is empty. On Tue, 13 Aug 2019 at 00:34, Arulselvam K wrote: > Have hosted the code @ "https://github.com/tbone230590/plib"; > Here is the problem I have two models Book and IssuedBook, IssuedBook have > foreign