This is the views.py file

from helpers import random_password
from django.views.generic.edit import CreateView
from django.views.generic.list import ListView
from Prototype.forms import StudentForm, LecturerForm, PaymentForm
from Prototype.models import Guideline, Student, Lecturer, Payment
from Prototype.models import Course

class GuidelineListView(ListView):
    model = Guideline
    template_name = 'content.html'
    context_object_name = 'guidelines'

class Registration(CreateView):
    model = Student
    form_class = StudentForm
    template_name = "newAccount.html"
    success_url = "/Payment/"
    context_object_name = 'form'

    def send_sms(self):
        #send sms
        password = random_password()

    def post(self):
    '''generate password and send it to the user.'''
        return Super(Register, self).post()

class NewLecturer(CreateView):
    model = Lecturer
    form_class = LecturerForm
    template_name = "newAccount.html"
    success_url = "/login/"
    context_object_name = 'lecturer_form'

class CourseListView(ListView):
    model = Course
    template_name = 'index.html'
    context_object_name = 'courses'

class Payment(CreateView):
    model = Payment
    form_class = PaymentForm
    template_name = 'Payment.html'
    success_url = "/login/"
    context_object_name = 'payments'

On Fri, Jun 22, 2012 at 5:25 PM, Kurtis Mullins <kurtis.mull...@gmail.com>wrote:

> Hey emily,
>
> I think the other guys were just wanting to see your import statement
> that's broken. It should be something along these lines if you want to give
> it a try:
>
> from myproject.myapp.myhelpers import random_password
>
> Of course you'd substitute your project name, the application name, and
> then the python file that your "random_password" function/class is saved in.
>
> Let me know if you need any more help!
>
> Good luck!
> - Kurtis Mullins
>
>
> On Fri, Jun 22, 2012 at 10:19 AM, Emily <enemi...@gmail.com> wrote:
>
>> so your point is that I should post my code.
>> When I did that some time, I was told that
>> the people who were trying to help me did not
>> want to know what is in my code so I should just
>> explain what I want them to help me with.
>> But thank you any way, you point has been driven home.
>>
>>
>> On Fri, Jun 22, 2012 at 3:58 PM, Cal Leeming [Simplicity Media Ltd] <
>> cal.leem...@simplicitymedialtd.co.uk> wrote:
>>
>>> Hi Emily,
>>>
>>> Here is a really good article (written by the very people who contribute
>>> to this list) on how to ask questions on the mailing list:
>>>
>>> https://code.djangoproject.com/wiki/UsingTheMailingList
>>>
>>> It tells you what you can do to try and resolve the issue yourself, and
>>> what sort of information you need to provide so we can assist.
>>>
>>> Cal
>>>
>>>
>>> On Fri, Jun 22, 2012 at 1:48 PM, Marcin Tustin 
>>> <marcin.tus...@gmail.com>wrote:
>>>
>>>> Dear Emily,
>>>>
>>>> Do you expect us to already have a copy of your code? If not, we need
>>>> to have a short, self-contained, and correct example demonstrating your
>>>> issue.
>>>>
>>>> Marcin
>>>>
>>>>
>>>> On Fri, Jun 22, 2012 at 8:43 AM, Emily <enemi...@gmail.com> wrote:
>>>>
>>>>> Dear Marcin,
>>>>>
>>>>> I do not understand.
>>>>> I think I have done everything right and I am trying to find
>>>>> the source of the error where if there is someone who has
>>>>> experienced it they might be knowing where it is coming from..
>>>>>
>>>>> Emily
>>>>>
>>>>>
>>>>> On Fri, Jun 22, 2012 at 3:27 PM, Marcin Tustin <
>>>>> marcin.tus...@gmail.com> wrote:
>>>>>
>>>>>> Please take a look at: Short, Self Contained, Correct 
>>>>>> Example<http://sscce.org/>
>>>>>>
>>>>>> There's also some good advice at: What have you tried? - Matt 
>>>>>> Gemmell<http://whathaveyoutried.com/>
>>>>>>
>>>>>>
>>>>>> On Fri, Jun 22, 2012 at 8:10 AM, Emily N <enemi...@gmail.com> wrote:
>>>>>>
>>>>>>> Hi django users,
>>>>>>> I seem to have gotten a problem.
>>>>>>>
>>>>>>> I created a helper class in my project and I have failed to import
>>>>>>> the methods in it. Please help...
>>>>>>>
>>>>>>> This is the error I get...
>>>>>>>
>>>>>>> ImportError at /admin/
>>>>>>>
>>>>>>> cannot import name random_password
>>>>>>>
>>>>>>>  Request Method: GET  Request URL: http://127.0.0.1:8000/admin/  Django
>>>>>>> Version: 1.3.1  Exception Type: ImportError  Exception Value:
>>>>>>>
>>>>>>> cannot import name random_password
>>>>>>>
>>>>>>>  Exception Location: 
>>>>>>> /home/emily/Documents/AskJarvis/Etutor/../Etutor/Prototype/views.py
>>>>>>> in <module>, line 1  Python Executable: /usr/bin/python  Python
>>>>>>> Version: 2.7.2  Python Path:
>>>>>>>
>>>>>>> ['/home/emily/Documents/AskJarvis/Etutor',
>>>>>>>  '/usr/lib/python2.7',
>>>>>>>  '/usr/lib/python2.7/plat-linux2',
>>>>>>>  '/usr/lib/python2.7/lib-tk',
>>>>>>>  '/usr/lib/python2.7/lib-old',
>>>>>>>  '/usr/lib/python2.7/lib-dynload',
>>>>>>>  '/usr/local/lib/python2.7/dist-packages',
>>>>>>>  '/usr/lib/python2.7/dist-packages',
>>>>>>>  '/usr/lib/python2.7/dist-packages/PIL',
>>>>>>>  '/usr/lib/python2.7/dist-packages/gst-0.10',
>>>>>>>  '/usr/lib/python2.7/dist-packages/gtk-2.0',
>>>>>>>  '/usr/lib/pymodules/python2.7',
>>>>>>>  '/usr/lib/python2.7/dist-packages/ubuntu-sso-client',
>>>>>>>  '/usr/lib/python2.7/dist-packages/ubuntuone-client',
>>>>>>>  '/usr/lib/python2.7/dist-packages/ubuntuone-control-panel',
>>>>>>>  '/usr/lib/python2.7/dist-packages/ubuntuone-couch',
>>>>>>>  '/usr/lib/python2.7/dist-packages/ubuntuone-installer',
>>>>>>>  '/usr/lib/python2.7/dist-packages/ubuntuone-storage-protocol']
>>>>>>>
>>>>>>>
>>>>>>>  --
>>>>>>> You received this message because you are subscribed to the Google
>>>>>>> Groups "Django users" group.
>>>>>>> To view this discussion on the web visit
>>>>>>> https://groups.google.com/d/msg/django-users/-/C1nnWqPBZkwJ.
>>>>>>> To post to this group, send email to django-users@googlegroups.com.
>>>>>>> To unsubscribe from this group, send email to
>>>>>>> django-users+unsubscr...@googlegroups.com.
>>>>>>> For more options, visit this group at
>>>>>>> http://groups.google.com/group/django-users?hl=en.
>>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>> Marcin Tustin
>>>>>> Tel: 07773 787 105
>>>>>>
>>>>>>  --
>>>>>> You received this message because you are subscribed to the Google
>>>>>> Groups "Django users" group.
>>>>>> To post to this group, send email to django-users@googlegroups.com.
>>>>>> To unsubscribe from this group, send email to
>>>>>> django-users+unsubscr...@googlegroups.com.
>>>>>> For more options, visit this group at
>>>>>> http://groups.google.com/group/django-users?hl=en.
>>>>>>
>>>>>
>>>>>  --
>>>>> You received this message because you are subscribed to the Google
>>>>> Groups "Django users" group.
>>>>> To post to this group, send email to django-users@googlegroups.com.
>>>>> To unsubscribe from this group, send email to
>>>>> django-users+unsubscr...@googlegroups.com.
>>>>> For more options, visit this group at
>>>>> http://groups.google.com/group/django-users?hl=en.
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> Marcin Tustin
>>>> Tel: 07773 787 105
>>>>
>>>>  --
>>>> You received this message because you are subscribed to the Google
>>>> Groups "Django users" group.
>>>> To post to this group, send email to django-users@googlegroups.com.
>>>> To unsubscribe from this group, send email to
>>>> django-users+unsubscr...@googlegroups.com.
>>>> For more options, visit this group at
>>>> http://groups.google.com/group/django-users?hl=en.
>>>>
>>>
>>>  --
>>> You received this message because you are subscribed to the Google
>>> Groups "Django users" group.
>>> To post to this group, send email to django-users@googlegroups.com.
>>> To unsubscribe from this group, send email to
>>> django-users+unsubscr...@googlegroups.com.
>>> For more options, visit this group at
>>> http://groups.google.com/group/django-users?hl=en.
>>>
>>
>>  --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To post to this group, send email to django-users@googlegroups.com.
>> To unsubscribe from this group, send email to
>> django-users+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/django-users?hl=en.
>>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to