Search Results

Search found 9362 results on 375 pages for 'direct admin'.

Page 3/375 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • Prepopulating inlines based on the parent model in the Django Admin

    - by Alasdair
    I have two models, Event and Series, where each Event belongs to a Series. Most of the time, an Event's start_time is the same as its Series' default_time. Here's a stripped down version of the models. #models.py class Series(models.Model): name = models.CharField(max_length=50) default_time = models.TimeField() class Event(models.Model): name = models.CharField(max_length=50) date = models.DateField() start_time = models.TimeField() series = models.ForeignKey(Series) I use inlines in the admin application, so that I can edit all the Events for a Series at once. If a series has already been created, I want to prepopulate the start_time for each inline Event with the Series' default_time. So far, I have created a model admin form for Event, and used the initial option to prepopulate the time field with a fixed time. #admin.py ... import datetime class OEventInlineAdminForm(forms.ModelForm): start_time = forms.TimeField(initial=datetime.time(18,30,00)) class Meta: model = OEvent class EventInline(admin.TabularInline): form = EventInlineAdminForm model = Event class SeriesAdmin(admin.ModelAdmin): inlines = [EventInline,] I am not sure how to proceed from here. Is it possible to extend the code, so that the initial value for the start_time field is the Series' default_time?

    Read the article

  • Rate limiting Django admin login with Nginx to prevent dictionary attack

    - by shreddies
    I'm looking into the various methods of rate limiting the Django admin login to prevent dictionary attacks. One solution is explained here: simonwillison.net/2009/Jan/7/ratelimitcache/ However, I would prefer to do the rate limiting at the web server side, using Nginx. Nginx's limit_req module does just that - allowing you to specify the maximum number of requests per minute, and sending a 503 if the user goes over: http://wiki.nginx.org/NginxHttpLimitReqModule Perfect! I thought I'd cracked it until I realised that Django admin's login page is not in a consistent place, eg /admin/blah/ gives you a login page at that URL, rather than bouncing to a standard login page. So I can't match on the URL. Can anyone think of another way to know that the admin page was being displayed (regexp the response HTML?)

    Read the article

  • Django Admin drop down combobox and assigned values

    - by Daniel Garcia
    I have several question for the Django Admin feature. Im kind of new in Django so im not sure how to do it. Basically what Im looking to do is when Im adding information on the model. Some of the fields i want them to be drop-downs and maybe combo-boxes with AutoCompleteMode. Also looking for some fields to have the same information, for example if i have a datatime field I want that information to feed the fields day, month and year from hoti.hotiapp.models import Occurrence from django.contrib import admin class MyModelAdmin(admin.ModelAdmin): exclude = ['reference',] admin.site.register(Occurrence, MyModelAdmin) Anything helps Thanks in advance

    Read the article

  • Django Admin: not seeing any app (permission problem?)

    - by Facundo
    I have a site with Django running some custom apps. I was not using the Django ORM, just the view and templates but now I need to store some info so I created some models in one app and enabled the Admin. The problem is when I log in the Admin it just says "You don't have permission to edit anything", not even the Auth app shows in the page. I'm using the same user created with syncdb as a superuser. In the same server I have another site that is using the Admin just fine. Using Django 1.1.0 with Apache/2.2.10 mod_python/3.3.1 Python/2.5.2, with psql (PostgreSQL) 8.1.11 all in Gentoo Linux 2.6.23 Any ideas where I can find a solution? Thanks a lot. UPDATE: It works from the development server. I bet this has something to do with some filesystem permission but I just can't find it. UPDATE2: vhost configuration file: <Location /> SetHandler python-program PythonHandler django.core.handlers.modpython SetEnv DJANGO_SETTINGS_MODULE gpx.settings PythonDebug On PythonPath "['/var/django'] + sys.path" </Location> UPDATE 3: more info /var/django/gpx/init.py exists and is empty I run python manage.py from /var/django/gpx directory The site is GPX, one of the apps is contable and lives in /var/django/gpx/contable the user apache is webdev group and all these directories and files belong to that group and have rw permission UPDATE 4: confirmed that the settings file is the same for apache and runserver (renamed it and both broke) UPDATE 5: /var/django/gpx/contable/init.py exists This is the relevan part of urls.py: urlpatterns = patterns('', (r'^admin/', include(admin.site.urls)), ) urlpatterns += patterns('gpx', (r'^$', 'menues.views.index'), (r'^adm/$', 'menues.views.admIndex'),

    Read the article

  • Tying in to Django Admin's Model History

    - by akdom
    The Setup: I'm working on a Django application which allows users to create an object in the database and then go back and edit it as much as they desire. Django's admin site keeps a history of the changes made to objects through the admin site. The Question: How do I hook my application in to the admin site's change history so that I can see the history of changes users make to their "content" ?

    Read the article

  • django: displaying group users count in admin

    - by gruszczy
    I would like to change admin for a group, so it would display how many users are there in a certain group. I'd like to display this in the view showing all groups, the one before you enter admin for certain group. Is it possible? I am talking both about how to change admin for a group and how to add function to list_display.

    Read the article

  • Adding interactions to admin pages generated by the admin generator

    - by Stick it to THE MAN
    I am using Symfony 1.2.9 (with Propel ORM) to create a website. I have started using the admin generator to implement the admin functionality. I have come accross a slight 'problem' however. My models are related (e.g. one table may have several 1:N relations and N:N relations). I have not found a way to address this satisfactorily yet. As a tactical solution (for list views), I have decided to simply show the parent object, and then add interactions to show the related objects. I'll use a Blog model to illustrate this. Here are the relationships for a blog model: N:M relationship with Blogroll (models a blog roll) 1:N relationship with Blogpost (models a post submitted to a blog) I had originally intended on displaying the (paged) blogpost list for a blog,, when it was selected, using AJAX, but I am struggling enough with the admin generator as it is, so I have shelved that idea - unless someone is kind enough to shed some light on how to do this. Instead, what I am now doing (as a tactical/interim soln), is I have added interactions to the list view which allow a user to: View a list of the blog roll for the blog on that row View a list of the posts for the blog on that row Add a post for the blog on tha row In all of the above, I have written actions that will basically forward the request to the approriate action (admin generated). However, I need to pass some parameters (like the blog id etc), so that the correct blog roll or blog post list etc is returned. I am sure there is a better way of doing what I want to do, but in case there isn't here are my questions: How may I obtain the object that relates to a specific row (of the clicked link) in the list view (e.g. the blog object in this example) Once I have the object, I may choose to extract various fields: id etc. How can I pass these arguments to the admin generated action ? Regarding the second question, my guess is that this may be the way to do it (I may be wrong) public function executeMyAddedBlogRollInteractionLink(sfWebRequest $request) { // get the object *somehow* (I'm guessing this may work) $object = $this->getRoute()->getObject(); // retrieve the required parameters from the object, and build a query string $query_str=$object->getId(); //forward the request to the generated code (action to display blogroll list in this case) $this->forward('backendmodulename',"getblogrolllistaction?params=$query_string"); } This feels like a bit of a hack, but I'm not sure how else to go about it. I'm also not to keen on sending params (which may include user_id etc via a GET, even a POST is not that much safer, since it is fairly sraightforward to see what requests a browser is making). if there is a better way than what I suggest above to implement this kind of administration that is required for objects with 1 or more M:N relationships, I will be very glad to hear the "recommended" way of going about it. I remember reading about marking certain actions as internal. i.e. callable from only within the app. I wonder if that would be useful in this instance?

    Read the article

  • Changing User ModelAdmin for Django admin

    - by Leon
    How do you override the admin model for Users? I thought this would work but it doesn't? class UserAdmin(admin.ModelAdmin): list_display = ('email', 'first_name', 'last_name') list_filter = ('is_staff', 'is_superuser') admin.site.register(User, UserAdmin) I'm not looking to override the template, just change the displayed fields & ordering. Solutions please?

    Read the article

  • How do I secure all the admin actions in all controllers in cakePHP

    - by Gaurav Sharma
    Hello Everyone, I am developing an application using cakePHP v 1.3 on windows (XAMPP). Most of the controllers are baked with the admin routing enabled. I want to secure the admin actions of every controller with a login page. How can I do this without repeating much ? One solution to the problem is that "I check for login information in the admin_index action of every controller" and then show the login screen accordingly. Is there any better way of doing this ? The detault URL to admin (http://localhost/app/admin) is pointing to the index_admin action of users controller (created a new route for this in routes.php file) Thanks

    Read the article

  • Hide fields in Django admin

    - by jwesonga
    I'm tying to hide my slug fields in the admin by setting editable=False but every time I do that I get the following error: KeyError at /admin/website/program/6/ Key 'slug' not found in Form Request Method: GET Request URL: http://localhost:8000/admin/website/program/6/ Exception Type: KeyError Exception Value: Key 'slug' not found in Form Exception Location: c:\Python26\lib\site-packages\django\forms\forms.py in __getitem__, line 105 Python Executable: c:\Python26\python.exe Python Version: 2.6.4 Any idea why this is happening

    Read the article

  • Dropdown sorting in django-admin

    - by Andrey
    I'd like to know how can I sort values in the Django admin dropdowns. For example, I have a model called Article with a foreign key pointing to the Users model, smth like: class Article(models.Model): title = models.CharField(_('Title'), max_length=200) slug = models.SlugField(_('Slug'), unique_for_date='publish') author = models.ForeignKey(User) body = models.TextField(_('Body')) status = models.IntegerField(_('Status')) categories = models.ManyToManyField(Category, blank=True) publish = models.DateTimeField(_('Publish date')) I edit this model in django admin: class ArticleAdmin(admin.ModelAdmin): list_display = ('title', 'publish', 'status') list_filter = ('publish', 'categories', 'status') search_fields = ('title', 'body') prepopulated_fields = {'slug': ('title',)} admin.site.register(Article, ArticleAdmin) and of course it makes the nice user select dropdown for me, but it's not sorted and it takes a lot of time to find a user by username.

    Read the article

  • Django admin's filter_horizontal (& filter_vertical) not working

    - by negus
    I'm trying to use ModelAdmin.filter_horizontal and ModelAdmin.filter_vertical for ManyToMany field instead of select multiple box but all I get is: My model: class Title(models.Model): #... production_companies = models.ManyToManyField(Company, verbose_name="????????-?????????????") #... My admin: class TitleAdmin(admin.ModelAdmin): prepopulated_fields = {"slug": ("original_name",)} filter_horizontal = ("production_companies",) radio_fields = {"state": admin.HORIZONTAL} #... The javascripts are loading OK, I really don't get what happens. Django 1.1.1 stable.

    Read the article

  • where is everything in django admin?

    - by FurtiveFelon
    Hi all, I would like to figure out where everything is in django admin. Since i am currently trying to modify the behavior rather heavily right now, so perhaps a reference would be helpful. For example, where is ModelAdmin located, i cannot find it anywhere in C:\Python26\Lib\site-packages\django\contrib\admin. I need that because i would like to look at how it is implemented so that i can override with confidence. I need to do that in part because of this page: http://docs.djangoproject.com/en/dev/ref/contrib/admin/#modeladmin-methods, for example, i would like to override ModelAdmin.add_view, but i can't find the original source for that. As well as i would like to see the url routing file for admin, so i can easily figure out which url corresponding to which template etc. Thanks a lot for any pointers!

    Read the article

  • Admin auto generation

    - by Me-and-Coding
    Hi, I create custom CMS sites and then go ahead for the backend/admin side. Is there any tool out there to automatically create admin side of my sites, for example, based on table relationships or whatever customization we may put in place. PHPMaker seems to claim something like what i ask for but i have not used it. Any tool out there to auto-create admin side or PHPMaker is up to the point? Thanks

    Read the article

  • Building Admin Areas in Rails - General Questions

    - by Carb
    What is the typical format/structure for creating an administrative area in a Rails application? Specifically I am stumped in the vicinity of these topics: How do you deal with situations where a model's resources are available to both the public and the Admin? i.e. A User model where anyone can create users, login, etc but only the admin can view users, delete/update them, etc. What is the proper convention for routing? How does one structure controllers? Are duplicate controllers considered OK? i.e. An admin version and the non-admin version? Thank you!

    Read the article

  • Django admin - remove field if editing an object

    - by John McCollum
    I have a model which is accessible through the Django admin area, something like the following: # model class Foo(models.Model): field_a = models.CharField(max_length=100) field_b = models.CharField(max_length=100) # admin.py class FooAdmin(admin.ModelAdmin): pass Let's say that I want to show field_a and field_b if the user is adding an object, but only field_a if the user is editing an object. Is there a simple way to do this, perhaps using the fields attribute? If if comes to it, I could hack a JavaScript solution, but it doesn't feel right to do that at all!

    Read the article

  • Django admin panel doesn't work after modify default user model.

    - by damienix
    I was trying to extend user profile. I founded a few solutions, but the most recommended was to create new user class containing foreign key to original django.contrib.auth.models.User class. I did it with this so i have in models.py: class UserProfile(models.Model): user = models.ForeignKey(User, unique=True) website_url = models.URLField(verify_exists=False) and in my admin.py from django.contrib import admin from someapp.models import * from django.contrib.auth.admin import UserAdmin # Define an inline admin descriptor for UserProfile model class UserProfileInline(admin.TabularInline): model = UserProfile fk_name = 'user' max_num = 1 # Define a new UserAdmin class class MyUserAdmin(UserAdmin): inlines = [UserProfileInline, ] # Re-register UserAdmin admin.site.unregister(User) admin.site.register(User, MyUserAdmin) And now when I'm trying to create/edit user in admin panel i have an error: "Unknown column 'content_userprofile.id' in 'field list'" where content is my appname. I was trying to add line AUTH_PROFILE_MODULE = 'content.UserProfile' to my settings.py but with no effect. How to tell panel admin to know how to correctly display fields in user form?

    Read the article

  • Custom Django admin URL + changelist view for custom list filter by Tags

    - by Botondus
    In django admin I wanted to set up a custom filter by tags (tags are introduced with django-tagging) I've made the ModelAdmin for this and it used to work fine, by appending custom urlconf and modifying the changelist view. It should work with URLs like: http://127.0.0.1:8000/admin/reviews/review/only-tagged-vista/ But now I get 'invalid literal for int() with base 10: 'only-tagged-vista', error which means it keeps matching the review edit page instead of the custom filter page, and I cannot figure out why since it used to work and I can't find what change might have affected this. Any help appreciated. Relevant code: class ReviewAdmin(VersionAdmin): def changelist_view(self, request, extra_context=None, **kwargs): from django.contrib.admin.views.main import ChangeList cl = ChangeList(request, self.model, list(self.list_display), self.list_display_links, self.list_filter, self.date_hierarchy, self.search_fields, self.list_select_related, self.list_per_page, self.list_editable, self) cl.formset = None if extra_context is None: extra_context = {} if kwargs.get('only_tagged'): tag = kwargs.get('tag') cl.result_list = cl.result_list.filter(tags__icontains=tag) extra_context['extra_filter'] = "Only tagged %s" % tag extra_context['cl'] = cl return super(ReviewAdmin, self).changelist_view(request, extra_context=extra_context) def get_urls(self): from django.conf.urls.defaults import patterns, url urls = super(ReviewAdmin, self).get_urls() def wrap(view): def wrapper(*args, **kwargs): return self.admin_site.admin_view(view)(*args, **kwargs) return update_wrapper(wrapper, view) info = self.model._meta.app_label, self.model._meta.module_name my_urls = patterns('', # make edit work from tagged filter list view # redirect to normal edit view url(r'^only-tagged-\w+/(?P<id>.+)/$', redirect_to, {'url': "/admin/"+self.model._meta.app_label+"/"+self.model._meta.module_name+"/%(id)s"} ), # tagged filter list view url(r'^only-tagged-(P<tag>\w+)/$', self.admin_site.admin_view(self.changelist_view), {'only_tagged':True}, name="changelist_view"), ) return my_urls + urls Edit: Original issue fixed. I now receive 'Cannot filter a query once a slice has been taken.' for line: cl.result_list = cl.result_list.filter(tags__icontains=tag) I'm not sure where this result list is sliced, before tag filter is applied. Edit2: It's because of the self.list_per_page in ChangeList declaration. However didn't find a proper solution yet. Temp fix: if kwargs.get('only_tagged'): list_per_page = 1000000 else: list_per_page = self.list_per_page cl = ChangeList(request, self.model, list(self.list_display), self.list_display_links, self.list_filter, self.date_hierarchy, self.search_fields, self.list_select_related, list_per_page, self.list_editable, self)

    Read the article

  • Django - Override admin site's login form

    - by TrojanCentaur
    I'm currently trying to override the default form used in Django 1.4 when logging in to the admin site (my site uses an additional 'token' field required for users who opt in to Two Factor Authentication, and is mandatory for site staff). Django's default form does not support what I need. Currently, I've got a file in my templates/ directory called templates/admin/login.html, which seems to be correctly overriding the template used with the one I use throughout the rest of my site. The contents of the file are simply as below: # admin/login.html: {% extends "login.html" %} The actual login form is as below: # login.html: {% load url from future %}<!DOCTYPE html> <html> <head> <title>Please log in</title> </head> <body> <div id="loginform"> <form method="post" action="{% url 'id.views.auth' %}"> {% csrf_token %} <input type="hidden" name="next" value="{{ next }}" /> {{ form.username.label_tag }}<br/> {{ form.username }}<br/> {{ form.password.label_tag }}<br/> {{ form.password }}<br/> {{ form.token.label_tag }}<br/> {{ form.token }}<br/> <input type="submit" value="Log In" /> </form> </div> </body> </html> My issue is that the form provided works perfectly fine when accessed using my normal login URLs because I supply my own AuthenticationForm as the form to display, but through the Django Admin login route, Django likes to supply it's own form to this template and thus only the username and password fields render. Is there any way I can make this work, or is this something I am just better off 'hard coding' the HTML fields into the form for?

    Read the article

  • Django internationalization for admin pages - translate model name and attributes

    - by geekQ
    Django's internationalization is very nice (gettext based, LocaleMiddleware), but what is the proper way to translate the model name and the attributes for admin pages? I did not find anything about this in the documentation: http://docs.djangoproject.com/en/dev/topics/i18n/internationalization/ http://www.djangobook.com/en/2.0/chapter19/ I would like to have "???????? ????? ??? ?????????" instead of "???????? order ??? ?????????". Note, the 'order' is not translated. First, I defined a model, activated USE_I18N = True in settings.py, run django-admin makemessages -l ru. No entries are created by default for model names and attributes. Grepping in the Django source code I found: $ ack "Select %s to change" contrib/admin/views/main.py 70: self.title = (self.is_popup and ugettext('Select %s') % force_unicode(self.opts.verbose_name) or ugettext('Select %s to change') % force_unicode(self.opts.verbose_name)) So the verbose_name meta property seems to play some role here. Tried to use it: class Order(models.Model): subject = models.CharField(max_length=150) description = models.TextField() class Meta: verbose_name = _('order') Now the updated po file contains msgid 'order' that can be translated. So I put the translation in. Unfortunately running the admin pages show the same mix of "???????? order ??? ?????????". I'm currently using Django 1.1.1. Could somebody point me to the relevant documentation? Because google can not. ;-) In the mean time I'll dig deeper into the django source code...

    Read the article

  • how do you set the admin password on openldap 2.4

    - by dingfelder
    I am getting started with openLdap 2.4 and am having a bit of trouble, all the examples I see seem to refer to previous versions which used the text config file slapd.conf but from what I see on discussions about v2.4, this has been deprecated. I thought prehaps I needed to add a user, and log in as them but when I try and run an ldapadd command, I get a prompt to enter a password: Enter LDAP Password: ldap_bind: Invalid credentials (49) Notes: I installed openldap server via yum (in fedora 15), and have installed phpldapadminbut also can try things on the command line if anyone has suggestions. After installing and starting I get the following response from a search: # ldapsearch -x -b '' -s base '(objectclass=*)' namingContexts # extended LDIF # LDAPv3 # base <> with scope baseObject # filter: (objectclass=*) # requesting: namingContexts dn: namingContexts: dc=my-domain,dc=com # search result search: 2 result: 0 Success # numResponses: 2 # numEntries: 1 I am glad to remove and reinstall the server if that helps, can anyone provide a link to tips that works for version 2.4 for a new setup?

    Read the article

  • Fed up of Server Admin - Want career change guidance

    - by JB04
    Hi All, I am SA in top level MNC and what I liked turned out to be my most disliked. I feel that I am capable of doing more than what I am doing at present. This 1 hour , 2 hour SLA is not my kind. I wanna get a better life.. The rotational shift is also something I am hating these days. Awkward shifts and too many process to follow. I have 3 years of Experience. I dont wanna waste this 3 yrs of experience I wanna get into OS developer or kind of so that this three years of experience is not wasted !! Please help me out

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >