tonythomas01 / gdrive-to-commons

Tool to upload pictures from Google Drive to Wikimedia Commons ⚠️ Moved to Wikimedia Gerrit, so this repo is read only.
https://gdrive-to-commons.toolforge.org/
Apache License 2.0
9 stars 10 forks source link

Add Date Created metadata field for each file #58

Closed RishikaBhatia17 closed 4 years ago

RishikaBhatia17 commented 4 years ago

Users can select the date the image has been created by selecting a date from the datepicker developed.

After the user selects the photo and proceeds to the "Upload to Wikimedia commons" button page, The user can select a date on which the image has been created using the datepicker as shown below.

image

If the user selects a date greater than the today's date, then a alert message appears on the top of the screen saying that "The Date created must be Less than or Equal to today's date" as shown below.

image

And then the value of the datepicker is set back to today's date. After the user selects a suitable date, the datepicker displays the selected date as shown below.

image

RishikaBhatia17 commented 4 years ago

Hi @tonythomas01 I would request you to please review and merge the pull request. Thank you!

tonythomas01 commented 4 years ago

Great stuff. I think we have some minor merge conflicts here again. One thing to know: get_initial_page_text is now available in https://github.com/tonythomas01/gdrive-to-commons/blob/master/uploader/wiki_uploader.py

You can use that and send the date_created_at.

RishikaBhatia17 commented 4 years ago

Hi @tonythomas01, I have resolved the conflicts and request you to review the PR and merge it.

tonythomas01 commented 4 years ago

I am sorry again, but I am getting this error on applying this branch on my machine:


Exception in thread django-main-thread:
Traceback (most recent call last):
  File "/Users/tonythomas/.pyenv/versions/gdrive-env-3.5.3/lib/python3.5/site-packages/django/urls/resolvers.py", line 581, in url_patterns
    iter(patterns)
TypeError: 'module' object is not iterable

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/tonythomas/.pyenv/versions/3.5.3/lib/python3.5/threading.py", line 914, in _bootstrap_inner
    self.run()
  File "/Users/tonythomas/.pyenv/versions/3.5.3/lib/python3.5/threading.py", line 862, in run
    self._target(*self._args, **self._kwargs)
  File "/Users/tonythomas/.pyenv/versions/gdrive-env-3.5.3/lib/python3.5/site-packages/django/utils/autoreload.py", line 54, in wrapper
    fn(*args, **kwargs)
  File "/Users/tonythomas/.pyenv/versions/gdrive-env-3.5.3/lib/python3.5/site-packages/django/core/management/commands/runserver.py", line 117, in inner_run
    self.check(display_num_errors=True)
  File "/Users/tonythomas/.pyenv/versions/gdrive-env-3.5.3/lib/python3.5/site-packages/django/core/management/base.py", line 390, in check
    include_deployment_checks=include_deployment_checks,
  File "/Users/tonythomas/.pyenv/versions/gdrive-env-3.5.3/lib/python3.5/site-packages/django/core/management/base.py", line 377, in _run_checks
    return checks.run_checks(**kwargs)
  File "/Users/tonythomas/.pyenv/versions/gdrive-env-3.5.3/lib/python3.5/site-packages/django/core/checks/registry.py", line 72, in run_checks
    new_errors = check(app_configs=app_configs)
  File "/Users/tonythomas/.pyenv/versions/gdrive-env-3.5.3/lib/python3.5/site-packages/django/core/checks/urls.py", line 13, in check_url_config
    return check_resolver(resolver)
  File "/Users/tonythomas/.pyenv/versions/gdrive-env-3.5.3/lib/python3.5/site-packages/django/core/checks/urls.py", line 23, in check_resolver
    return check_method()
  File "/Users/tonythomas/.pyenv/versions/gdrive-env-3.5.3/lib/python3.5/site-packages/django/urls/resolvers.py", line 398, in check
    for pattern in self.url_patterns:
  File "/Users/tonythomas/.pyenv/versions/gdrive-env-3.5.3/lib/python3.5/site-packages/django/utils/functional.py", line 80, in __get__
    res = instance.__dict__[self.name] = self.func(instance)
  File "/Users/tonythomas/.pyenv/versions/gdrive-env-3.5.3/lib/python3.5/site-packages/django/urls/resolvers.py", line 588, in url_patterns
    raise ImproperlyConfigured(msg.format(name=self.urlconf_name))
django.core.exceptions.ImproperlyConfigured: The included URLconf 'gdrive_to_commons.urls' does not appear to have any patterns in it. If you see valid patterns in the file then the issue is probably caused by a circular import.

``
are you also seeing this ? I am investigating this a bit as I dont think this is related to a change in this PR. 
tonythomas01 commented 4 years ago

Screenshot 2020-04-13 at 12 23 58

Finally I was able to run this, but this is what I get on Google-chrome on my machine. Can you see if this is the same for you ?

Screenshot 2020-04-13 at 12 24 44

and that is kind of a little over the top, I would assume. Some comments:

  1. We need to make sure that people have the space to type in the most important things, which are name, description.
  2. If we cannot have everything on a single row, even make it a multi line row ? So it would look like: Screenshot 2020-04-13 at 12 30 29

for the rows ? I dont see a better way to do this :-( Another option if you want to split (2) to a different larger design task would be to just have the backend implementation of a date created that would default to the current date in this PR and we merge it and we work the other thing separately.

RishikaBhatia17 commented 4 years ago

Hi @tonythomas01 I have made few changes tabulator code part and made sure that user has enough space for main details and also got the date field as collapsed list as shown below. I have tried to make a multi line row as you have described above but after reading the whole documentation I have found that we can't do that in tabulator and hence I made changes like this.

image

Hence I would request you to review the changes and merge the PR.

tonythomas01 commented 4 years ago

Hmm. I dont know. Personally, I think we might do better by just placing them all on a single row and making the whole window big enough. Also, lets not write the whole "Date work was created or first published" please. Can we think about a way to make it not take a lot of space as a column header ?

Maybe something like: Date of Creation (first published)

RishikaBhatia17 commented 4 years ago

I have made the changes you have asked for and now the page looks as shown below.

image

Hence I would request you to review the changes and merge the PR.

tonythomas01 commented 4 years ago

Wow. I like what I see here. However, there is a small issue in sending the POST body to the backend. Let me paste the error message I got from the backend.

{"fileList":[{"date_created":["This field is required."]},{"date_created":["This field is required."]}]}

apparently, the way the information is sent seems not to be right: Screenshot 2020-04-22 at 20 20 42

as you see DateCreated is probably not what you want.

RishikaBhatia17 commented 4 years ago

Hi @tonythomas01 I have made the necessary changes that you have asked above. Hence I would request you to please review the changes and merge the PR Thanks!

tonythomas01 commented 4 years ago

Okey, i could finally test it. Now I got a couple more of backend issues. See comments on the PR coming up soon.

RishikaBhatia17 commented 4 years ago

I have made the changes. Once check if anything is required.

tonythomas01 commented 4 years ago

Okey, so now I can see the upload going through. However, there is a logical issues in the feature. For example, create 2 files like this with different upload dates set: Screenshot 2020-04-23 at 17 06 46

Sadly, when the data gets POSTed, only one of them leaves the machine. YOu can see the body here and see what went wrong:

Screenshot 2020-04-23 at 17 08 52

I think this is due to some id collision in html.

RishikaBhatia17 commented 4 years ago

I have made the changes. Once check if anything is missing.

tonythomas01 commented 4 years ago

Alright. Looks good then. Time to merge. ✅ thank you!