
from flask import Flask, render_template, flash, request, Markup, \
    session, redirect, url_for, escape, Response, abort, send_file
from flask.ext.sqlalchemy import SQLAlchemy
from sqlalchemy import func
from datetime import datetime

from iatidataquality import app
from iatidataquality import db

from iatidq import dqdownload, dqregistry, dqindicators, dqorganisations, dqpackages
import usermanagement

@app.route("/registry/refresh/")
@usermanagement.perms_required()
def registry_refresh():
    dqregistry.refresh_packages()
    return "Refreshed"

@app.route("/registry/download/")
@usermanagement.perms_required()
def registry_download():
    dqdownload.run()
    return "Downloading"


from flask import Flask, render_template, flash, request, Markup, \
    session, redirect, url_for, escape, Response, abort, send_file
from flask.ext.sqlalchemy import SQLAlchemy
from sqlalchemy import func
from datetime import datetime

from iatidataquality import app
from iatidataquality import db

from iatidq import dqdownload, dqregistry, dqindicators, dqorganisations, dqpackages
import usermanagement

@app.route("/registry/refresh/")
@usermanagement.perms_required()
def registry_refresh():
    dqregistry.refresh_packages()
    return "Refreshed"

@app.route("/registry/download/")
@usermanagement.perms_required()
def registry_download():
    dqdownload.run()
    return "Downloading"

@app.route("/registry/deleted/")
@usermanagement.perms_required()
def registry_deleted():
    num_deleted = dqregistry.check_deleted_packages()
    if num_deleted >0:
        msg = '%s packages were set to deleted' % num_deleted
    else:
        msg = "No packages were set to deleted"

    flash(msg, '')
    return redirect(url_for('packages_manage'))

Add URL for checking for deleted packages
Add URL for checking for deleted packages

  
  from flask import Flask, render_template, flash, request, Markup, \
      session, redirect, url_for, escape, Response, abort, send_file
  from flask.ext.sqlalchemy import SQLAlchemy
  from sqlalchemy import func
  from datetime import datetime
  
  from iatidataquality import app
  from iatidataquality import db
  
  from iatidq import dqdownload, dqregistry, dqindicators, dqorganisations, dqpackages
  import usermanagement
  
  @app.route("/registry/refresh/")
  @usermanagement.perms_required()
  def registry_refresh():
      dqregistry.refresh_packages()
      return "Refreshed"
  
  @app.route("/registry/download/")
  @usermanagement.perms_required()
  def registry_download():
      dqdownload.run()
      return "Downloading"
  
+ @app.route("/registry/deleted/")
+ @usermanagement.perms_required()
+ def registry_deleted():
+     num_deleted = dqregistry.check_deleted_packages()
+     if num_deleted >0:
+         msg = '%s packages were set to deleted' % num_deleted
+     else:
+         msg = "No packages were set to deleted"
+ 
+     flash(msg, '')
+     return redirect(url_for('packages_manage'))
+ 
Add URL for checking for deleted packages
## Code Before:

from flask import Flask, render_template, flash, request, Markup, \
    session, redirect, url_for, escape, Response, abort, send_file
from flask.ext.sqlalchemy import SQLAlchemy
from sqlalchemy import func
from datetime import datetime

from iatidataquality import app
from iatidataquality import db

from iatidq import dqdownload, dqregistry, dqindicators, dqorganisations, dqpackages
import usermanagement

@app.route("/registry/refresh/")
@usermanagement.perms_required()
def registry_refresh():
    dqregistry.refresh_packages()
    return "Refreshed"

@app.route("/registry/download/")
@usermanagement.perms_required()
def registry_download():
    dqdownload.run()
    return "Downloading"

## Instruction:
Add URL for checking for deleted packages
## Code After:

from flask import Flask, render_template, flash, request, Markup, \
    session, redirect, url_for, escape, Response, abort, send_file
from flask.ext.sqlalchemy import SQLAlchemy
from sqlalchemy import func
from datetime import datetime

from iatidataquality import app
from iatidataquality import db

from iatidq import dqdownload, dqregistry, dqindicators, dqorganisations, dqpackages
import usermanagement

@app.route("/registry/refresh/")
@usermanagement.perms_required()
def registry_refresh():
    dqregistry.refresh_packages()
    return "Refreshed"

@app.route("/registry/download/")
@usermanagement.perms_required()
def registry_download():
    dqdownload.run()
    return "Downloading"

@app.route("/registry/deleted/")
@usermanagement.perms_required()
def registry_deleted():
    num_deleted = dqregistry.check_deleted_packages()
    if num_deleted >0:
        msg = '%s packages were set to deleted' % num_deleted
    else:
        msg = "No packages were set to deleted"

    flash(msg, '')
    return redirect(url_for('packages_manage'))
