Admin Add Page

2010-03-30 Thread Asim Yuksel
I want to use a custom admin add page with custom admin look and feel.
What is the template to extend? I want to use something like this

http://picasaweb.google.com/110428031719333287170/BaslKsZAlbum#5454485792741726834

I tried to hack the html by viewing the source but it is time
consuming and it always show a message "This field is required.". I
want to show this message when I click save.

-- 
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: Admin Add Page

2010-03-31 Thread Brandon Taylor
You can extend the change_form.html and change_list.html templates for
those views, or the base_site.html template.

Look in your: django/contrib/admin/templates/admin/ folder to see all
of the templates. Also, check out the documentation at:
http://docs.djangoproject.com/en/dev/ref/contrib/admin/#overriding-vs-replacing-an-admin-template

Cheers,
Brandon

On Mar 30, 1:16 pm, Asim Yuksel  wrote:
> I want to use a custom admin add page with custom admin look and feel.
> What is the template to extend? I want to use something like this
>
> http://picasaweb.google.com/110428031719333287170/BaslKsZAlbum#545448...
>
> I tried to hack the html by viewing the source but it is time
> consuming and it always show a message "This field is required.". I
> want to show this message when I click save.

-- 
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: Admin Add Page

2010-03-31 Thread Asim Yuksel
Thanks but I get error when I try to extend it

it says:Caught an exception while rendering: opts

and it highlights

{% submit_row %}

Any ideas?

On 31 Mart, 11:23, Brandon Taylor  wrote:
> You can extend the change_form.html and change_list.html templates for
> those views, or the base_site.html template.
>
> Look in your: django/contrib/admin/templates/admin/ folder to see all
> of the templates. Also, check out the documentation 
> at:http://docs.djangoproject.com/en/dev/ref/contrib/admin/#overriding-vs...
>
> Cheers,
> Brandon
>
> On Mar 30, 1:16 pm, Asim Yuksel  wrote:
>
> > I want to use a custom admin add page with custom admin look and feel.
> > What is the template to extend? I want to use something like this
>
> >http://picasaweb.google.com/110428031719333287170/BaslKsZAlbum#545448...
>
> > I tried to hack the html by viewing the source but it is time
> > consuming and it always show a message "This field is required.". I
> > want to show this message when I click save.

-- 
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.



Add filter to admin add page?

2019-10-21 Thread Wil Moskal
I have a model registered to the admin page, AuthUserFilePermissions, which 
consists of 2 foreign keys, a key to the defined groups, and a key to the 
filepatterns. Within the add AuthUserFilePermissions, there is a select for 
each. For the group this is fine, as there is only like 7-8. for the file 
patterns this is not good, as there are over 1000 file patterns. What I am 
trying to do is implement a search filter for the file pattern entry, 
similar to how in the add group page there is a filter for the permissions, 
around the select. Any Idea how I could complete this?

On a side note, the fields that I am entering within my modelAdmins are not 
appearing on the add page, so it would also be good to know why not. 

-- 
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/9ef69e2c-52f7-4540-b341-13f534b1e77f%40googlegroups.com.


Re: Add filter to admin add page?

2019-10-23 Thread Derek
For your filter problem, you probably need to use: 
https://github.com/farhan0581/django-admin-autocomplete-filter


On Tuesday, 22 October 2019 00:07:40 UTC+2, Wil Moskal wrote:
>
> I have a model registered to the admin page, AuthUserFilePermissions, 
> which consists of 2 foreign keys, a key to the defined groups, and a key to 
> the filepatterns. Within the add AuthUserFilePermissions, there is a select 
> for each. For the group this is fine, as there is only like 7-8. for the 
> file patterns this is not good, as there are over 1000 file patterns. What 
> I am trying to do is implement a search filter for the file pattern entry, 
> similar to how in the add group page there is a filter for the permissions, 
> around the select. Any Idea how I could complete this?
>
> On a side note, the fields that I am entering within my modelAdmins are 
> not appearing on the add page, so it would also be good to know why not. 
>

-- 
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/e83b8cd9-e322-4c0b-9ed5-c42e34ec7829%40googlegroups.com.


Re: Add filter to admin add page?

2019-10-23 Thread Nelson Varela
Or even better... whu not use django's own auto complete feature in the 
admin: 
https://docs.djangoproject.com/en/2.2/ref/contrib/admin/#django.contrib.admin.ModelAdmin.autocomplete_fields

Op dinsdag 22 oktober 2019 00:07:40 UTC+2 schreef Wil Moskal:
>
> I have a model registered to the admin page, AuthUserFilePermissions, 
> which consists of 2 foreign keys, a key to the defined groups, and a key to 
> the filepatterns. Within the add AuthUserFilePermissions, there is a select 
> for each. For the group this is fine, as there is only like 7-8. for the 
> file patterns this is not good, as there are over 1000 file patterns. What 
> I am trying to do is implement a search filter for the file pattern entry, 
> similar to how in the add group page there is a filter for the permissions, 
> around the select. Any Idea how I could complete this?
>
> On a side note, the fields that I am entering within my modelAdmins are 
> not appearing on the add page, so it would also be good to know why not. 
>

-- 
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/7d64be84-4f32-486f-804a-897f674dd749%40googlegroups.com.


Re: Add filter to admin add page?

2019-10-29 Thread Derek
It is not clear if those fields can be used in the admin list interface 
drop-down filters - is there a link to documentation for that?

On Wednesday, 23 October 2019 16:13:13 UTC+2, Nelson Varela wrote:
>
> Or even better... whu not use django's own auto complete feature in the 
> admin: 
> https://docs.djangoproject.com/en/2.2/ref/contrib/admin/#django.contrib.admin.ModelAdmin.autocomplete_fields
>
> Op dinsdag 22 oktober 2019 00:07:40 UTC+2 schreef Wil Moskal:
>>
>> I have a model registered to the admin page, AuthUserFilePermissions, 
>> which consists of 2 foreign keys, a key to the defined groups, and a key to 
>> the filepatterns. Within the add AuthUserFilePermissions, there is a select 
>> for each. For the group this is fine, as there is only like 7-8. for the 
>> file patterns this is not good, as there are over 1000 file patterns. What 
>> I am trying to do is implement a search filter for the file pattern entry, 
>> similar to how in the add group page there is a filter for the permissions, 
>> around the select. Any Idea how I could complete this?
>>
>> On a side note, the fields that I am entering within my modelAdmins are 
>> not appearing on the add page, so it would also be good to know why not. 
>>
>

-- 
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/f1ba3570-dfdc-4b2e-b503-96112ba7aee3%40googlegroups.com.


Is passing values into the admin add page possible?

2010-05-09 Thread nih
Hi all

I've got a python program that starts up a django web app, I'm trying
to figure out how to pass values from the program to the web app so
some fields in the admin add page are automatically populated with
values from the program, is the only way via url parameters?, I sense
its a lot more complicated than that :-)

Thanks, Steve

-- 
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.



Filtering the admin "add" page with manytomany foreign key attribute

2009-02-05 Thread Grimmo

Hi,
I have these models for my application:

class Movie (models.Model):
Title = models.CharField(max_length=100)
Director = models.CharField(max_length=100,blank=True)
Year = models.CharField(max_length=100,blank=True)
Backed_up = models.BooleanField(default=True)
Seen = models.BooleanField()

class Media(models.Model):
MediaNumber = models.PositiveIntegerField(unique=True)
MoviesContained =
models.ManyToManyField
(Film,related_name="related_support",verbose_name="movies")

And I'd like to have the admin interface list only movies not yet
backed up(i.e. Backed_up == False) when I add a new Media object. At
present, I have to choose from all Movie objects when I add the
foreign key to the Media.
Is it possible to do that without using javascript tricks and how?

Thanks a lot,

Grimmo

--~--~-~--~~~---~--~~
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: Is passing values into the admin add page possible?

2010-05-09 Thread leveille
On May 9, 4:58 am, nih  wrote:
> I've got a python program that starts up a django web app, I'm trying
> to figure out how to pass values from the program to the web app so
> some fields in the admin add page are automatically populated with
> values from the program, is the only way via url parameters?, I sense
> its a lot more complicated than that :-)

Hi, Steve,

I've overridden render_change_form in the past to add extra context to
a change form for one of my admin classes.  I've pasted a quick
example here: http://dpaste.com/hold/192434/.  This method can be
found in the ModelAdmin base class:
http://code.djangoproject.com/browser/django/trunk/django/contrib/admin/options.py#L605.
Of course, because request is passed to this method, you can access
GET, etc.

-- 
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: Is passing values into the admin add page possible?

2010-05-11 Thread nih
ah nice one Jason :)
sorry it took me a while to respond, I had a load more problems and I
sort of forgot about this one

I didn't get your solution working, but while I was hacking away and
searching the net for ideas I found request.GET.get('q', '') in
http://stackoverflow.com/questions/150505/django-capturing-url-parameters-in-request-get
and multiple url params in: 
http://stackoverflow.com/questions/2364700/django-url-parameter-key-used-twice

I then realise that I was already overriding the admin models
get_form() which has the request parameter, so it was simply a matter
of setting the initial state of the field via: initial=doc_no and
passing in the parameters via: add/?doc_no=Test1&doc_desc=Test2
and Test1 and Test2 ended up in the correct boxes :), I'm a bit new to
web dev stuff so have never used url parameters, so I'm glad it was
this easy, only took about ten mins :)

I've no idea if this is the right way to do what I wanted, but it
works, here's the code

class MyModelAdmin(admin.ModelAdmin):
...
def get_form(self, request, obj=None):
"""override some widgets for the admin change form"""
form = super(MyModelAdmin, self).get_form(request, obj)

doc_no = request.GET.get('doc_no', '')
doc_desc = request.GET.get('doc_desc', '')

form.base_fields['doc_no'] = forms.CharField(
widget=forms.Textarea(),
initial=doc_no)

form.base_fields['doc_desc'] = forms.CharField(
widget=forms.Textarea(),
initial=doc_desc)

return form

Thanks again Jason!

On May 9, 3:44 pm, leveille  wrote:
> On May 9, 4:58 am, nih  wrote:
>
> > I've got a python program that starts up a django web app, I'm trying
> > to figure out how to pass values from the program to the web app so
> > some fields in the admin add page are automatically populated with
> > values from the program, is the only way via url parameters?, I sense
> > its a lot more complicated than that :-)
>
> Hi, Steve,
>
> I've overridden render_change_form in the past to add extra context to
> a change form for one of my admin classes.  I've pasted a quick
> example here:http://dpaste.com/hold/192434/.  This method can be
> found in the ModelAdmin base 
> class:http://code.djangoproject.com/browser/django/trunk/django/contrib/adm
> Of course, because request is passed to this method, you can access
> GET, etc.
>
> --
> 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 
> athttp://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-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: Filtering the admin "add" page with manytomany foreign key attribute

2009-02-05 Thread Rajesh Dhawan

On Feb 5, 8:25 am, Grimmo  wrote:
> Hi,
> I have these models for my application:
>
> class Movie (models.Model):
> Title = models.CharField(max_length=100)
> Director = models.CharField(max_length=100,blank=True)
> Year = models.CharField(max_length=100,blank=True)
> Backed_up = models.BooleanField(default=True)
> Seen = models.BooleanField()
>
> class Media(models.Model):
> MediaNumber = models.PositiveIntegerField(unique=True)
> MoviesContained =
> models.ManyToManyField
> (Film,related_name="related_support",verbose_name="movies")
>
> And I'd like to have the admin interface list only movies not yet
> backed up(i.e. Backed_up == False) when I add a new Media object. At
> present, I have to choose from all Movie objects when I add the
> foreign key to the Media.
> Is it possible to do that without using javascript tricks and how?

Try the limit_choices_to attribute on your M2M field:

MoviesContained = models.ManyToManyField(Film,
related_name="related_support", verbose_name="movies",
limit_choices_to={'Backed_up':False})

http://docs.djangoproject.com/en/dev//ref/models/fields/#manytomanyfield

-RD

--~--~-~--~~~---~--~~
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: Filtering the admin "add" page with manytomany foreign key attribute

2009-02-06 Thread Grimmo

Hi!
Thanks it works like a charm now!

One last thing.. what if I want its effects to be limited
only to the "add a new" admin page, and not to the "change" one?
This solution always limits the query regarding of how many foreign
keys exist when modifying an existing media object,
sorry for not pointing it out earlier!

Grimmo

> Try the limit_choices_to attribute on your M2M field:
>
> MoviesContained = models.ManyToManyField(Film,
> related_name="related_support", verbose_name="movies",
> limit_choices_to={'Backed_up':False})
>
> http://docs.djangoproject.com/en/dev//ref/models/fields/#manytomanyfield
>
> -RD
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---