+8

Is this possible ?

I wrote a web based app (Todo list) . from my model code, i defined to classes "Todo" and "date added". Date added was set to a default parameters of the current user's timezone while Todo takes an argument of the current value from the HTML input and add it to the database. So there's a bug being a web-app, if i added "hello" on the list from my phone then i log into the todo-site on someone else device, it shows "hello" which shouldn't be, so is there any backend statement i could use to create a new database on every IP-change or something ?

11/9/2019 6:38:12 PM

Mirielle🐶 [Inactive]

16 Answers

New Answer

+4

You just need 3 fields for a todo item, instead of 2: task, date, and user. How you identify the user, is another question, it could be based on login, or ip/mac based identification. https://stackoverflow.com/questions/4581789/how-do-i-get-user-ip-address-in-django

+6

Schindlabua Peter Paul K Sadler Thanks, i'm using python cos my javascript is poor so i don't even know what the indexedDB is

+4

Tibor Santa i know how to make a backend todo list with user's logged authentication but i think it's unnecessary using most todo-list app i've seen in the playstore as reference( They don't have a register form)

+4

If you are using web tech, just shove all the todo items into localStorage (or indexedDB). The items will be stored on the device and there's no need for a backend!

+3

Mirielle🐶 [Inactive] okay I get it, but you probably shouldn't make new databases based on ip addresses, because they change a lot, and it is impossible to track which device has which ip. What would be more stable is to use MAC address as reference for database, because most people don't know how to and have no interest in changing it, and it's unique. To do so, you have to excute external commands on the client's device to get their mac asdress. But why all the mess ? There are ways to save data on the client's side directly, it will be both faster and stable, as the data is now on the device directly, and there is no way to move it to another device.

+2

What do you mean by another device ? And how does your web application work ? Do people make accounts on it, or does it depends on the device they'ee using ?

+2

Aymane Boukrouh [Inactive] Nice question, actually it'll be simple if there's a register account as i can use the ForeignKey relationship with the user and the database but a TODO list app should not require such. So what i mean by another device is, if i access the app on my phone and i added "Take a lunch" as a todo. Then i login to the same site on your device, it'll show what i added as a todo on your own device too and vice versa.

+2

Aymane Boukrouh [Inactive] But as I know that you can't read MAC address of computer. So you need to implement node in your project. Is there another way to get MAC address?

+2

A J I don't know, it was just a suggestion :/, because ip addresses are not very reliable, unless your client has static ip, which he most likely don't.

+2

You can get mac address using any programming languages without node. In python, you can simply import uuid or use regex

+2

why not use session data to identify the user?

+2

I used indexeddb in a game to store leaderboard data. I'm with Schindlabua use local storage or indexeddb (there are libraries to make indexeddb easier, although for the learning experience, I chose not to use them)

+2

Tibor Santa i know how to make a backend todo list with user's logged authentication but i think it's unnecessary using most todo-list app i've seen in the playstore as reference( They don't have a register form) Mirielle🐶 [Inactive] That must mean that they only store the content locally, so not a web based app

+1

absloutly possiable

+1

Mirielle🐶 [Inactive] here is a reference for indexeddb https://developer.mozilla.org/en-US/docs/Web/API/IndexedDB_API/Using_IndexedDB

+1

Mirielle🐶 [Inactive] localStorage gets around the problem of javascript not having access to file storage. It's pretty easy to use: localStorage.setItem('film', '2001: A Space Odyssey'); // the browser remembers even if you close it let film = localStorage.getItem('film'); IndexedDB is a database. It's stored on the device much like localStorage but it's much more powerful (and annoyingly complicated). Both localStorage and indexedDB are web standards so any modern browser knows them. But yeah using python is fine. That has other advantages.