Re: Docker: NGINX, Postgres, Django, Static, Media Files

2019-07-14 Thread Dan Tagg
+1 for cookiecutter On Sun, 14 Jul 2019 at 20:53, hunter.cur...@gmail.com < hunter.cur...@gmail.com> wrote: > Probably the easiest way to do what you are looking for is to use > cookiecutter-django: https://github.com/pydanny/cookiecutter-django > > They are now using Caddy for the web server but

Re: tests pass individually but fail together

2018-07-05 Thread Dan Tagg
Hi Heather, What is it you are testing? I have had issues with this kind of thing when testing forms that are programatically changing dropdown list / default values. Dan On 5 July 2018 at 14:24, wrote: > Hello, I'm simplifying a previous post. I just started using Django a few > months ago, a

Re: post_save signal is not dispatched

2018-06-24 Thread Dan Tagg
Hi, Weirdly, I've just been doing this. What do you have in your settings INSTALLED_APPS? One of them should be something like 'employer.apps.EmployerConfig' alternatively in your employer module's __init__.py file you need to say default_app_config = 'employer.apps.EmployerConfig' Dan On 24 Ju

Re: A calendar booking app

2018-06-05 Thread Dan Tagg
I'm looking for the same thing Kasper -- Django based not PHP. Dan On 5 June 2018 at 13:32, Kasper Laudrup wrote: > Hi fellow Django users, > > I'm planning to start up a homepage for my familys summer house. > > There are a few ideas of what should be there, user management, possibly > "blog l

Re: Making an object unsaveable ...

2018-03-04 Thread Dan Tagg
Two possibilities spring to mind 1. Don't grant django's database user the right to update the relevant table. If you take this approach you'll need to catch any errors if anyone writes code to attempt to do this 2. Use signals to catch any save attempts. This is easily circumvented. On 4 March

Re: Model Design Questions

2017-12-16 Thread Dan Tagg
If you switched to Postgres you could use a json data type or dictionary data type. Django 1.11 onwards supports the storage and retrieval of both types I believe. Dan On Sun, 17 Dec 2017 at 07:46, Mark Phillips wrote: > I am building an electronic document management system using django and >

Re: How do I make my form send a POST request to a specified view?

2017-11-23 Thread Dan Tagg
You need an "action" attribute to your form https://www.w3schools.com/tags/att_form_action.asp On 23 November 2017 at 22:12, Tom Tanner wrote: > My page has a registration form at `"/login_register/"`. I want the form > to send a POST request to `"/register/"`. Here's my code so far. > > `urls

Re: How to get as result a list of all the users ordered by birthday (month day), ignoring year

2017-11-21 Thread Dan Tagg
Hi Roberta, I haven't tested it but assuming you want the ordering to happen within the database you may be able to do it with a combination of TIMESTAMPDIFF and MOD

Re: Timezone error when I launch the admin login screen in 'Writing your first Django app'-tutorial

2017-09-26 Thread Dan Tagg
Check the Django Settings file and set TIME_ZONE = 'UTC' or something in this list http://en.wikipedia.org/wiki/List_of_tz_zones_by_name Dan On 26 September 2017 at 14:30, Lise wrote: > Hi, > > I'm trying to learn how to use Django through the 'Writing your first > Django app'-tuorial. I hav

Re: Channels - Forward messages from a third party async source.

2017-09-04 Thread Dan Tagg
Hi Roger, Have you seen Diamond (http://diamond.readthedocs.io/en/latest/) it may be just what you need on the client side. Graphite (the server process) runs on Django. Dan On 1 September 2017 at 11:56, Roger Gammans wrote: > Hi all, > > I'm trying to build a system with a Django frontend whi

Re: forms.Form.to_div ? and how override forms.Boundfield.label_tag?

2017-07-27 Thread Dan Tagg
crispy forms is a good addition for form creation http://django-crispy-forms.readthedocs.io/en/latest/. It gives you a lot of control over layout and templating. Dan On 26 July 2017 at 13:02, threesixright wrote: > Hi All, > > Just started a few weeks ago with (v1.11) *Django* (coming from Rai

Re: recommendation for Django + Bootstrap

2017-06-28 Thread Dan Tagg
django cookie cutter does it very simply in my experience. https://github.com/pydanny/cookiecutter-django Dan On 27 June 2017 at 22:55, Alceu Rodrigues de Freitas Junior < alceu.freitas...@gmail.com> wrote: > Hello folks, > > Could you please recommend any options available to integrate Django

Re: Link to download

2017-05-03 Thread Dan Tagg
You might want to check out WhiteNoise ( https://whitenoise.readthedocs.io/en/stable/) perhaps in conjunction with a CDN On 3 May 2017 at 19:35, Tim Chase wrote: > On 2017-05-02 19:11, Antonis Christofides wrote: > > response = HttpResponse(csvfile.read(), content_type='text/csv') > > Beware tha

Re: How install Django in PyCharm Community edition?

2017-02-10 Thread Dan Tagg
+1 for virtualenv On 10 February 2017 at 11:44, Stefan Milutinovic wrote: > You can't install django in PyCharm. > > You must set proper Python interpreter into PyCharm Settings. > File>Settings>Project:name_of_your_project>Project Interpreter > There you must setup proper Python interpreter. >

Re: Questions about templates from a novice - Question #1

2016-12-01 Thread Dan Tagg
Hi Jim, I would really recommend looking at https://ccbv.co.uk/projects/Django/1.9/ There are diagrams to show the hierarchy of inheritance and mixins, plus all the properties and methods are there to see and explore. The place to start is the dispatch method, as_view is called first but you can

Re: GeoDjango with Docker

2016-12-01 Thread Dan Tagg
Cookie cutter is pretty awesome. Don't know whether it works with GeoDjango though. https://github.com/pydanny/cookiecutter-django Dan On 1 December 2016 at 13:32, hunter.cur...@gmail.com < hunter.cur...@gmail.com> wrote: > Hi Tadeo, I've recently gone through this exercise myself, and document

Re: Migrations for multiple Django versions

2016-11-25 Thread Dan Tagg
Hi Vlastimil, Why not use your source control system to publish different releases for different versions of django. Dan On 25 November 2016 at 10:01, Vlastimil Zíma wrote: > I don't think separate migrations would make the problem any better, that > looks just like more complicated implementa

Re: Django session issue with mod_wsgi + apache

2016-07-15 Thread Dan Tagg
Cacheing? 1. Do Bob's and James's pages have different URLs 2. Have you configured your cacheing. if you are using it, to not reuse components that could be confused? 3. Are you sending the correct cacheing directions to try and make sure caches between your infrastructure and the user's screen are

Re: How to retrieve data from deep nested object?

2016-04-26 Thread Dan Tagg
Does {% for question in subsection.subsection_set.all %} work? Dan On 26 April 2016 at 13:33, Said Akhmedbayev wrote: > I am trying to figure out how to loop over deep nested object in Django > template. > > Here is my app's code > > models.py > > from django.db import models > > > class Unit(m

Re: GROUP BY without using aggregate function

2016-03-02 Thread Dan Tagg
if your aren't counting or averaging then why are you grouping? D On 2 March 2016 at 17:06, wrote: > Hello, > > I would like to query database with Django ORM and add GROUP BY clause > without including unnecessary counting, avg, etc. > I can force/hack queryset by settting qs.query.group_by=['

Re: How to use selenium automated testing in django projects

2016-02-27 Thread Dan Tagg
Harry Percival is very good http://www.obeythetestinggoat.com Not sure if he covers Excel Dan On 27 Feb 2016 13:22, "Vikneswaran S J" wrote: > I need to use selenium automated testing for django application with input > from excel sheet. How to use use this feature? any idea? > > -- > You recei

Re: testing django migrations

2015-12-27 Thread Dan Tagg
Hi, I used this: https://github.com/plumdog/django_migration_testcase It's only worth writing tests if you are modifying code created by makemigrations. Dan On 27 December 2015 at 10:14, varun naganathan wrote: > Hi,I wanted to know how am i supposed to test the working of django > migrations

Re: Tool to document project urls, views, templates, etc...

2015-12-14 Thread Dan Tagg
http://ccbv.co.uk/ does this for django class based views. The code is on github https://github.com/refreshoxford/django-cbv-inspector/ Might be a good starting point. D On 14 December 2015 at 17:49, Royendgel Silberie wrote: > The closest I know is : > > python manage.py show_urls > > in the

Re: Unresolved references error in Pycharm Community edition

2015-11-28 Thread Dan Tagg
Agreed, but it is very good to use virualenv, a requirements file and then set the PyCharm project interpreter to your virtualenv one, then PyCharm picks up all the imports and can alert you if you're importing something wrongly or if you want to view the declaration of a function. I also really li

Re: How to get logged username in template

2015-11-12 Thread Dan Tagg
I would recommend using allauth http://django-allauth.readthedocs.org/en/latest/templates.html. It has template tags for adding all that info, creates pages for logging in, picks up your base template etc etc. Dan On 12 November 2015 at 08:57, Andreas Kuhne wrote: > Hi, > > First of all, you ar

Re: update_or_create() always creates (or recreates)

2015-11-06 Thread Dan Tagg
h then saves the data to the database via the Django ORM. > Given it's a scraper rather than a form (or view) is the above suggested > function an ok way to proceed or would you suggest something else is more > appropriate/best practice? > > > > On Friday, 6 November 2015

Re: update_or_create() always creates (or recreates)

2015-11-06 Thread Dan Tagg
Hi Yunti, You could go up a level in the structure of your application and apply the logic there, where there is more support. Are you using Django forms? The ModelForm class pretty much does what you want, it examines form data, validating it against its type and any validation rules you have s

Re: custom managers and migrations

2015-10-05 Thread Dan Tagg
Obviously a difficult question... On Saturday, 3 October 2015 23:54:24 UTC+1, Dan Tagg wrote: > > Hi, > > I'm using django 1.8.4. > > 1. I have added a field "deleted" to a couple of models so that when the > delete button is pressed, to all intents and p

custom managers and migrations

2015-10-03 Thread Dan Tagg
Hi, I'm using django 1.8.4. 1. I have added a field "deleted" to a couple of models so that when the delete button is pressed, to all intents and purposes the record will have been deleted, although it should still be accessible through the Admin site. 2. To make this happen in a way that can't

Re: Two Things: (1)-ModelChoiceField with a searchbox and (2)-Related Dropboxes

2015-07-15 Thread Dan Tagg
Select2 can do this https://select2.github.io. Other alternatives are available too. Dan On 13 Jul 2015 4:27 pm, "Miguel Pereira Legal" wrote: > I have this two questions: > > I am trying to write a small stock management system, and I am finding > problems in the Form. > See, when an item goes

Re: Why sqlite time is different from my settings.py TIME_ZONE?

2015-06-02 Thread Dan Tagg
Hi Hyunseo Yang, SQLite does not save the timezone in the database. If you pass it a datetime with timezone encoding then it calculates the UTC time that that time represents and stores that. It is explained here: https://www.sqlite.org/lang_datefunc.html As far as I understand whatever database