Hi Thks.  Was able to resolve problem after completing migrations and
creating the supperuser
regards
bishop

On Thu, Apr 23, 2020 at 6:08 PM Allison Tretina <allisontret...@gmail.com>
wrote:

> I have two typos on line 6 and 9. My bad.
>
> >>> list(get_user_model().*objects.filter*(is_superuser=True).values_list('username',
> flat=True))
>
> >>> list(get_user_model().*objects.filter*(is_superuser=True).values_list('password',
> flat=True))
>
>
>
> On Thu, Apr 23, 2020 at 1:03 PM Allison Tretina <allisontret...@gmail.com>
> wrote:
>
>> Open the python shell in your terminal.
>>
>> $ python3 manage.py shell
>>
>> Import the modules to access your admin values.
>>
>> >>> from django.contrib.auth import get_user_model
>>
>> Get the username first.
>>
>> >>>
>> list(get_user_model().objects.fileter(is_superuser=True).values_list('username',
>> flat=True))
>> ['someusername'] # The username attribute is returned as string.
>>
>> Now, let's try to get the password.
>>
>> >>>
>> list(get_user_model().objects.fileter(is_superuser=True).values_list('password',
>> flat=True))
>> ['hykeft3_sha365$230001$nUYjkejaijfWESn98jalkoix3rgthaeTklia+SwklksileGs/2jilEFD/kesliI=']
>> # The output is a hex, and other metadata about the password.
>>
>> Django does not store the raw password. But the password can be set for
>> the admin User object.
>>
>> >>> from django.contrib.auth.models import User
>> >>> u = User.objects.get(username='someusername')
>> >>> u= set_password('s0m3pa$$w5rD')
>> >>> u.save()
>> >>> exit()
>>
>> Return to the admin login and you should be able to login with the new
>> set password.
>>
>>
>> On Thu, Apr 23, 2020 at 11:59 AM Bishop Akolgo <bako...@gmail.com> wrote:
>>
>>> i have a similar problem.  when i installed the env and django it did
>>> not require me to create password but after successfully installing django
>>> and trying to open admin, i need password and i cannot enter so i am
>>> stuck.  Can someone help me?
>>>
>>>
>>> On Tuesday, July 12, 2011 at 7:31:27 AM UTC+1, Suprnaturall wrote:
>>>>
>>>> Hi,
>>>>
>>>> First of all, apologize me for my poor, poor english.
>>>>
>>>> I m new with django and i m stuck with a odd thing.
>>>>
>>>> I created a login form and use the default django login handlet like
>>>> this :
>>>>
>>>> base.html :
>>>> (...)                        {% if user.is_authenticated %}
>>>>                                 <a href="#">{{user.username }}</a>
>>>>                         {% else %}
>>>>                                 <a href="{% url
>>>> django.contrib.auth.views.login %}?
>>>> next={{request.path}}">Login</a>
>>>>                         {% endif %}
>>>>                         <a href="/accounts/logout/">log out</a
>>>> (...)
>>>> login.html :
>>>> {% extends "base.html" %}
>>>>
>>>> {% block content %}
>>>>
>>>> {% if form.errors %}
>>>> <p>Your username and password didn't match. Please try again.</p>
>>>> {% endif %}
>>>>
>>>> <form method="post" action='.'>
>>>> {% csrf_token %}
>>>> <table>
>>>> <tr>
>>>>     <td>{{ form.username.label_tag }}</td>
>>>>     <td>{{ form.username }}</td>
>>>> </tr>
>>>> <tr>
>>>>     <td>{{ form.password.label_tag }}</td>
>>>>     <td>{{ form.password }}</td>
>>>> </tr>
>>>> </table>
>>>>
>>>> <input type="submit" value="login" />
>>>>         <input type="hidden" name="next" value={{request.path}} />
>>>> </form>
>>>> {% endblock %}
>>>>
>>>>
>>>> The problem is : when i m in login.html i see my user.username, but
>>>> when i submit the login form and being redirect to index i don t
>>>> retrieve the user.username.
>>>> I add in my views.py this import :
>>>> from django.template import Context, loader, RequestContext
>>>> from empireFront.models import Video
>>>> from django.http import HttpResponse
>>>> from django.contrib import auth
>>>> from django.contrib.auth import authenticate, login, logout
>>>> from django.contrib.auth.models import User
>>>> from django.http import HttpResponseRedirect
>>>> from django.contrib.sessions.models import Session
>>>>
>>>> I heard something about use render_to_response but when, where and
>>>> how ?
>>>>
>>>> Thx for your help !
>>>>
>>>>
>>>>
>>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Django users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to django-users+unsubscr...@googlegroups.com.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/7f4f7a9f-cf9a-4bf1-9d63-d2b711a58f68%40googlegroups.com
>>> <https://groups.google.com/d/msgid/django-users/7f4f7a9f-cf9a-4bf1-9d63-d2b711a58f68%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Django users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/django-users/b4MdWpPYEW4/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAJrG93CSfhQwNJ1Lv7XQJcKu%3D-ai8fAwtQv2fRDkQ4X9j9ACfA%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAJrG93CSfhQwNJ1Lv7XQJcKu%3D-ai8fAwtQv2fRDkQ4X9j9ACfA%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAMKHCxPjN1aqfdq_VdGe2Lrrx3AO6F1_pymQE49xy3RNjP%2B%2BjA%40mail.gmail.com.

Reply via email to