Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add data insertion modal boxes #16

Closed
13 tasks done
mfrasca opened this issue Apr 28, 2019 · 2 comments
Closed
13 tasks done

add data insertion modal boxes #16

mfrasca opened this issue Apr 28, 2019 · 2 comments
Labels
epic feature let's add a completely new feature

Comments

@mfrasca
Copy link
Member

mfrasca commented Apr 28, 2019

logic

some objects (Contact, Accession, Location, Taxon) can be added without relation to previously inserted data. they don't need a parent object. Taxon is a border case, since a Taxon has a 'parent' taxon property, but that's not characterizing the object, it may even change. Plant and Verification only make sense in combination with an Accession and that's an immutable property. in fact, the URL to a Plant as well as the URL to a Verification contain their related Accession code.

objects are added, or edited. the javascript client requests editing forms from the django server. the django server serves pre-populated forms for specific objects, and empty forms for new objects. forms are not cached. forms served by django only contain table rows, while the client holds the rest of the form. the javascript client adds the POST verb to empty forms, because that's for new objects, and the PUT verb to pre-populated forms, because that's for editing objects. we use PUT and not PATCH because every time we're rewriting the whole edited object.

URL logic

let's collect the URL involved in this story.

all URLs are named, after the class, plus an optional suffix.

  • list API url, it lets you GET the list, and POST a new object, suffix -list;
  • detail API url, meant for individual GET, and PUT, suffix -detail;
  • infobox URL, for populating the infobox, suffix -infobox;
  • empty form URL, suffix -post-form;
  • populated form URL, suffix -put-form;

concrete urls regarding the same object or the same collection can be computed one from the other, like they all share the same prefix, so that the javascript code can juggle with replacing suffixes.

things to do

  • add context menu - drop down
  • add main menu
  • define Django view for both empty and populated forms content
  • systematically use url names
  • put more structure in url values
  • add target property to forms
  • allow for POST/PUT in target and let javascript change it
  • populate / clean form before displaying it
  • add new objects
  • edit existing objects
  • add dependent objects (Plant, Verification)
  • freeze properties that should not be edited (split into data input/edit forms should have immutable fields #38)
  • do not let user post incomplete request (split into make sure form is only posted via ajax #23)
@mfrasca mfrasca added the epic label Apr 28, 2019
@mfrasca
Copy link
Member Author

mfrasca commented Apr 28, 2019

forms are computed by django, subclassing from django.forms import ModelForm.
form fields are also computed by django + select2.

mfrasca added a commit that referenced this issue Apr 28, 2019
mfrasca added a commit that referenced this issue Apr 29, 2019
mfrasca added a commit that referenced this issue May 4, 2019
mfrasca added a commit that referenced this issue May 5, 2019
mfrasca added a commit that referenced this issue May 5, 2019
mfrasca added a commit that referenced this issue May 5, 2019
mfrasca added a commit that referenced this issue May 6, 2019
@mfrasca mfrasca added the feature let's add a completely new feature label May 7, 2019
@mfrasca
Copy link
Member Author

mfrasca commented May 9, 2019

the two remaining points moved to individual issues.

@mfrasca mfrasca closed this as completed May 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
epic feature let's add a completely new feature
Projects
None yet
Development

No branches or pull requests

1 participant