Re: Upgrading Django (to 1.7)

2014-10-15 Thread Andrew Pinkham
Hi, Thanks to feedback from Fred and a few others, I've started editing Part III to make it more accessible. Part IV was originally set to be published today. Unfortunately, it is not ready to be published. As soon as the new Part III and Part IV are available, I will let you know. Thanks,

Re: Upgrading Django (to 1.7)

2014-11-25 Thread Andrew Pinkham
Hi, I have just updated Upgrading Django (to 1.7) Part III: Django 1.7's New Features. The App Registry and System Check Framework sections have been updated to be more accessible. For the article: afrg.co/updj17/a3/ For all of the material: afrg.co/updj17/ Part IV will be available before

Re: Upgrading Django (to 1.7)

2014-11-25 Thread Andrew Pinkham
Hi, Upgrading Django (to 1.7) Part IV: Upgrade Strategies is now available! For the article: afrg.co/updj17/a4/ For all of the material: afrg.co/updj17/ I've also provided a checklist of upgrade steps, as well as a list of all the links used throughout the series: afrg.co/updj17/cl/

mark_safe and ValidationError params

2015-02-06 Thread Andrew Pinkham
I'm currently running Django 1.7.4. Provided the following clean function on a form: def clean_slug(self): new_slug = self.cleaned_data['slug'].lower() if new_slug == 'invalid_value': raise ValidationError( # _ is ugettext

Re: mark_safe and ValidationError params

2015-02-08 Thread Andrew Pinkham
Thanks for the input, Mike. I actually think the behavior I showed here is a bug, and have started a thread on the developer mailing list to talk about it. https://groups.google.com/d/topic/django-developers/hs1Ikc8Tuuk/discussion Andrew -- You received this message because you are

Modify Installed_Apps settings

2015-02-18 Thread Andrew Pinkham
I have an app in Django 1.7.4 that I would like to use purely for testing. $ ./manage.py startapp override The app contains its own model, view, and URL pattern (the model overrides a model in another app, allowing me to test behavior in a specific case). For the moment, I have the app in

Re: Modify Installed_Apps settings

2015-02-18 Thread Andrew Pinkham
Thanks for the info, Joel. However, I'm trying to avoid creating a separate settings file. Any info about how to properly use modify_settings to add to installed apps or how to force the test runner to apply a specific migration would still be appreciated. Thanks, Andrew -- You received this

Re: Django 1.7.4, PostgreSQL: Migrate FK to M2M?

2015-02-18 Thread Andrew Pinkham
Hi Micky, When I had to migrate FK->M2M, I found that hand-hacking a migration file was the way to go. I wrote a multiple operation migration class that did the following: 1. create a M2M, nullable field, and set all defaults to null 2. use RunPython to run a function which takes the data from

Re: Sqlite3 to Postgres Migration?

2015-02-19 Thread Andrew Pinkham
On Feb 19, 2015, at 1:04 AM, talex wrote: > Am I correct that use of "python makemigrations" followed by > "python migrate", should copy the existing data into Postgres > and leave me with a working application? I'm afraid not. Migration allows for predictable and

Re: Modify Installed_Apps settings

2015-02-19 Thread Andrew Pinkham
I am learning all sorts of things about Django's testing system (instead of actually getting work done). The database schema is actually created via a call create_test_db() called on line 366 of setup_databases() in DiscoverRunner in django/test/runner.py. It's within this function, found in

Re: Doubt

2015-02-19 Thread Andrew Pinkham
On Feb 19, 2015, at 7:48 AM, sriraag paawan wrote: > Hello guys i am Paawan and i am new to Python Django.. i was getting an error > like "activate.bat is not recognised" when installing virtualenv. I am unable > to work with environment variable WORKON and version of

Re: Django 1.7.4, PostgreSQL: Migrate FK to M2M?

2015-02-19 Thread Andrew Pinkham
On Feb 19, 2015, at 11:54 AM, Tom Evans wrote: > Django accepts the keyword argument "null" on all fields, but it is > meaningless for an M2M. That is an excellent point. That's what I get for writing this up based on memory late at night. Sorry for the error. Andrew

DjangoCon US 2015 Proposals Deadline

2015-05-11 Thread Andrew Pinkham
There are only 4 days left to submit a proposal to DjangoCon US 2015 ! We want to hear about your experience with and around Django. However, talks: - Don't need to be about Django specifically - Don't need to be 100% fleshed out. - Don't need to be

Re: How to learn Django stepwise Effectively

2016-01-20 Thread Andrew Pinkham
Hi Berbetto, There are many resources for learning Django (NB: this email assumes you’re not looking to learn Python). If you’re looking for free resources online, I would start with either the official tutorial, or the Django Girls tutorial.

Re: Constants values and best practices

2014-08-28 Thread Andrew Pinkham
Hi Julian, I think there are a couple options. The easiest would be to store the constants as Python. I would recommend using the choices field, as detailed by the documentation: https://docs.djangoproject.com/en/1.7/ref/models/fields/#choices If you must store your constants as part of the

Re: settings.py

2014-09-08 Thread Andrew Pinkham
Hi Ngangsia, On Sep 8, 2014, at 12:16 PM, ngangsia akumbo wrote: > when i run the > django-admin.py startproject this is the settings file i have I've glanced through the file. It looks fine to me, but I may have missed something. > Please i need some help here dont

Re: extremely slow django migrations

2014-09-10 Thread Andrew Pinkham
Hi Jesse, Yes, in certain cases, native Django migrations may run very slowly. https://code.djangoproject.com/ticket/22608 My understanding is that this should not be a problem unless you have a huge number of apps and models (note how the second benchmark from Paul in the ticket has 200

Re: extremely slow django migrations

2014-09-10 Thread Andrew Pinkham
On Sep 10, 2014, at 12:25 PM, John Schmitt wrote: > Which file? What do I look for? What do I 'verify' and to what should it be > compared? When you run `makemigrations app_name`, the output will inform you of the creation of at least one migration file, typically in

Re: models get_absolute_url issue

2014-09-11 Thread Andrew Pinkham
Hi Eddilbert, What are the URL patterns for the two views? I suspect a problem with `pk_url_kwarg`, but I am surprised by the error output. If that is not the problem: Does this error occur if you do not override the `form_class` of `ResourceCreateView`? Could you supply the code for

Re: Three Django forms in different tabs in one template?

2014-09-11 Thread Andrew Pinkham
Hi Franco, Faridul, Stodge, There are actually quite a few problems being asked. I've split them up into discrete questions. 1. Can a single view function print three forms in a template? Yes. WARNING: I am coding all of this off the top of my head. The code is likely riddled with typos and

Re: Right way to create proxy to User model in Django 1.7

2014-09-15 Thread Andrew Pinkham
Hi Izabella, Could you provide your custom user model declaration? According the the documentation, you should be inheriting from `AbstractBaseUser`. https://docs.djangoproject.com/en/1.7/topics/auth/customizing/#substituting-a-custom-user-model

Upgrading Django (to 1.7)

2014-09-24 Thread Andrew Pinkham
Hi, I am writing a series of articles based on the presentation I gave at DjangoCon US 2014. I put the first article online earlier today, and figured members of this list might be interested in the material. For all of the material: afrg.co/updj17/ For the article: afrg.co/updj17/a1/

Re: Upgrading Django (to 1.7)

2014-09-25 Thread Andrew Pinkham
Hi Sabine, Thank you! It is really nice getting positive feedback. The migrations section (Part II next week!) is a very basic introduction, aimed at people who have never used South or native migrations. One of the key takeaways (hopefully) of the article is the fact that it is easy to

Re: Upgrading Django (to 1.7)

2014-09-25 Thread Andrew Pinkham
Fred, Thank you! Good luck with the upgrade! Andrew -- 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 post to this

Re: Upgrading Django (to 1.7)

2014-09-27 Thread Andrew Pinkham
Benjamin, Thank you! The next two parts of the article will focus on why certain changes were made. Please let me know if you think there were changes that I should have written about. Depending on my schedule and feedback, I would be willing to consider adding to the material if I've missed

Re: Upgrading Django (to 1.7)

2014-09-27 Thread Andrew Pinkham
Hi Bob, Thank you! I spend a lot of Part II talking about schema and data migrations in both South and native Django 1.7 migrations. When building data migrations, you should be using historical models. In Django 1.7, you can request these models directly from the app registry built on the fly

Re: Upgrading Django (to 1.7)

2014-10-01 Thread Andrew Pinkham
Hi, Upgrading Django (to 1.7) Part II: Migrations in Django 1.6 and 1.7 is now available! For the article: afrg.co/updj17/a2/ For all of the material: afrg.co/updj17/ Any feedback appreciated. I hope you find the material helpful. Andrew -- You received this message because you are

Re: Upgrading Django (to 1.7)

2014-10-04 Thread Andrew Pinkham
Carsten, Thank you for reading and for the positive feedback! Andrew -- 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.

Re: Upgrading Django (to 1.7)

2014-10-04 Thread Andrew Pinkham
Stodge, Part II focuses on migrations, and deals in passing with AppConfig objects via data-migrations. Part III will take a closer look at the app registry, as we will create a custom AppConfig objects for `roundtable`. There is a (very) short section in Part III about import problems caused

Re: Upgrading Django (to 1.7)

2014-10-08 Thread Andrew Pinkham
Hi Fred, Thanks again for the input! Glad you liked Part II. Andrew -- 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.

Re: Upgrading Django (to 1.7)

2014-10-08 Thread Andrew Pinkham
Hi, Upgrading Django (to 1.7) Part III: Django 1.7's New Features is now available! For the article: afrg.co/updj17/a3/ For all of the material: afrg.co/updj17/ Any feedback appreciated. I hope you find the material helpful. Andrew -- You received this message because you are subscribed

Re: Upgrading Django (to 1.7)

2014-10-09 Thread Andrew Pinkham
Hi Fred, Thanks again for the positive feedback! I'm sorry I lost you at the App Registry section. I'm afraid I can't recommend an article to help with the topic, either. Given your questions, I can see I missed the mark. Let me give it another go (warning: this is neither technically reviewed

Re: Learning Django resources

2016-02-17 Thread Andrew Pinkham
Hi Robert, You may be interested in my response to this question in another thread: https://groups.google.com/d/msg/django-users/-iTZB7K1QI4/TTVXd9Y6EwAJ Hope that helps, Andrew -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe

Re: Alternative Amazon S3?

2016-02-25 Thread Andrew Pinkham
Heroku should be treated as the stateless portion of an app - do not store long term data there! (Same goes with services like EC2 and Digital Ocean.) Rackspace and Microsoft have cloud alternatives to Amazon that may suit your purposes. Hosting on a shared host like Dreamhost or A Small

DjangoCon US 2016

2016-03-23 Thread Andrew Pinkham
We are pleased to announce that DjangoCon US will be hosted by the Wharton School at the University of Pennsylvania in Philadelphia from July 17-22! The call for proposals is open! We want to hear about your experience with and

Re: "canonical" views.py in Django Unleashed book, Chapter 22

2016-06-30 Thread Andrew Pinkham
Hi Malik! Thanks for buying my book! I'm glad to hear you like Django Unleashed, but I'm sorry you're frustrated with the github repo at https://github.com/jambonrose/DjangoUnleashed-1.8 . Page xiv provides a quick explanation of git commits' relationship to the examples in the book. In short:

Re: Django Unleashed, custom user model

2016-10-23 Thread Andrew Pinkham
Hi Malik, I'm sorry to hear that you are still having trouble with Chapter 22. I've attempted to answer your questions below based on the limited information you have provided. You might find a comparison with the book code helpful for future problems

Re: "canonical" views.py in Django Unleashed book, Chapter 22

2016-10-23 Thread Andrew Pinkham
Hi Malik, On Jun 30, 2016, at 11:00 PM, Malik Rumi wrote: > I found that surprising, but then I'm somewhat isolated so don't claim to > know what other folks are doing. Why is this the common practice? Just to > save time because the tools are available? Yup - this is

Re: What is the use of parent_template filter in Django templates

2016-11-16 Thread Andrew Pinkham
On Nov 1, 2016, at 10:26 AM, Prateek wrote: > I am reading Django Unleashed in which the author uses the following code to > extends the template > > {% extends parent_template|default:"organizer/base_organizer.html" %} > > What does parent_template do ? Hi Prateek,

Re: Will function based views ever be deprecated?

2017-04-03 Thread Andrew Pinkham
There's a little bit of vocabulary overload going on that I can't help but point out, as it confused me when I encountered it. There is a difference between Class-Based Views (CBV) and Generic Class-Based Views (GCBV). They were both introduced at the same time, and so it is easy to get them

Re: django-improved-user v1.0a1

2017-10-13 Thread Andrew Pinkham
Hi Joe, I'm not 100% clear on what you mean by coordinating. Apologies if I miss the mark. You should be able to use improved-user with both allauth and guardian (but I admit I have not tried!). Allauth provides some notes on using a custom model, and covers how to use a model that doesn't

django-improved-user v1.0a1

2017-10-12 Thread Andrew Pinkham
Hi everyone! Yesterday I released v1.0a1 of django-improved-user, which provides a custom Django user model with international identity handling and uses email as the username. 1.0a1 is feature complete and tested against Django 2.0a1 (as well as Django 1.8, 1.10, and 1.11). I'm emailing the

Re: django-improved-user v1.0a1

2017-10-12 Thread Andrew Pinkham
Forgot to add links. >_< https://github.com/jambonsw/django-improved-user https://pypi.org/project/django-improved-user/1.0a1/ http://django-improved-user.readthedocs.io/en/latest/?badge=latest Andrew http://jambonsw.com http://django-unleashed.com -- You received this message because you

Re: DjangoUnleashed-2.0

2018-02-23 Thread Andrew Pinkham
Hi, I'm the author of Django Unleashed. A second edition is in the works, but it is taking some time (I'm also working on a video series). Django 2.0 introduced a simplified system for URLs. https://docs.djangoproject.com/en/2.0/releases/2.0/#simplified-url-routing-syntax If you want wish to

Re: Need help with CDN on Django App using heroku

2018-10-22 Thread Andrew Pinkham
https://devcenter.heroku.com/articles/django-assets http://whitenoise.evans.io/en/stable/django.html -- 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

Re: generate username and password

2018-10-22 Thread Andrew Pinkham
Au sujet d'utilisateurs avec email comme pseudonyme, j’ai créé (avec Russell Keith-Magee) un projet qui a comme but de fournir des classes et modèles qui aident a la création d'utilisateurs custom. https://django-improved-user.readthedocs.io/en/latest/quickstart.html

Re: Need help with CDN on Django App using heroku

2018-10-22 Thread Andrew Pinkham
On Oct 22, 2018, at 11:53, Akash Purandare wrote: > However the issue is not with Whitenoise. Whitenoise can be used to serve > static files, yes. But how do I use it to serve media assets in the project? Sorry, missed the media part. Michal is right, you will need to install and configure

Re: Creating seperate unique ids within the same table

2018-10-22 Thread Andrew Pinkham
On Oct 22, 2018, at 12:29, Matthew Pava wrote: > I am curious why you think it is anti-practice to expose primary keys for > user-visible purposes. > My URLs all have the PK to the object in them, and any advanced user would be > able to “reverse engineer” a URL if they guess the PK of an

Re: Trigger actions independently of url request

2018-10-22 Thread Andrew Pinkham
On Oct 22, 2018, at 12:08, Charley Paulus wrote: > After reading the Django tutorial, my understanding (I hope I’m wrong) is > that the only way to trigger a function of a Django app is when someone on > the client side request the url related to that function. That is correct. A view

Re: Use Email to Login With Django Auth

2018-11-01 Thread Andrew Pinkham
You may be interested in django-improved-user, as it provides an email-based User model. https://pypi.org/project/django-improved-user/ Full disclosure: I am one of the original authors. If you have any trouble with the package or documentation, please open an issue! Andrew

Re: difference between class based view and function based view

2018-11-21 Thread Andrew Pinkham
Django developers talk about three kinds of views: - function views (FV) - class-based views (CBV) - generic class-based views (GCBV) People do not make always make the difference between CBV and GCBV, which is unfortunate, as they serve different purposes (naming things