Re: reg: creating blog topic in database

2019-11-19 Thread 'Amitesh Sahay' via Django users
I have got a work around though, and yes, those two links were handy.



Regards,
Amitesh
 

On Monday, 18 November, 2019, 6:27:01 PM IST, 'Amitesh Sahay' via Django 
users  wrote:  
 
 Hi, 

To be honest, I have tried following the django docs link that you have shared. 
But I failed to understand the relevance . I have little knowledge. So, I might 
be little clueless here.



Regards,
Amitesh
 

On Saturday, 16 November, 2019, 5:00:11 PM IST, Integr@te System 
 wrote:  
 
 Hi Issuer
Follow to part 3 - 4 and check docs for some thing else around you need
https://docs.djangoproject.com/en/2.2/ref/templates/language/
https://docs.djangoproject.com/en/2.2/intro/tutorial04/

On Sat, Nov 16, 2019, 16:40 'Amitesh Sahay' via Django users 
 wrote:

Hello All,
I have created the two models to create post on desired topic, as well as to 
get the comments from the visitors. But, I am not able to figure out, how to 
connect that model to my HTML page. 

I know how to create a static HTML pages for each topic,and write page content 
in  tags. which I have been thinking to do until now, but it seems to be 
a time taking and non-productive way. So, now I would like to write posts in my 
database model which I have registered in admin.py. 

Any idea, how can I achieve this, as this would be a like generating dynamic 
HTML pages based on models.

I am not sure if I was able to explain my requirements. May be as I am not 
getting right words to express them. Please ask me questions if any confusion, 
I will try to answer them. 

Below is my models.py 

from django.db import models
from django.utils import timezone
from django.contrib.auth.models import User


class Post(models.Model):
STATUS_CHOICES = (
('draft', 'Draft'),
('published', 'Published'),
)
title = models.CharField(max_length=250)
slug = models.SlugField(max_length=250, unique_for_date='publish')
author = models.ForeignKey(User, related_name='blog_posts', 
on_delete=models.CASCADE)
body = models.TextField()
publish = models.DateTimeField(default=timezone.now)
created = models.DateTimeField(auto_now_add=True)
updated = models.DateTimeField(auto_now=True)
status = models.CharField(max_length=10, choices=STATUS_CHOICES, 
default='draft')

class Meta:
ordering = ('-publish',)

def __str__(self):
return self.title


class Comment(models.Model):
post = models.ForeignKey(Post, related_name='comments', 
on_delete=models.CASCADE)
name = models.CharField(max_length=80)
email = models.EmailField()
body = models.TextField()
created = models.DateTimeField(auto_now_add=True)
updated = models.DateTimeField(auto_now=True)
active = models.BooleanField(default=True)

class Meta:
ordering = ('created',)

def __str__(self):
return self.email
Regards,
Amitesh


-- 
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/1799372727.1057468.1573897086523%40mail.yahoo.com.



-- 
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/CAP5HUWr7Tt14R-o8Jz0_mAZYV2KeDm5CkwBfqQBm9T8PkjaC%3Dw%40mail.gmail.com.
  

-- 
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/294189113.1738336.1574081785206%40mail.yahoo.com.
  

-- 
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/371936794.2325659.1574168366621%40mail.yahoo.com.


Re: reg: creating blog topic in database

2019-11-18 Thread 'Amitesh Sahay' via Django users
Hi, 

To be honest, I have tried following the django docs link that you have shared. 
But I failed to understand the relevance . I have little knowledge. So, I might 
be little clueless here.



Regards,
Amitesh
 

On Saturday, 16 November, 2019, 5:00:11 PM IST, Integr@te System 
 wrote:  
 
 Hi Issuer
Follow to part 3 - 4 and check docs for some thing else around you need
https://docs.djangoproject.com/en/2.2/ref/templates/language/
https://docs.djangoproject.com/en/2.2/intro/tutorial04/

On Sat, Nov 16, 2019, 16:40 'Amitesh Sahay' via Django users 
 wrote:

Hello All,
I have created the two models to create post on desired topic, as well as to 
get the comments from the visitors. But, I am not able to figure out, how to 
connect that model to my HTML page. 

I know how to create a static HTML pages for each topic,and write page content 
in  tags. which I have been thinking to do until now, but it seems to be 
a time taking and non-productive way. So, now I would like to write posts in my 
database model which I have registered in admin.py. 

Any idea, how can I achieve this, as this would be a like generating dynamic 
HTML pages based on models.

I am not sure if I was able to explain my requirements. May be as I am not 
getting right words to express them. Please ask me questions if any confusion, 
I will try to answer them. 

Below is my models.py 

from django.db import models
from django.utils import timezone
from django.contrib.auth.models import User


class Post(models.Model):
STATUS_CHOICES = (
('draft', 'Draft'),
('published', 'Published'),
)
title = models.CharField(max_length=250)
slug = models.SlugField(max_length=250, unique_for_date='publish')
author = models.ForeignKey(User, related_name='blog_posts', 
on_delete=models.CASCADE)
body = models.TextField()
publish = models.DateTimeField(default=timezone.now)
created = models.DateTimeField(auto_now_add=True)
updated = models.DateTimeField(auto_now=True)
status = models.CharField(max_length=10, choices=STATUS_CHOICES, 
default='draft')

class Meta:
ordering = ('-publish',)

def __str__(self):
return self.title


class Comment(models.Model):
post = models.ForeignKey(Post, related_name='comments', 
on_delete=models.CASCADE)
name = models.CharField(max_length=80)
email = models.EmailField()
body = models.TextField()
created = models.DateTimeField(auto_now_add=True)
updated = models.DateTimeField(auto_now=True)
active = models.BooleanField(default=True)

class Meta:
ordering = ('created',)

def __str__(self):
return self.email
Regards,
Amitesh


-- 
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/1799372727.1057468.1573897086523%40mail.yahoo.com.



-- 
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/CAP5HUWr7Tt14R-o8Jz0_mAZYV2KeDm5CkwBfqQBm9T8PkjaC%3Dw%40mail.gmail.com.
  

-- 
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/294189113.1738336.1574081785206%40mail.yahoo.com.


Re: reg: creating blog topic in database

2019-11-16 Thread Integr@te System
Hi Issuer

Follow to part 3 - 4 and check docs for some thing else around you need

https://docs.djangoproject.com/en/2.2/ref/templates/language/
https://docs.djangoproject.com/en/2.2/intro/tutorial04/

On Sat, Nov 16, 2019, 16:40 'Amitesh Sahay' via Django users <
django-users@googlegroups.com> wrote:

> Hello All,
>
> I have created the two models to create post on desired topic, as well as
> to get the comments from the visitors. But, I am not able to figure out,
> how to connect that model to my HTML page.
>
> I know how to create a static HTML pages for each topic,and write page
> content in  tags. which I have been thinking to do until now, but it
> seems to be a time taking and non-productive way. So, now I would like to
> write posts in my database model which I have registered in admin.py.
>
> Any idea, how can I achieve this, as this would be a like generating
> dynamic HTML pages based on models.
>
> I am not sure if I was able to explain my requirements. May be as I am not
> getting right words to express them. Please ask me questions if any
> confusion, I will try to answer them.
>
> Below is my models.py
>
> from django.db import models
> from django.utils import timezone
> from django.contrib.auth.models import User
>
>
> class Post(models.Model):
> STATUS_CHOICES = (
> ('draft', 'Draft'),
> ('published', 'Published'),
> )
> title = models.CharField(max_length=250)
> slug = models.SlugField(max_length=250, unique_for_date='publish')
> author = models.ForeignKey(User, related_name='blog_posts', 
> on_delete=models.CASCADE)
> body = models.TextField()
> publish = models.DateTimeField(default=timezone.now)
> created = models.DateTimeField(auto_now_add=True)
> updated = models.DateTimeField(auto_now=True)
> status = models.CharField(max_length=10, choices=STATUS_CHOICES, 
> default='draft')
>
> class Meta:
> ordering = ('-publish',)
>
> def __str__(self):
> return self.title
>
>
> class Comment(models.Model):
> post = models.ForeignKey(Post, related_name='comments', 
> on_delete=models.CASCADE)
> name = models.CharField(max_length=80)
> email = models.EmailField()
> body = models.TextField()
> created = models.DateTimeField(auto_now_add=True)
> updated = models.DateTimeField(auto_now=True)
> active = models.BooleanField(default=True)
>
> class Meta:
> ordering = ('created',)
>
> def __str__(self):
> return self.email
>
> Regards,
> Amitesh
>
> --
> 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/1799372727.1057468.1573897086523%40mail.yahoo.com
> 
> .
>

-- 
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/CAP5HUWr7Tt14R-o8Jz0_mAZYV2KeDm5CkwBfqQBm9T8PkjaC%3Dw%40mail.gmail.com.


reg: creating blog topic in database

2019-11-16 Thread 'Amitesh Sahay' via Django users
Hello All,
I have created the two models to create post on desired topic, as well as to 
get the comments from the visitors. But, I am not able to figure out, how to 
connect that model to my HTML page. 

I know how to create a static HTML pages for each topic,and write page content 
in  tags. which I have been thinking to do until now, but it seems to be 
a time taking and non-productive way. So, now I would like to write posts in my 
database model which I have registered in admin.py. 

Any idea, how can I achieve this, as this would be a like generating dynamic 
HTML pages based on models.

I am not sure if I was able to explain my requirements. May be as I am not 
getting right words to express them. Please ask me questions if any confusion, 
I will try to answer them. 

Below is my models.py 

from django.db import models
from django.utils import timezone
from django.contrib.auth.models import User


class Post(models.Model):
STATUS_CHOICES = (
('draft', 'Draft'),
('published', 'Published'),
)
title = models.CharField(max_length=250)
slug = models.SlugField(max_length=250, unique_for_date='publish')
author = models.ForeignKey(User, related_name='blog_posts', 
on_delete=models.CASCADE)
body = models.TextField()
publish = models.DateTimeField(default=timezone.now)
created = models.DateTimeField(auto_now_add=True)
updated = models.DateTimeField(auto_now=True)
status = models.CharField(max_length=10, choices=STATUS_CHOICES, 
default='draft')

class Meta:
ordering = ('-publish',)

def __str__(self):
return self.title


class Comment(models.Model):
post = models.ForeignKey(Post, related_name='comments', 
on_delete=models.CASCADE)
name = models.CharField(max_length=80)
email = models.EmailField()
body = models.TextField()
created = models.DateTimeField(auto_now_add=True)
updated = models.DateTimeField(auto_now=True)
active = models.BooleanField(default=True)

class Meta:
ordering = ('created',)

def __str__(self):
return self.email
Regards,
Amitesh

-- 
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/1799372727.1057468.1573897086523%40mail.yahoo.com.