Re: How to make recursive ManyToMany relationships through an intermediate model symmetrical

2020-10-16 Thread David Nugent
After playing with this to answer your question and to correct my previous response, I found that it does work as documented when using a "through" model without using "through_fields". from django.db import models class Person(models.Model): name = models.CharField(max_length=255)

Re: Problem with Postgresql-11.9 ??

2020-10-16 Thread David Nugent
In __your__ code, most certainly. :-) You didn't say what 'training', 'input_type' and 'gender' are. It is in one or more of those where the problem exists. Do these referenced save module instances? If they are not yet saved then it will trigger this error for fields where On 13 Oct 2020,

Re: Problem with Postgresql-11.9 ??

2020-10-16 Thread David Nugent
. Regards, David On 17 Oct 2020, at 15:13, David Nugent mailto:dav...@uniquode.io>> wrote: In __your__ code, most certainly. :-) You didn't say what 'training', 'input_type' and 'gender' are. It is in one or more of those where the problem exists. Do these referenced save module ins

Re: How to make recursive ManyToMany relationships through an intermediate model symmetrical

2020-10-16 Thread David Nugent
This is expected with your code. You've created an asymmetric relationship from bill to ted, but not the reverse. This would be appropriate in a "follow" relationship. For symmetric relationships you need to create records in both directions. There are a few ways to do this but a helper

Re: How to make recursive ManyToMany relationships through an intermediate model symmetrical

2020-10-16 Thread David Nugent
>>> bill.friends.all() ]> >>> ted.friends.all() ]> On 17 Oct 2020, at 10:28, coolguy mailto:cooldjangoprogram...@gmail.com>> wrote: With your example, you can also find the records through>>> ted.person_set.all(). On Friday, October 16, 2020 at 7:05:51 PM UTC

Re: Periodic Execution of django functions or tasks

2020-10-19 Thread David Nugent
Not exactly automatic, but can be set up to do so, something along the lines: https://wiki.postgresql.org/wiki/Month_based_partitioning This solution is Postgresql specific, although I've done effectively the same with mysql with some help in the code. Partitioning the db in this way makes it

Re: RES: How to connect django and React js but getting Error

2020-10-26 Thread David Nugent
In this situation, something you might also consider is FastAPI https://fastapi.tiangolo.com (which is based on Starlette https://www.starlette.io). For the database you'll probably need to use SqlAlchemy vs Django ORM, but if you're serving static content and just need to provide an API it is

Re: Good Django libraries to read to really understand class-based views?

2021-01-12 Thread David Nugent
Robert, I think the ultimate resource you can use on this beyond the documentation is the django source code itself. It may look confusing at first, but if you check out the class hierarchy from the starting points in the docs, how classes are related and mix-ins are used, you gain a lot of

Re: How to securely store passwords used in backend code

2020-12-14 Thread David Nugent
On 10 December 2020 at 01:18:16, Pankaj Jangid (pan...@codeisgreat.org) wrote: Fenrir Sivar writes: > I inherited a django app that calls private APIs in a view to fetch some > data. The credentials or api keys are currently hardcoded in the source, > making it difficult to share. > What is the

Re: Tests: How to messages.add_message() before self.client.get() ?

2020-11-10 Thread David Nugent
Make your own request. I don't see the need here but incase I'm missing something: request is just a HTTPRequest instance. You can instantiate it like any other python class. The only downside is that the request

Re: Template inheritance with dynamic content

2020-11-13 Thread David Nugent
You can achieve what you are looking for using the include directive. Just have your parent and child include the same block and use with… phrase to override variables within the included template. Regards, David On

Re: im a newbe, i'm trying to get the username in a view

2020-11-14 Thread David Nugent
The pre-requisite for having ‘user’ in the request instance is the ‘django.contrib.auth.context_processors.auth’ in your TEMPLATES context_processors. See the second answer (should be the accepted one as it has received far more community votes) in this stack overflow

Re: Select from the dropdown the object car that has the field is_active

2020-11-15 Thread David Nugent
On 15 Nov 2020, at 23:27, Apolo Machine wrote: > > hello, i'm a newbie using django and i have a problem that cannot solve. > In my createview i need to select from the dropdown the object car that has > the field is_active = true, > how can i acomplish that? > > class Car(models.Model): >

Re: Newbie looking for some help with Postgres <> Django connection

2020-11-03 Thread David Nugent
On 4 Nov 2020, at 03:45, Marc Johnson mailto:marcjohnson...@gmail.com>> wrote: ... 1. Since this app is dockerized, I have my existing env vars in my docker-compose-prod.yml file. Is that where I should list DATABASE_URL? Like: db: image: postgres:11 volumes: -

Re: Fetching data from database

2020-10-28 Thread David Nugent
You question isn't very specific, however I'll try to add a couple of touch-points that may provide some direction. Django manage.py can provide direct access to your models. python manage.py shell is your friend, for manually manipulating data, including the database via the Django ORM.

Re: Filter a field in a form CreatView

2020-10-28 Thread David Nugent
This is known as a "combo box", somewhat different to a select. Check this google search: html5 combo box

Re: How to access using foreing key

2020-10-31 Thread David Nugent
Restaurant.objects.filter(rating_restaurant=5.0) Regards /d -- 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 view

Re: Newbie looking for some help with Postgres <> Django connection

2020-10-31 Thread David Nugent
It's been a while since I used heroku, but iirc it just uses a formatted pg url. Install the module dj-database-url and use this in settings instead of the default DATABASES layout, something like: DATABASES = { 'default': dj_database_url.config(os.environ['DATABASE_URL'],

Re: Newbie looking for some help with Postgres <> Django connection

2020-11-05 Thread David Nugent
On 5 Nov 2020, at 04:11, Marc Johnson mailto:marcjohnson...@gmail.com>> wrote: Hi David, Thanks again for the feedback. When I remove the 'ENGINE' variable I get the error saying settings.DATABASES is improperly configured, as shown in the snapshot attached below. But when I add the ENGINE

Re: run terminal code inside project

2020-11-05 Thread David Nugent
Hint: as Andréas implied, it is always a good idea to state the problem you're trying to solve instead of posing a question about what you think the solution is. :-) Ends up saving a bunch of time. Short answer for your solution: manage.py can be run as a

Re: How to use chartjs

2021-01-08 Thread David Nugent
Some googling might get you there, but I think the chartjs documentation should get you most of the way there. I would suggest an ajax approach - some js code on your page to retrieve the data from an API you build (a django view). You could also use DRF for this, but DRF is overkill - you

Re: CRUD Generator

2021-01-09 Thread David Nugent
Well, yes, sure you can. But I think the OP had something in mind like https://pypi.org/project/drf-generators/ (which is awsome btw) but targeted at crud views / forms. I must admit this is one of the nice things that rails scaffold provides in the RoR world. The code generated by that is

Re: CRUD Generator

2021-01-09 Thread David Nugent
Actually, this might help: https://github.com/pydanny/cookiecutter-djangopackage Cookiecutter is very simple to use, and this is a template you use with it that generates a boilerplate entire (reusable) django app. There's also a django project generator that I've recently started to use

Re: import *

2021-01-10 Thread David Nugent
On 11 January 2021 at 13:14:59, Peter of the Norse (rahmc...@gmail.com) wrote: I use multiple settings.py files to do this. Specifically, in my main one, I have what I consider the only acceptable instance of import *. Slightly off-topic (subject changed to reflect

Re: Need help on RedirectView

2021-06-20 Thread David Nugent
It is just a method on the Article model. Don't copy-paste what is there, understand what it is doing. In this *example*, update_counter() will be defined in Article(models.Model), probably in models.py in the app. You obliged to use anything like this in your redirect. HTH, On Sun, Jun 20,

Re: Help with a huge database query.

2021-05-27 Thread David Nugent
I think a better approach to using QuerySet.defer() is to use .values() instead, explicitly specifying which fields you need to export. Just FYI rest_framework handles this out of the box and provides an API to specify not only which fields to export but filters as well. Regards /d On Fri, May

Re: Django 3.1 Makemigrations fails with FilePathField but succeeds with CharField

2021-06-27 Thread David Nugent
Hi Peter, I hope I can help. On Wed, Jun 23, 2021 at 1:50 PM Peter of the Norse wrote: > I think you might be better off using > https://docs.djangoproject.com/en/3.2/topics/migrations/#squashing-migrations > than > having it recreate all of them. > > On Mar 18, 2021, at 8:28 AM, Olivier

Re: register_converter doesn't work with ASGI

2021-06-27 Thread David Nugent
Well, one workaround that may serve if your dataset isn't too large is to use a cache (or dict) and pre-load it. Unlike the db, caches tend to be more async friendly, unless of course your cache is in your db :-) This just needs to be pre-loaded on startup (.apps.:.ready() is a good spot

Re: Manager.raw() in a class method

2021-06-27 Thread David Nugent
Not actually sure what the issue is here, but I'm a devotee of avoiding raw sql at any stage. :-) If your query is really this simple, you certainly don't need a raw query to achieve it, nor a SQL proc to handle the sub-query that results from it. Either way, bear in mind that all that is

Re: Why is this acting like a permanent redirect?

2021-02-22 Thread David Nugent
Hi Robert, To point out the most likely cause of the issue: LOGIN_REDIRECT_URL is a url, not a route name. Possibly could use a reverse_lazy('login-redirect') here after import django.urls, but - untested. Regards, David On 23 February 2021 at 07:07:52, Robert F

Re: AttributeError: module 'polls.views' has no attribute 'index'

2021-04-22 Thread David Nugent
On Mon, Apr 19, 2021 at 2:07 AM Avi Mehenwal wrote: > I followed the same tutorial on 17th April 2021 with Python 3.9.2 and > Django 3.2 and have exactly the same problems as mentioned above. > > path('', views.index, name='index'), > AttributeError: module 'polls.views' has no attribute

Re: Assistance with Django Booking app

2021-04-22 Thread David Nugent
On Wed, Apr 21, 2021 at 8:46 PM Eric 247ERICPOINTCOM wrote: > Hi Ryan, > > Am trying to use booking on a marketing system that is developing for > different kinds of businesses like property where someone would be able to > book an appointment for a viewing or a service like a Mobile car wash

Re: Testing Django User Login Form

2021-04-22 Thread David Nugent
Try creating a request using RequestFactory and use that to input the credentials. I don't think the way you are creating the form is valid. rf = RequestFactory() request = rf.post('/some_mock_url', dict(username='abc', password='password')) form = AuthenticationForm(request) -- You received

Re: 'str' object is not callable error appears from Django Message Framework

2021-09-20 Thread David Nugent
Hi Salima, Stack trace? Always the first call for triage on python exceptions. Also (and unrelated to your issue) google "django messages bootstrap" and check on how to avoid the {% if message.tags == .. %} horror show and make your templates much more readable/easily maintained. On Mon, Sep

Re: Idea

2021-09-20 Thread David Nugent
Not at all a "new" topic :-) On Sun, Sep 19, 2021 at 8:11 AM Jet Ezra wrote: > I know this may not be necessary at the moment because we are comfortable > depending on front-end frameworks, but I have my two ideas here: > 1. what if django alone without any framework can be used to design >

Re: django admin

2021-10-10 Thread David Nugent
Just a general note but *collectstatic* should not be required for Django development in localdev. Django will locate static files using STATICFILES_FINDERS when serving static is enabled (which normally is the case for localdev). It uses the same algorithm to do so as *collectstatic*. If you're

Re: When you app depends on a custom user model

2021-10-10 Thread David Nugent
Why not just edit the migration file directly and substitute 'my_custom..' for settings.AUTH_USER_MODEL? There should be no problem in doing that. Regards, David On Sun, Oct 10, 2021 at 3:02 AM bnmng wrote: > Django "strongly recommends" you create custom user, and in your apps you > can

Re: [DJANGO-TUTORIAL]

2021-10-08 Thread David Nugent
For interactive web pages, you are (almost) necessarily talking about javascript. Given your background and what you're most likely to be doing next, I would suggest looking at D3.js - Data-Driven Documents (d3js.org) . It is a somewhat large but very mature library for visual

Re: INPUT TEXT in grid

2021-09-28 Thread David Nugent
Request.GET can't apply when processing a POST request. You are quoting 'cur.id_reg' when accessing the GET (should be POST) params and it probably should not be - you need to access the "name" attribute that your form uses. You should also be using cleaned_data

Re: need help integrating SSL with react/django web app

2021-09-20 Thread David Nugent
On Tue, Sep 21, 2021 at 2:11 AM hey there wrote: 1. oracle autonomous linux's epl dont have certbot > pip install certbot You already have pip installed if you're running Django. This takes all of 10-15 seconds... and > 2. I mostly like Cloudflare than certbot because Cloudflare has some own

Re: Strange ValueError in Safari on iOS

2021-10-01 Thread David Nugent
I have some doubt the admin css is related. The css file should provide a path to the image file, relative to its own location in this case - both the css and svg file will be served via whatever is handling your static files (usually an external like nginx etc if in production mode, else by your

Re: django.db.utils.OperationalError: no such table abc

2021-10-24 Thread David Nugent
On Fri, Oct 22, 2021 at 7:09 AM Ammon Quackenbush wrote: > I think you are right. I did delete the initial migration. How do I > restore the initial migration? > > Can't you restore it from your git repo? If you're not running any sort of version control you've just hit the reason why doing so

Re: How to get a variable from an ajax request and use it in another application in Django?

2021-11-29 Thread David Nugent
A little more context would help, "use it in another application" is a little vague. The backend the API request and can pretty much do anything you need in the corresponding view at that point but should endeavour to return an appropriate response ASAP. On Tue, Nov 30, 2021 at 12:35 AM kayhan

Re: How to get a variable from an ajax request and use it in another application in Django?

2021-12-04 Thread David Nugent
get( > 'longitude') print("latitude, longitude = ", latitude,longitude) Output: > latitude, longitude = 34.801595 48.499574 latitude, longitude = 34.801595 > 48.499574 latitude, longitude = None None > > On Wed, Dec 1, 2021 at 6:37 PM kayhan wrote: > >> Thank you

Re: Multiple Templates in single list view

2021-11-21 Thread David Nugent
Well, there are several ways you can deal with that. Probably easiest is to override get_template() and switch the template based on whatever type of ticket you're managing or you can change the value of self.template_name based on the request. Or maybe you prefer a single template to deal with

Re: Multiple Templates in single list view

2021-11-21 Thread David Nugent
Hi Lalit, On Mon, Nov 22, 2021 at 6:12 PM Lalit Suthar wrote: > we can go like > > ``` > > class Manager(...): > def get_context_data(self, **kwargs): > context = super() > context["open_tickets"] = Ticket.objects.filter(status="OPEN") > context["accepted_tickets"] =

Re: costum user in Django 3.2

2021-11-10 Thread David Nugent
On Tue, Nov 9, 2021 at 10:15 PM DJANGO DEVELOPER wrote: > have you added AUTH_USER_MODEL = 'my_app.custommodel' in your settings.py? > And note the lower case here as pointed out. App names are always handled as lowercase internally in Django. On Monday, November 8, 2021 at 10:50:14 PM UTC+5

Re: Pagination on different cards reside on the same template

2021-11-25 Thread David Nugent
Hi Eurgene, I would implement this in Javascript (or htmx). Some good examples are only a google search away. Regards, David On Fri, Nov 26, 2021 at 6:41 AM Eugene TUYIZERE wrote: > Dear Team, > > I have 4 cards on a single html page. I want to display data on each one > but since the data

Re: How to import UGETTEXT_LAZY ON DJANGO 4.0

2021-12-09 Thread David Nugent
Simply change it to gettext_lazy. You don't need the deprecated functions, they were for python 2. Regards, David On Fri, Dec 10, 2021 at 3:43 PM wrote: > It seems Django has removed ‘ugettext_lazy`(from django.utils.translation > import ugettext_lazy as _) from Django version 4.0.x > > How

Re: gettext vs ugettext_lazy

2021-12-03 Thread David Nugent
Correction, Python 2.x support On Fri, Dec 3, 2021 at 8:12 PM David Nugent wrote: > Don't use ugettext*, they are deprecated and no longer exist in 3.x. m > They were for Django 2.x support. > > On Fri, Dec 3, 2021 at 5:54 PM wrote: > >> Hello >> >> Would like

Re: gettext vs ugettext_lazy

2021-12-03 Thread David Nugent
Don't use ugettext*, they are deprecated and no longer exist in 3.x. m They were for Django 2.x support. On Fri, Dec 3, 2021 at 5:54 PM wrote: > Hello > > Would like to know, what are the difference between gettext and > ugettext_lazy? > > When to use each of them? > > -- > You received this

Re: How to get a variable from an ajax request and use it in another application in Django?

2021-11-30 Thread David Nugent
That is definitely much more clear. The usual way of doing this is to handle it like a shopping cart (plenty of examples only a google search away). Typically you store this information in the user's session in the first view, then retrieve it in the subsequent view(s). Note that

Re: return or not from super().method(*args, **kwargs)

2021-11-30 Thread David Nugent
Currently I tend to go for the "super().save(*args, **kwargs)" (no unnecessary return) as done in the Django documentation and to be explicit in the present (it doesn't return anything)... but I have my own doubts :-) I would return the result from super() It may return None, but so do you

Re: Change data in DB before migrating

2023-09-03 Thread David Nugent
Yes, this is certainly possible. Migrations are just python scripts that follow a specific protocol/api that is detailed in the excellent django documentation. You can insert your own hand crafted migrations to handle many cases that can cater for a variety of use cases. i would suggest though

Re: pytest, asgiref, Selenium and database access? How to make them work?

2023-09-07 Thread David Nugent
install pytest-django use fixture @pytest.mark.db profit On 5 September 2023 at 08:15:10, Alfons Eberle (alfons.sig...@gmail.com) wrote: > Hey, has anyone gotten pytest to work with django-channels (or asgiref + > Daphne) and Selenium in general when database access is required? > > My fixtures

Re: How to monitor content updates or deletion in Django web applications

2023-10-04 Thread David Nugent
ib/contenttypes/> > I have used it a few times and Django admin site also uses it under the > hood. > > On Wed, Oct 4, 2023 at 4:58 AM David Nugent wrote: > >> The may not be enough context in your question but I imagine that the >> following link may take you to

Re: How to monitor content updates or deletion in Django web applications

2023-10-03 Thread David Nugent
The may not be enough context in your question but I imagine that the following link may take you to something that may work for you. https://docs.djangoproject.com/en/4.2/topics/signals/ On 4 October 2023 at 14:42:45, Ram (ram.mullap...@gmail.com) wrote: > Hi, > > We would like to add this

Re: Location identification with login

2022-12-25 Thread David Nugent
Yes, that is certainly possible, although there is nothing built into Django itself. Web servers (and proxies) both pass the IP address of the remote user, which can be recorded at login together with reference to the account. Using GeoIP you can associate this more or less reliably to a

Re: any solutions guys on the ERROR admin E108 on list_display[2] attributes not callable

2023-01-10 Thread David Nugent
This is due to an error in your admin class (ProductAdmin in this case) The error message points directly where and what you need to check (spoiler: list_display item, 3rd field “stock”, which is incorrect). -- Original Message -- From "E Mollz" To "Django users" Date 1/10/2023

Re: Merge Project

2022-12-29 Thread David Nugent
"Anil Singh" writes: Hi Friends, I am merging tow one project to another project, also install app in settings.py, but i error : RuntimeError: Model class django.contrib.contenttypes.models.ContentType doesn't declare an explicit app_label and isn't in an application in INSTALLED_APPS. I

Re: Static files is not loading while deploying the project to AWS ec2

2022-11-05 Thread David Nugent
An article I wrote on this topic last year for fellow developers at work who were similarly confused. HTH! *Django - Statically Confusing* I started learning Django several years ago (and am still doing so today!), and for some time had a real sense of confusion as to how static files worked.

Re: Django multistep form

2022-11-07 Thread David Nugent
A quick reading of your code suggests that `form.customer_choices.choices` should be returned as an array with the state of each choice, so == here is probably not going to work. On Mon, Nov 7, 2022 at 8:58 PM Obodoma Uzondu Vincent wrote: > I have a multi-step form that is 3 steps but it has 4

Re: What makes the images deletion from the media folder?

2023-03-23 Thread David Nugent
Are you using Django in a docker container? If so, any changes to the filesystem are ephemeral and disappear when the container is recycled. Regards, David -- Original Message -- From "Ram" To django-users@googlegroups.com Date 3/24/2023 2:04:56 PM Subject What makes the images

Re: Uncaught TypeError: styled_default is not a function

2023-03-15 Thread David Nugent
A Django mailing list is probably not a good place to ask this question - this is a JS issue and there are a plethora of more appropriate forums. But - why is Popper.js being loaded? Is it a hangover from using bootstrap? Don’t load both bootstrap (and associated scripts) with React+mui.

Re: "Django road map and resources"

2023-03-02 Thread David Nugent
I’ll second that - Udemy is a great resource and frequent run specials on courses. Also, don’t overlook Youtube where you can often find same/similar and good quality content available for free. Regards, David -- Original Message -- From "Sebastián Bevc Costa" To "Django users"

Re: Ordering of code

2023-03-03 Thread David Nugent
Both are related to the python language, nothing Django specific about them. This may help (not in explaining so much as demonstrating workarounds): https://stackoverflow.com/questions/4162456/forward-declaration-of-classes https://erdantic.drivendata.org/v0.4/forward-references/ Regards, /d

Re: error problem

2023-02-20 Thread David Nugent
You appear to half only half asked your question and have provided no context. Do you have a route named 'register'? [ URL(, name="register") ] (I am guessing no, else this specific error would not occur) Guessing what you forgot to mention, check out some of the great tutorials available

Re: Serving static files in production

2023-04-27 Thread David Nugent
On Thu, Apr 27, 2023 at 8:11 AM Prosper Lekia > wrote: > >> Is whitenoise installed and added to MiddleWare? >> >> On Thu, Apr 27, 2023, 00:37 David Nugent wrote: >> >>> Ensure that nginx is correctly configured, since from what you have >>> provided

Re: Serving static files in production

2023-04-26 Thread David Nugent
Ensure that nginx is correctly configured, since from what you have provided the django configuration looks correct (although I generally use /static/ as STATIC_URL - with the leading / but should work as you have it). Check the nginx error log to try to discover the cause of the 404s. I suspect

Re: python manage.py commonds: AttributeError: 'PosixPath' object has no attribute 'startswith'

2023-04-25 Thread David Nugent
This error is being triggered by an outdated and badly behaved module that contains the run_cmdb_worker management command. Anything that relies on the presence of BASE_DIR in settings is bad behaviour. This is an entirely arbitrary variable name that might not even be present in a non-default

Re: Django Themes help

2023-05-02 Thread David Nugent
This is a styling issue (aka CSS). The best answer depends on the CSS framework (if any) you might be using. Or you can just apply: .text-center { text-align: center; } on the containing div. On Wed, May 3, 2023 at 12:19 AM William Nash (Bill) wrote: > I'm working on a small program that

Re: Migration running in shell, but no change in DB

2023-04-01 Thread David Nugent
I would check in the django_migrations table to ensure that the migration has successfully been run. From: 'Martin Heitmann' via Django users Reply: django-users@googlegroups.com Date: 31 March 2023 at 19:46:02 To: Django users Subject: Migration running in shell, but no change in DB

Re: Image uploaded to database but not displaying

2023-04-12 Thread David Nugent
It is very important to understand the difference between “static” and “media”. The two are somewhat similar, and the code to handle (serve) each is even almost identical. Conceptually though they are quite different things. static files are assets provided by your app and served to satisfy the

Re: Django error while running

2023-03-21 Thread David Nugent
Any traceback with this at the end: _bootstrap._gcd_import(name[level..], package, level) Is almost always is due to a problem with your settings INSTALLED_APPS, particularly if django\apps\registry.py Is further up the trace. A missing comma between items, perhaps? It would indeed be

Re: Facing Issue with ODBC Driver 17 for SQL Server

2023-02-10 Thread David Nugent
Hi Sahan, "the target machine actively refused it” - in TCP parlance, that means that there’s nothing listening on that port, aka “connection refused”. The server you are trying to connect to isn’t there (or there is a firewall similar blocking the connection - but doubt it). IIRC by

Re: Running migrations with multiple databases

2023-07-10 Thread David Nugent
Migrations are executed according to how your db routers is setup. See setting DATABASE_ROUTERS. Note that normally you would be replicating secondaries, so migrations are normally not applied on all bu the primary, so this is the default. Regards, David On Mon, Jul 10, 2023 at 10:26 PM

Re: developing a data logger

2023-07-12 Thread David Nugent
support as well. HTH, David On Wed, Jul 12, 2023 at 8:23 PM o1bigtenor wrote: > On Wed, Jul 12, 2023 at 3:38 AM David Nugent wrote: > > > > It depends on what you want to do. Simply gathering data and scooping it > into a db does not require Django, which will probably not help muc

Re: developing a data logger

2023-07-12 Thread David Nugent
It depends on what you want to do. Simply gathering data and scooping it into a db does not require Django, which will probably not help much in this regard other than defining models/tables for your db and supporting migrations. If you want to provide web views or an API for this data, you're

Re: how to convert to Django 3 or 4

2023-06-02 Thread David Nugent
I have been through the experience of moving existing Django 1.5 app to 3.2 a couple years ago. Without doubt, the path of least resistance is to rebuild the site from scratch. Start with the latest release (ie. 4.2 as of today). You'll have the apps already defined and these have a blueprint.

Re: Django rest framework resources

2023-06-10 Thread David Nugent
Direct from the source! https://www.django-rest-framework.org/tutorial/quickstart/ Search on google/youtube for additional classes etc, but the above is always up to date with the framework (things have changed over time), so third-party sites may be a little outdated. The good news is that

Re: how to convert to Django 3 or 4

2023-06-03 Thread David Nugent
nppe url is obsolete and removed in 4.x. You can use re_path, which is a kind of replacement but even then you will need to adjust the regex in many cases. The best approach is to understand what the url() is doing, and replicate the same using path(). Once you do, the conversions should be more

Re: CreateView for non default database

2023-07-27 Thread David Nugent
Database Router is the trick for this. Django calls this function to determine which database the transaction will use based on the type of operation requested, so you can separate which database is selected for reads, writes and migrations. Regards, David On Wed, Jul 26, 2023 at 1:11 PM

Re: Django Deployment.

2023-06-25 Thread David Nugent
Yep I would definitely opt for docker in this case, although it should be possible to use apache+mod_wsgi to do it also, just ... a lot more messy than a container if you already use/have docker (which is easy enough to install on win). Forget IIS for this purpose, it's probably possible but I