Re: Django: How to customize the admin form for specific model

2015-02-03 Thread carlos
Hi, in addition Collin answer you need use sorl-thumbnail in show picture
in admin
http://sorl-thumbnail.readthedocs.org/en/latest/examples.html#admin-examples

Cheers

On Tue, Jan 27, 2015 at 2:11 PM, Collin Anderson 
wrote:

> Hi,
>
> You could have the images be inline:
>
> class CommentImageInline(models.TabularInline):
> model = CommentImage
> extra = 0
>
> class CommentAdmin(models.ModelAdmin):
> inlines = [CommentImageInline]
>
> Though, you may need to use a custom widget to get the actual images to
> show up.
>
> Collin
>
> On Saturday, January 24, 2015 at 2:31:02 PM UTC-5, Shoaib Ijaz wrote:
>>
>> First of all I apologize the question title can be unrelated to my query.
>> I am also confused what I want to do because I am less familiar with django.
>>
>> I want to create simple comment system. The requirement is clear that
>> user can post comment with multiple images.Every comment should have reply.
>> so I created following models.
>>
>> #comment table class Comments(models.Model):
>> parent = models.ForeignKey('self',null=True) // for comment reply
>> description = models.TextField(max_length=1000, blank=False, null=False)
>>
>> class Meta:
>> db_table = u'comments'
>>
>> #images tableclass CommentImages(models.Model):
>> comment = models.ForeignKey(Comments)
>> image = models.CharField(max_length=250, blank=False, null=False)
>>
>> class Meta:
>> db_table = u'comments_images'
>>
>> I have query about admin side how can i manage these things?
>>
>> I want to show images list when admin view the specific comment.
>>
>> Admin can view replies of specific comment.
>>
>> Here i draw the example. [image: enter image description here]
>>
>> So I dont want to ask about coding. I want to know what techniques will
>> be used to change the admin view. I am using admin panel for others models
>> too so I want to change the specific model view.
>>
>> How can I get these things? Thank you
>>
>  --
> 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 post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/c399d663-c514-439d-b7e4-bab765fc6ea4%40googlegroups.com
> 
> .
>
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAM-7rO3RDECey%2B5dqOeRkioevgC%3DRexnyY9BOnNjhKefk5CrYg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django: How to customize the admin form for specific model

2015-01-27 Thread Collin Anderson
Hi,

You could have the images be inline:

class CommentImageInline(models.TabularInline):
model = CommentImage
extra = 0

class CommentAdmin(models.ModelAdmin):
inlines = [CommentImageInline]

Though, you may need to use a custom widget to get the actual images to 
show up.

Collin

On Saturday, January 24, 2015 at 2:31:02 PM UTC-5, Shoaib Ijaz wrote:
>
> First of all I apologize the question title can be unrelated to my query. 
> I am also confused what I want to do because I am less familiar with django.
>
> I want to create simple comment system. The requirement is clear that user 
> can post comment with multiple images.Every comment should have reply. so I 
> created following models.
>
> #comment table class Comments(models.Model):
> parent = models.ForeignKey('self',null=True) // for comment reply
> description = models.TextField(max_length=1000, blank=False, null=False)
>
> class Meta:
> db_table = u'comments'
>
> #images tableclass CommentImages(models.Model):
> comment = models.ForeignKey(Comments)
> image = models.CharField(max_length=250, blank=False, null=False)
>
> class Meta:
> db_table = u'comments_images'
>
> I have query about admin side how can i manage these things?
>
> I want to show images list when admin view the specific comment.
>
> Admin can view replies of specific comment.
>
> Here i draw the example. [image: enter image description here]
>
> So I dont want to ask about coding. I want to know what techniques will be 
> used to change the admin view. I am using admin panel for others models too 
> so I want to change the specific model view.
>
> How can I get these things? Thank you
>

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/c399d663-c514-439d-b7e4-bab765fc6ea4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django: How to customize the admin form for specific model

2015-01-24 Thread Thomas Rega
You could get this things done by customization of the corresponding admin
template: templates/admin/change_form.html

This can be done per app and per model:
https://docs.djangoproject.com/en/1.7/ref/contrib/admin/#templates-which-may-be-overridden-per-app-or-model

Good Luck
TR

2015-01-24 20:31 GMT+01:00 Shoaib Ijaz :

> First of all I apologize the question title can be unrelated to my query.
> I am also confused what I want to do because I am less familiar with django.
>
> I want to create simple comment system. The requirement is clear that user
> can post comment with multiple images.Every comment should have reply. so I
> created following models.
>
> #comment table class Comments(models.Model):
> parent = models.ForeignKey('self',null=True) // for comment reply
> description = models.TextField(max_length=1000, blank=False, null=False)
>
> class Meta:
> db_table = u'comments'
>
> #images tableclass CommentImages(models.Model):
> comment = models.ForeignKey(Comments)
> image = models.CharField(max_length=250, blank=False, null=False)
>
> class Meta:
> db_table = u'comments_images'
>
> I have query about admin side how can i manage these things?
>
> I want to show images list when admin view the specific comment.
>
> Admin can view replies of specific comment.
>
> Here i draw the example. [image: enter image description here]
>
> So I dont want to ask about coding. I want to know what techniques will be
> used to change the admin view. I am using admin panel for others models too
> so I want to change the specific model view.
>
> How can I get these things? Thank you
>
> --
> 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 post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/0fb17b82-042a-4d45-a8dd-bb842d94923c%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAFgu0xhp4FuwNHUkbhY2E_X2gpKbFNL_2RxVZnF1-W9-4ppgJw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Django: How to customize the admin form for specific model

2015-01-24 Thread Shoaib Ijaz


First of all I apologize the question title can be unrelated to my query. I 
am also confused what I want to do because I am less familiar with django.

I want to create simple comment system. The requirement is clear that user 
can post comment with multiple images.Every comment should have reply. so I 
created following models.

#comment table class Comments(models.Model):
parent = models.ForeignKey('self',null=True) // for comment reply
description = models.TextField(max_length=1000, blank=False, null=False)

class Meta:
db_table = u'comments'

#images tableclass CommentImages(models.Model):
comment = models.ForeignKey(Comments)
image = models.CharField(max_length=250, blank=False, null=False)

class Meta:
db_table = u'comments_images'

I have query about admin side how can i manage these things?

I want to show images list when admin view the specific comment.

Admin can view replies of specific comment.

Here i draw the example. [image: enter image description here]

So I dont want to ask about coding. I want to know what techniques will be 
used to change the admin view. I am using admin panel for others models too 
so I want to change the specific model view.

How can I get these things? Thank you

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/0fb17b82-042a-4d45-a8dd-bb842d94923c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.