I can't get Auth and Sites to show in my Admin Site
I'm reading "Python Web Develoment With Django" and I'm a total Django Newbie, and a total Python Newbie but I've heard so many great things about Django I had to try it. I been following a long in the book. I was able to get the Blog application in the book to show in the Admin app web interface. But I can't see Auth and Sites. I generated the project: django-admin.py startproject Auth and Sites are in settings.py with no issues. Something that the book did not tell me to do was in urls.py it didn't tell me to import: from django.contrib import admin to get: (r'^admin/', include(admin.site.urls)), to work. But I did. I checked my user in the database and is_superuser=1 Not sure where too look now. Been searching on the web for a while but no success in finding an answer as to why Auth and Sites don't show in the Admin app? And how can I get them to show? Any links/docs will be great. Thank you! -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@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.
Re: I can't get Auth and Sites to show in my Admin Site
I researched further and found the answer to my question. If your admin application does not show Auth and Sites and it's in your INSTALLED_APPS tuple on your settings.py INSTALLED_APPS = ( 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.sites', 'mysite2.blog', 'django.contrib.admin', ) Make sure that your urls.py has the admin.autodiscover() declared under the import statements. And bingo all the apps that should show will show. from django.conf.urls.defaults import * from django.contrib import admin from mysite2.blog.views import archive admin.autodiscover() urlpatterns = patterns('', # Example: # (r'^mysite2/', include('mysite2.foo.urls')), # Uncomment the admin/doc line below and add 'django.contrib.admindocs' # to INSTALLED_APPS to enable admin documentation: # (r'^admin/doc/', include('django.contrib.admindocs.urls')), # Uncomment the next line to enable the admin: (r'^admin/', include(admin.site.urls)), (r'^$', archive), ) -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@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.
Re: I can't get Auth and Sites to show in my Admin Site
Later I discovered also that the code was there in stubbed out version of the urls.py file just the commented out code was a light gray color that faded into the background. Lesson learned is that when dealing with generated code, read all the comments closely. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@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.
Re: Built in Users one-to-many in built-in admin
I did forget to add that and it worked! =) Thank you! g On 4/26/07, Erik Postma <[EMAIL PROTECTED]> wrote: > > > > On Apr 27, 6:11 am, mynameisgabe <[EMAIL PROTECTED]> wrote: > > Hello all - > > > > I'm using django's awesome built in admin for internal folks to view > > and manage users and the data associated with users. I've got a model > > (let's call it "Article") that contains a foreignkey pointing to the > > django.contrib.auth.models.User. That seems to be working perfectly > > except for one thing is stumping me (right now) - the admin tool > > correctly displays a list of Users to choose when you're creating/ > > editing an Article, but not the other way around. I don't see a list > > of Articles when I'm editing a User. > > > > Is there a way to do this manually, maybe by overriding the automatic > > template? > > Did you remember to set the edit_inline attribute on the ForeignKey > column? > > Best, > > Erik. > > > > > --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Django Admin site and password field
Hi all, this is my first post on this group so be gentle ;) I`ve crated a model class and an admin site. My model Users has password field. How can I rewrite it to be a password field and to get stars when I`am typing password (when creating a new user by admin site)? Sorry for my English but it is not my native language. Thx for any suggestions in advance. Gabe -- 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.
Re: Django Admin site and password field
I am using built-in Django admin. In my models.py file password field is defined: password = models.CharField(max_length=64) I just can`t see password type field for models. On 11 Maj, 20:26, Shawn Milochik wrote: > It sounds like you're not using the built-in Django admin, which would > make your life easier. > > Assuming you want to do it the hard way, you can just use a > PasswordInput widget.http://docs.djangoproject.com/en/1.3/ref/forms/widgets/ -- 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.
Re: Django Admin site and password field
First of all thx for all replies. For now I don`t use auth.User model I would like to create my own. So I have written model class Users: class Users(models.Model): login = models.CharField(max_length=64,error_messages={'required':'Podanie loginu jest obowiązkowe','unique':'Podany login już istnieje. Wybierz inny.'},help_text='Wybierz login do pracy w systemie.',unique=True) password = models.CharField(max_length=64,error_messages={'min_length':'Hasło musi zawierać od 8 do 64 znaków','required':'Podanie hasła jest wymagane'},help_text='Wprowadź hasło.') email = models.EmailField(help_text='Podaj adres e-mail. Będzie on używany do kontaktu z Tobą przez administratora.',error_messages={'required':'Podanie e-maila jest wymagane','invalid':'Format adresu jest niepoprawny'}) isActive = models.BooleanField(default=False) priviledge = models.OneToOneField(Priviledges,blank=True) activation_code = models.CharField(max_length=64,blank=True) def __unicode__(self): return self.login Then I have registered it in admin panel by editing admin.py among with another models: from django.contrib import admin from dgcmsUser.models import Users from dgcmsUser.models import Priviledges from dgcmsUser.models import UsersProfiles admin.site.register(Users) admin.site.register(UsersProfiles) admin.site.register(Priviledges) Then when I add user using autogenerated admin panel the password field is not which I would like it to be. I haven`t done any other file editions. Gabe On 12 Maj, 13:52, Michal Petrucha wrote: > On Wed, May 11, 2011 at 09:58:14PM -0700, Gabe wrote: > > I am using built-in Django admin. In my models.py file password field > > is defined: > > > password = models.CharField(max_length=64) > > > I just can`t see password type field for models. > > It is hard for us to guess what you're actually trying to achieve. > Here are my guesses: > > 1) You created your own model which has nothing to do with the admin > infrastructure (i. e. the auth infrastructure used by the admin is > the default one bundled with Django). This model includes a > CharField that you want to represent in the admin using a > PasswordWidget. > > In this case you'll just want to override the widget for this > specific field. (I don't know the specifics, you can look it up in > the tutorial or reference.) > > 2) You created a model replacing the default User model bundled in the > auth framework and are having issues with the admin login screen > using a regular TextInput for the password. This would be possible > if you specified a custom login_form to the AdminSite. > > In this case you'll also want to override the widget used for this > form field to a PasswordInput. > > I don't know if I guessed right but I hope it was at least a little > bit useful. > > Michal Petrucha > > signature.asc > < 1KWyświetlPobierz -- 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.
Re: Django Admin site and password field
Thanks for all suggestion. Subject to close (if it was forum ;)) On 12 Maj, 23:00, Michal Petrucha wrote: > On Thu, May 12, 2011 at 09:51:24AM -0700, Gabe wrote: > > First of all thx for all replies. > > > For now I don`t use auth.User model I would like to create my own. So > > I have written model class Users: > > > [...] > > > Then I have registered it in admin panel by editing admin.py among > > with another models: > > > from django.contrib import admin > > from dgcmsUser.models import Users > > from dgcmsUser.models import Priviledges > > from dgcmsUser.models import UsersProfiles > > > admin.site.register(Users) > > admin.site.register(UsersProfiles) > > admin.site.register(Priviledges) > > > Then when I add user using autogenerated admin panel the password > > field is not which I > > would like it to be. > > You have to create a custom ModelForm for your Users model. This form > will only have to override the widget of the password field. Then > you'll have to create a custom ModelAdmin specifying your ModelForm > instead of the default one. > > It may look something like this (note that I'm typing off the top of > my head): > > class UserForm(forms.ModelForm): > class Meta: > widgets = { > 'password': PasswordInput, > } > > class UserAdmin(admin.ModelAdmin): > form = UserForm > > admin.site.register(User, UserAdmin) > > OT: Note that each time someone saves a plaintext password in a > database, a kitten dies. Please, think of the kittens. (-; (Also > applies to base64-encoded passwords and such. Yeah, you wouldn't > believe it but the academic information system our university forces > us to use does exactly that. Probably because of unicode encoding > issues.) > > Michal > > signature.asc > < 1KWyświetlPobierz -- 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.
Built-in login form via inclusion tag
Hi, what I am trying to do is to put a login box which will use django.contrib.auth.views.login. According to documentation I`ve crated inclusion tag which works, but it only views form sumbit button not a whole form. This form is from tutorialand looks like this: {% load url from future %} {% block content %} {% if form.errors %} Niepoprawny login lub nazwa użytkownika. {% endif %} {% csrf_token %} {{ form.username.label_tag }} {{ form.username }} {{ form.password.label_tag }} {{ form.password }} {% endblock %} It seems like it don`t know enything about form variable. How can I give it to it via inclusion tag? best regards Gabe -- 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.
Re: Template inheritance, how to render dynamic content in base templates
I suggest reading about inclusion tags: http://docs.djangoproject.com/en/1.3/howto/custom-template-tags/ worked for me Gabe On 13 Maj, 07:51, Mateusz Marzantowicz wrote: > On Fri, May 13, 2011 at 5:15 AM, robinne wrote: > > How can I render dynamic content in a base template if I only call a> view on > my child template? > > > What I am trying to do is setup a base template that will include > > "Profile" information for the user who is logged in, for example: > > "Welcome John", instead of "login here", on every page. But if I call > > my child page "/Home" (for example) and it extends "base.html", how do > > I render the dynamic content within base.html? Thanks. > > I think you should consider using template tags mechanism. Either it is > already built into your auth/login application (there are some tags > included) or you might write your own custom tags. Please refer to > documentation > at:http://docs.djangoproject.com/en/1.3/howto/custom-template-tags/. -- 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.
Re: Built-in login form via inclusion tag
Any advice? Do I have to do new form? Gabe On 13 Maj, 14:55, Gabe wrote: > Hi, > > what I am trying to do is to put a login box which will use > django.contrib.auth.views.login. According to documentation I`ve > crated inclusion tag which works, but it only views form sumbit button > not a whole form. This form is from tutorialand looks like this: > > {% load url from future %} > > {% block content %} > > {% if form.errors %} > Niepoprawny login lub nazwa u¿ytkownika. > {% endif %} > > > {% csrf_token %} > > > {{ form.username.label_tag }} > {{ form.username }} > > > {{ form.password.label_tag }} > {{ form.password }} > > > > > > > > {% endblock %} > > It seems like it don`t know enything about form variable. How can I > give it to it via inclusion tag? > > best regards > Gabe -- 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.
Re: __unicode__() addition not working in basic poll application.
Can it be necessary to recreate a model? On 16 Maj, 16:32, momo2k wrote: > Did you restart the interpreter after adding the code? -- 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.
Rendering django message stops script
Hi, my problem is that I have somewhere in my .html file this code: {% if messages %} {% for message in messages %} {{ message }} {% endfor %} {% endif %} In one of my views when somebody adds commend I add django info message. In response there should be the message and the rest of comments redered but it stops on message. Can anyone tell me what is the problem? Is it the normal behaviour? thx in advance, sorry for my English Gabe -- 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.
Re: Rendering django message stops script
Anyone any suggestions, please? Gabe On 29 Maj, 17:29, Gabe wrote: > Hi, > > my problem is that I have somewhere in my .html file this code: > > {% if messages %} > > {% for message in messages %} > {{ > message }} > > {% endfor %} > > {% endif %} > > In one of my views when somebody adds commend I add django info > message. In response there should be the message and the rest of > comments redered but itstopson message. > > Can anyone tell me what is the problem? Is it the normal behaviour? > > thx in advance, sorry for my English > Gabe -- 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.