Django template cheat sheet or ebook

2018-07-29 Thread aditya gupta
Can anyone tell me where I can find Django template cheat sheet or ebook.

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAKXtCfCKCA_DE%3D5PL%2BZYiNLwp6wyB1KZUE06zboFxQKKJ7kn1g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


display my images available in one class using another class in webpage

2018-07-22 Thread aditya gupta
My Code :


class Gallery(models.Model):
GameName=models.CharField(max_length=40)
D_text=models.CharField(max_length=50)
Gime=models.ImageField(upload_to='media/',null=True,blank=True)

class Assassin(models.Model):

Gimage=models.ImageField(upload_to='media/assassin',null=True,blank=True)
imagegallery=models.ForeignKey('Gallery',on_delete='CASCADE')

( In localhost Admin
 imagegallery = Gallery Object 1 )

class Batman(models.Model):
Gimage=models.ImageField(upload_to='media/batman',null=True,blank=True)
imagegallery=models.ForeignKey('Gallery',on_delete='CASCADE')


( In localhost Admin
 imagegallery = Gallery Object 2 )


 How can I link my class "Assassin"  to class "Gallery" object 1 and class
"Batman" to class "Gallery" object 2, so that when I call object 1 of
Gallery in my Html file the images of Assassin class can also be shown.

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAKXtCfDd-9ib0SpWnA5Uh65mBoY_HXWKX1o6KyaMSkVaJ2odTw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


display my images available in one class using another class in webpage

2018-07-21 Thread aditya gupta
 my Code :


class Gallery(models.Model):
GameName=models.CharField(max_length=40)
D_text=models.CharField(max_length=50)
Gime=models.ImageField(upload_to='media/',null=True,blank=True)

class Assassin(models.Model):

Gimage=models.ImageField(upload_to='media/assassin',null=True,blank=True)
imagegallery=models.ForeignKey('Gallery',on_delete='CASCADE')

( In localhost Admin
 imagegallery = Gallery Object 1 )

class Batman(models.Model):
Gimage=models.ImageField(upload_to='media/batman',null=True,blank=True)
imagegallery=models.ForeignKey('Gallery',on_delete='CASCADE')


( In localhost Admin
 imagegallery = Gallery Object 2 )


 How can I link my class "Assassin"  to class "Gallery" object 1 and class
"Batman" to class "Gallery" object 2, so that when I call object 1 of
Gallery in my Html file the images of Assassin class can also be shown.

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAKXtCfCetV8hphUJ%2BDcr33XQRV5vBwxOeTa3uLV33CXQH%3D8v3g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Is it possible to create models inside a database model

2018-07-10 Thread aditya gupta
Well I was thinking is that instead of using related_name is there any
other way I can write and call my images inside css lightbox for the slide
show.

On Wed, Jul 11, 2018, 12:42 AM Alexander Joseph <
alexander.v.jos...@gmail.com> wrote:

> Oh ok I see. The related_name is what you use to access the specific field
> in the template so it needs to be unique to the model field. When you use
> the ForeignKey field type it uses the primaryKey of the related database
> models automatically so you dont need to worry about actually telling it
> which field to use to relate to in a RDBMS sense.
>
> On Tuesday, July 10, 2018 at 11:30:00 AM UTC-6, aditya wrote:
>>
>> I am using CBVs in model.py file and FBVs in views.py file.
>> As in image :-
>>
>> On Tue, Jul 10, 2018, 10:29 PM Alexander Joseph 
>> wrote:
>>
>>> Also- this is assuming you're using CBVs, if youre just using FBVs its
>>> probably even easier on the view side, the model side would be the same
>>>
>>> On Tuesday, July 10, 2018 at 10:23:51 AM UTC-6, Alexander Joseph wrote:

 Good question - I'm looking for a similar solution myself. My
 application is a purchase order app so that a purchase order has details
 about the purchase order but also has an unspecified number of objects that
 belong to it (purchase items).
 The only way I can think this MIGHT work is making a model for each,
 including a foreignKey to relate the puchase items back to the purchase
 order, and possibly putting both in the same
 CreateView/DetailView/UpdateView/etc. (if this is possible). I'll keep you
 updated if I find any better solutions though




 On Tuesday, July 10, 2018 at 9:26:55 AM UTC-6, aditya wrote:
>
> I have created a model Named Gallery and set upload path to media
> folder and in that folder I have 15 more folders with different images.
> Now I want to access each folder and images present inside it using
> database.
> My question is :
> Is it possible to create 15 model inside an model and if possible,
> then How to access them in my Html file? If not then what should I do to
> show them in my Html file ?

 --
>>> 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...@googlegroups.com.
>>> To post to this group, send email to django...@googlegroups.com.
>>> Visit this group at https://groups.google.com/group/django-users.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/10f8139f-ecd3-44d2-a7a6-9b6e7e2329ae%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 https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/17af2e69-1756-4156-99ce-20f01cf3aa67%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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAKXtCfCVg09iyi7ZYpe6SVQ0R40%3D1DZEH4-C0%3Df-CDZsR0B3Wg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.