Re: Admin theme started reverting to default
I went through and deleted all the pyc files and still seeing default admin. On Mar 24, 10:11 am, Artem <pensivekee...@gmail.com> wrote: > I had something similar with several test projects running on my > machine. > The problem was - auto-generated .pyc files in django sources.. one > project user precompiled\precached files from another.. > I guess I mistakenly ran dev-servers with root account, so python > could put .pyc files into that folder... > I made a simple script to remove all pyc files from sources > > On 24 мар, 10:27, gondor <condor.c...@gmail.com> wrote: > > > > > I don't know if anyone has has this problem. I have been using the > > test django server and it has always rendered my customized admin > > panel correctly. One day out of the blue the admin panel just started > > using the default. I don't think I made any changes. I understand > > this is kind of vague but i'm looking for suggestions on what to look > > for and where to look. > > > None of the template/admin/ admin template modifications are > > visible... > > > (r'^(.*),admin.site.root) > > > Any suggestions or recommendations are very welcome. -- 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.
Admin theme started reverting to default
I don't know if anyone has has this problem. I have been using the test django server and it has always rendered my customized admin panel correctly. One day out of the blue the admin panel just started using the default. I don't think I made any changes. I understand this is kind of vague but i'm looking for suggestions on what to look for and where to look. None of the template/admin/ admin template modifications are visible... (r'^(.*),admin.site.root) Any suggestions or recommendations are very welcome. -- 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.
overriding the admin save in admin.py?
i'm trying to override the save function so I can add set some values that were hidden before saving. The problem is it doesn't seem to be using the save_model? Does anyone know how this is done models.py class Contact(models.Model): user = model.ForeignKey(User, editable=False) notes = TextField('Notes', blank=True) admin.py class ContactAdmin(admin.ModelAdmin) def save_model(self, request, obj, form, change): obj.user = request.user obj.save() Does anyone know how to do this or an alternative? thanx -- 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: searching stackedinline fields via search_fields in admin
Here is what i'm trying to do: I've looked at my code and I don't have a foreign key out reference from my model thus cannot find the inline fields. reverse reference doens't seem to work either class CarRadio(modesl.Model): name = models.ForeignKey('Car'); id = models.CharField(max_length='10', blank=True) class Car(models.Model): owner = CharField(max_length='10') name = CharField(max_length='10') model = CharField(max_length='10') typeofwheels = CharField(max_length='10') ... class CarAdmin(admin.Model): list_filter = {'model', 'name', 'typeofwheels'}< -- I want to add list_filter from CarRadioInline here search_fileds = {'model', 'name',}< -- I wanted to add search fields from CarRadioInline here inlines = [ CarRadioInline, ] class CarRadioInline(admin.StackedInline): model = CarRadio extra = 1 fieldset = ((None, {'fields': (('name', 'id'))}) thanx -- 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.
how to prepopulate admin form with default data?
class Notes(models.Model): name = models.ForeignKey('name', blank=True, null=True) text = models.TextField('Text',blank=True) date = models.DateField(blank=True, default=datetime.date.today()); I have a simple admin model for inputting a note with a date into the database. date is prepopulated automatically with the current timestamp. I want to automatically prepopulate the name with the current logged in user name. Does anyone know how to do that? Any help is appreciated. 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.
Prepopulate some fields in a admin add form
I have a simple admin model for inputting a note with a date into the database. In addition to that I want to prepopulate with the users name when the add new entry button is clicked. The users name is a foreign key to the user table. Does anyone know how to do that? Any help is appreciated. 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.
searching stackedinline fields via search_fields in admin
Hello All, I'm wanting to add a field from my stackedinline form to my search_fields in admin. Does anyone know how to do that or point me in a general direction/sample code? Thanx Condor -- 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.
list_search searching of stacked_inline forms using admin ?
I have several stacked_linline forms and was wondering if anyone knows how to have the filter_search include the stacked_inline attributes? Right now I can search the model and all foreign/many to many fields. I would like to include the stacked_inline fields as well. -- 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.
Does anyone know how to conditionally set the fieldsets??
I use fieldsets in my admin panel to group/title my related fields. This works great in superuser. When I log in as staff, which has some fields excluded I get an error. Caught KeyError while rendering: Key 'A' not found in Form In the simple example below if i'm a super user all works great. If i log in as a staff user thus the code exclude A fieldset I get the the error: models.py: class Cars(models.Model): A = models.CharField('A', ...) B = models C = models... D = models... admin.py: class CarsAdmin(admin.ModelAdmin): fieldsets = (_('first group'},{'fields'sad('A','B'),('C','D'),)}) def get_form(self,request,obj=None, **kwargs): self.exclude = [] if not request.user.is_superuser: self.exclude.append('A') return super(CarAdmin,self).get_form(request, obj=None, **kwargs) Bottom line is I want to maintain the grouping offered by fieldsets. Does anyone know how to conditionally set the fieldsets?? -- 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.
admin panel fieldsets for different type of users?
I use formset in my admin panel to group/title my related fields. This works great except when I go to exclude some fields for lesser users. In the simple example below if i'm a super user all works great. If i log in as a staff user thus the code exclude A formset I get the following error: Caught KeyError while rendering: Key 'A' not found in Form I don't mind having a conditional formset but I don't know how to do that based on the type of user. Does anyone know how to solve this? model.py class Cars(models.Model): A = models.CharField('A', ...) B = models C = models... D = models... admin.py class CarsAdmin(admin.ModelAdmin): fieldsets = (_('first group'},{'fields':(('A','B'),('C','D'),)}) def get_form(self,request,obj=None, **kwargs): self.exclude = [] if not request.user.is_superuser: self.exclude.append('A') return super(CarAdmin,self).get_form(request, obj=None, **kwargs) -- 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.
setting intial value for choicefield in admin panel
I am using admin panel and using get_form to retrieve one of my table objects. I have a choicefield in this object but I don't know how to set the default. I have saw numerous examples of using the following: class MyAdmin(admin.ModelAdmin): list_display = ('rank', 'name') def get_form(self,request,obj=None,**kwargs): return super(MyAdmin,self).get_form(request, obj=None, **kwargs) rank is a choicefield. choices are 1,2,3,4 right now it defaults to '---' and I want it to default to 1. I'm wanting to do this because without it i'm getting a "Incorrect integer value: '' for column 'rank' at row 1 error the '--' is giving me a empty value and I need something there or a method to handle this error ? Thanx -- 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.
displaying template item based on url
Does anyone know how to display certain template items based on url? For example. http://localhost/aeditpage/varX/ http://localhost/anothereditpage/varY I want to check if it aeditpage or anothereditpage before I decide what pieces of the template to display. In the page I grab data from a database and display it. How do I access page variables so I can display them in the template? I'm trying to pass a particular variable via the url and need access to a particular table ID. thanx Gondor -- 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.
how do I add a custom button (url) to the admin add/change page
I'm trying to add a simple button to a specific add/change page. This button takes the user to another url. I'm trying to have a https url form popup in a separate window. I have looked in the documentation and all over google but have not success. Does anyone know how to do this? -- 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.