Django "module 'portal.views' has no attribute 'MyAccount'"
<p>I just made another class based view in Django and it apparently isn't being imported in urls.py, which is confusing. I even simplified it by making the view just a def.</p>

<p>views.py:</p>

<pre><code>from django.shortcuts import render
from django.views import generic
from django.contrib.auth.decorators import login_required
from django.utils.decorators import method_decorator

from django.contrib.auth.models import User
from .models import RxgAsset

# Create your views here.

def index(request):
    return render(request, 'index.html')

@method_decorator(login_required, name='dispatch')
class GregAssets(generic.ListView):
    template_name = 'greg_assets.html'
    context_object_name = 'greg_assets'

    def get_queryset(self):
        if self.request.user.is_superuser:
            return GregAsset.objects.order_by('id')
        else:
            return GregAsset.objects \
                .filter(organization=self.request.user.employee.organization) \
                .order_by('id')

class GregShowAsset(generic.DetailView):
    model = GregAsset
    template_name = 'greg_show_asset.html'
    context_object_name = 'greg_asset'

    def get_object(self, queryset=None):
        asset = GregAsset.objects.get(id=self.kwargs['pk'])
        if self.request.user.is_superuser:
            return asset
        else:
            if self.request.user.employee.organization == asset.organization:
                return asset
            else:
                return None

def MyProfile(request):
    return render(request, 'index.html')
</code></pre>

<p>urls.py:
from django.conf.urls import url
from portal import views</p>

<p>urlpatterns = [</p>

<pre><code>url(r'^$', views.index, name='index'),
url(r'^rxg_assets/$', views.RxgAssets.as_view(), name='rxg_assets'),
url(r'^rxg_assets/(?P&lt;pk&gt;[0-9]+)/$', views.RxgShowAsset.as_view(), name='rxg_show_asset'),
url(r'^my_account/$', views.MyAccount.as_view(), name='my_account'),
]
</code></pre>

<p>Output:</p>

<pre><code>AttributeError at /portal/my_account/
module 'portal.views' has no attribute 'MyAccount'
Request Method: GET
Request URL:    https://www.website.com/portal/my_account/
Django Version: 1.10.2
Exception Type: AttributeError
Exception Value:    
module 'portal.views' has no attribute 'MyAccount'
Exception Location: /server/apache/partner/portal/urls.py in &lt;module&gt;, line 8
Python Executable:  
Python Version: 3.5.2
Python Path:    
['/server/apache/partner',
 '/server/apache/partner-env/lib/python3.5/site-packages',
 '/usr/local/lib/python35.zip',
 '/usr/local/lib/python3.5',
 '/usr/local/lib/python3.5/plat-freebsd11',
 '/usr/local/lib/python3.5/lib-dynload',
 '/usr/local/lib/python3.5/site-packages']
Server time:    Tue, 18 Oct 2016 19:17:27 +0000
</code></pre>

<p>MyProfile != MyAccount. Thanks Daniel, I don't know why I didn't see that.</p>

<p>-gns</p>

python django