**Apache Airflow version**: 2.0.0b2


**Kubernetes version (if you are using kubernetes)** (use `kubectl version`): N/A

**Environment**: 

- **Cloud provider or hardware configuration**: Ubuntu 20.04 Guest/Windows Server 2012 R2 Host
- **OS** (e.g. from /etc/os-release): Ubuntu 20.04.1 LTS
- **Kernel** (e.g. `uname -a`): Linux  5.4.0-1031-azure #32-Ubuntu SMPx86_64  GNU/Linux
- **Install tools**:  Pip 20.3b1, Ansible Template - https://github.com/jrd281/ansible-role-airflow/tree/airflowdbg-1
- **Others**: Python 3.8

**What happened**:  I was looking at the taskinstance list and then I clicked the edit icon.  After clicking, an error page was displayed.

<!-- (please include exact error messages if you can) -->

**What you expected to happen**: I expected to be whisked to an editing UI

<!-- What do you think went wrong? -->

**How to reproduce it**: 

1. Visit your installation's home page
2. Click the success bucket under the `Recent Tasks` heading
    <img width="261" alt="AirflowDebug#1" src="https://user-images.githubusercontent.com/848305/99696511-c5462b00-2a5c-11eb-92f1-088347b657a2.png">
3. Click the `Edit` button for one of your tasks
    <img width="285" alt="AirflowDebug#2" src="https://user-images.githubusercontent.com/848305/99696788-1524f200-2a5d-11eb-9127-5a308a8ba14c.png">
4. Watch the system throw an error.
    <img width="355" alt="AirflowDebug#3" src="https://user-images.githubusercontent.com/848305/99697050-57e6ca00-2a5d-11eb-93f1-1e88aaf59c63.png">

**Anything else we need to know**:

<details><summary>UI Error Page</summary>
Something bad has happened.
Please consider letting us know by creating a bug report using GitHub.

Python version: 3.8.5
Airflow version: 2.0.0b2
Node: REDACTED
-------------------------------------------------------------------------------
Traceback (most recent call last):
  File "/var/lib/airflow/venv/lib/python3.8/site-packages/flask/app.py", line 2447, in wsgi_app
    response = self.full_dispatch_request()
  File "/var/lib/airflow/venv/lib/python3.8/site-packages/flask/app.py", line 1952, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/var/lib/airflow/venv/lib/python3.8/site-packages/flask/app.py", line 1821, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/var/lib/airflow/venv/lib/python3.8/site-packages/flask/_compat.py", line 39, in reraise
    raise value
  File "/var/lib/airflow/venv/lib/python3.8/site-packages/flask/app.py", line 1950, in full_dispatch_request
    rv = self.dispatch_request()
  File "/var/lib/airflow/venv/lib/python3.8/site-packages/flask/app.py", line 1936, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/var/lib/airflow/venv/lib/python3.8/site-packages/flask_appbuilder/security/decorators.py", line 109, in wraps
    return f(self, *args, **kwargs)
  File "/var/lib/airflow/venv/lib/python3.8/site-packages/flask_appbuilder/views.py", line 606, in edit
    return self.render_template(
  File "/var/lib/airflow/venv/lib/python3.8/site-packages/flask_appbuilder/baseviews.py", line 280, in render_template
    return render_template(
  File "/var/lib/airflow/venv/lib/python3.8/site-packages/flask/templating.py", line 137, in render_template
    return _render(
  File "/var/lib/airflow/venv/lib/python3.8/site-packages/flask/templating.py", line 120, in _render
    rv = template.render(context)
  File "/var/lib/airflow/venv/lib/python3.8/site-packages/jinja2/environment.py", line 1090, in render
    self.environment.handle_exception()
  File "/var/lib/airflow/venv/lib/python3.8/site-packages/jinja2/environment.py", line 832, in handle_exception
    reraise(*rewrite_traceback_stack(source=source))
  File "/var/lib/airflow/venv/lib/python3.8/site-packages/jinja2/_compat.py", line 28, in reraise
    raise value.with_traceback(tb)
  File "/var/lib/airflow/venv/lib/python3.8/site-packages/flask_appbuilder/templates/appbuilder/general/model/edit.html", line 2, in top-level template code
    {% import 'appbuilder/general/lib.html' as lib %}
  File "/var/lib/airflow/venv/lib/python3.8/site-packages/flask_appbuilder/templates/appbuilder/base.html", line 1, in top-level template code
    {% extends base_template %}
  File "/var/lib/airflow/venv/lib/python3.8/site-packages/airflow/www/templates/airflow/master.html", line 20, in top-level template code
    {% extends 'appbuilder/baselayout.html' %}
  File "/var/lib/airflow/venv/lib/python3.8/site-packages/flask_appbuilder/templates/appbuilder/baselayout.html", line 2, in top-level template code
    {% import 'appbuilder/baselib.html' as baselib %}
  File "/var/lib/airflow/venv/lib/python3.8/site-packages/flask_appbuilder/templates/appbuilder/init.html", line 46, in top-level template code
    {% block body %}
  File "/var/lib/airflow/venv/lib/python3.8/site-packages/flask_appbuilder/templates/appbuilder/baselayout.html", line 19, in block "body"
    {% block content %}
  File "/var/lib/airflow/venv/lib/python3.8/site-packages/flask_appbuilder/templates/appbuilder/general/model/edit.html", line 23, in block "content"
    {% block edit_form %}
  File "/var/lib/airflow/venv/lib/python3.8/site-packages/flask_appbuilder/templates/appbuilder/general/model/edit.html", line 25, in block "edit_form"
    {{ widgets.get('edit')(form_action=form_action)|safe }}
  File "/var/lib/airflow/venv/lib/python3.8/site-packages/flask_appbuilder/widgets.py", line 37, in __call__
    return template.render(args)
  File "/var/lib/airflow/venv/lib/python3.8/site-packages/jinja2/environment.py", line 1090, in render
    self.environment.handle_exception()
  File "/var/lib/airflow/venv/lib/python3.8/site-packages/jinja2/environment.py", line 832, in handle_exception
    reraise(*rewrite_traceback_stack(source=source))
  File "/var/lib/airflow/venv/lib/python3.8/site-packages/jinja2/_compat.py", line 28, in reraise
    raise value.with_traceback(tb)
  File "/var/lib/airflow/venv/lib/python3.8/site-packages/flask_appbuilder/templates/appbuilder/general/widgets/form.html", line 45, in top-level template code
    {{ lib.render_field(field, begin_sep_label, end_sep_label, begin_sep_field, end_sep_field) }}
  File "/var/lib/airflow/venv/lib/python3.8/site-packages/jinja2/runtime.py", line 679, in _invoke
    rv = self._func(*arguments)
  File "/var/lib/airflow/venv/lib/python3.8/site-packages/flask_appbuilder/templates/appbuilder/general/lib.html", line 237, in template
    {{ field(**kwargs)|safe }}
  File "/var/lib/airflow/venv/lib/python3.8/site-packages/wtforms/fields/core.py", line 160, in __call__
    return self.meta.render_field(self, kwargs)
  File "/var/lib/airflow/venv/lib/python3.8/site-packages/wtforms/meta.py", line 56, in render_field
    return field.widget(field, **render_kw)
  File "/var/lib/airflow/venv/lib/python3.8/site-packages/flask_appbuilder/fieldwidgets.py", line 176, in __call__
    return super(Select2ManyWidget, self).__call__(field, **kwargs)
  File "/var/lib/airflow/venv/lib/python3.8/site-packages/wtforms/widgets/core.py", line 300, in __call__
    for val, label, selected in field.iter_choices():
  File "/var/lib/airflow/venv/lib/python3.8/site-packages/flask_appbuilder/fields.py", line 209, in iter_choices
    yield (pk, self.get_label(obj), obj in self.data)
TypeError: argument of type 'DagRun' is not iterable
</details>

**How often does this problem occur?:** Every time I click the `Edit` icon

airflow/www/views.py
"""
    Create the list of edges needed to construct the Graph View.
    A special case is made if a TaskGroup is immediately upstream/downstream of another
    TaskGroup or task. Two dummy nodes named upstream_join_id and downstream_join_id are
    created for the TaskGroup. Instead of drawing an edge onto every task in the TaskGroup,
    all edges are directed onto the dummy nodes. This is to cut down the number of edges on
    the graph.
    For example: A DAG with TaskGroups group1 and group2:
        group1: task1, task2, task3
        group2: task4, task5, task6
    group2 is downstream of group1:
        group1 >> group2
    Edges to add (This avoids having to create edges between every task in group1 and group2):
        task1 >> downstream_join_id
        task2 >> downstream_join_id
        task3 >> downstream_join_id
        downstream_join_id >> upstream_join_id
        upstream_join_id >> task4
        upstream_join_id >> task5
        upstream_join_id >> task6
    """
    
    edges_to_add = set()
    
    edges_to_skip = set()
    task_group_map = dag.task_group.get_task_group_dict()
    def collect_edges(task_group):