Django templates render

63 views
Skip to first unread message

RONAK JAIN

unread,
Sep 1, 2018, 8:17:15 PM9/1/18
to Django users
Namaste !!

Dear ,

I have two models categories and Project.

 created like that :

class Category(models.Model):
    categorys = models.ManyToManyField('Category',blank=True)
    name = models.CharField(max_length=100)
    created_at = models.DateTimeField(auto_now=False, auto_now_add=True)
    updated_at = models.DateTimeField(auto_now=True)



    class Meta:
        verbose_name_plural = "Categories"

    def __str__(self):
        return self.name

    def __unicode__(self):
        return self.categorys

class Project(models.Model):
    categorys = models.ManyToManyField('Category',blank=True)
    name = models.CharField(max_length=100)
    description = models.CharField(max_length=100)
    created_at = models.DateTimeField(auto_now=False, auto_now_add=True)
    updated_at = models.DateTimeField(auto_now=True)
    photo = models.ImageField(upload_to="pictures")


    def __str__(self):
        return self.name

    def __unicode__(self):
        return self.categorys

and Views I did here :

from web.models import Category,Project

class Portfolio(TemplateView):
    template_name = "web/protfolio.html"

    def post(self, request, *args, **kwargs):
        context = self.get_context_data()
        return super(TemplateView, self).render_to_response(context)
    
    def portfolio(request):
          context = RequestContext(request)
          # Project_list = Project.objects.order_by('-likes')[:3]
          # context_dict = {'Project': project_list}
          # return render(template_name, context_dict, context
          brand_list = Category.objects.all()
          return render(template_name, {'brand_list' : brand_list}, context)

I need correct relationship both I mean project and categories. How can I do correct here ? 
Note : I attached picture please analyse briefly.

How to do approch html page and   I want  the html(view) page should load from our db.
please give me quickly answer.
How can i do ?


Thanks
Ronak
Screenshot from 2018-09-02 00-46-30.png

Jason

unread,
Sep 1, 2018, 8:30:49 PM9/1/18
to Django users
I'm sorry, I have no idea what you're trying to do.  what exactly is correct relationship and what is different from the render output that you desire?

sankar ardhas

unread,
Sep 2, 2018, 5:42:00 AM9/2/18
to django...@googlegroups.com

Hi to all,
            Which is the best editor for django framework  in Ubuntu os 18.04




--
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/63ecd6f1-411a-4581-b245-296efbd49303%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

RONAK JAIN

unread,
Sep 2, 2018, 5:51:37 AM9/2/18
to django...@googlegroups.com

sankar ardhas

unread,
Sep 2, 2018, 5:56:01 AM9/2/18
to django...@googlegroups.com
Thanks for response.. for Windows?


Atom is best editor.

To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.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+unsubscribe@googlegroups.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+unsubscribe@googlegroups.com.

To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.

RONAK JAIN

unread,
Sep 2, 2018, 6:19:44 AM9/2/18
to django...@googlegroups.com
Both of the same atom is best and option sublime or Pycharm.


Thanks
Ronak Jain

Atom is best editor.

To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.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...@googlegroups.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...@googlegroups.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...@googlegroups.com.

To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.

RONAK JAIN

unread,
Sep 2, 2018, 6:25:14 AM9/2/18
to django...@googlegroups.com
Thanks for reply
Firar of all i need here I want to make relation between projects and categories.
You can look attached HTML page picture  there categories parts three attributes digital, print or branding and projects are there show pictures or pictures name.
1. How can I make expect relation between in models ?
2. How can i do HTML page should load from our db ?


Thanks
Ronak Jain


On Sun, 2 Sep 2018, 2:01 a.m. Jason, <jjohn...@gmail.com> wrote:
I'm sorry, I have no idea what you're trying to do.  what exactly is correct relationship and what is different from the render output that you desire?

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

Kasper Laudrup

unread,
Sep 2, 2018, 9:34:58 AM9/2/18
to django...@googlegroups.com


On 02/09/2018 07.50, RONAK JAIN wrote:
> Atom is best editor.
>

No, no, no. Everyone knows emacs is the best editor.

Kasper Laudrup

unread,
Sep 2, 2018, 9:40:33 AM9/2/18
to django...@googlegroups.com
Hi Ronak,

On 02/09/2018 08.24, RONAK JAIN wrote:
> Thanks for reply
> Firar of all i need here I want to make relation between projects and
> categories.
> You can look attached HTML page picture there categories parts three
> attributes digital, print or branding and projects are there show pictures
> or pictures name.

It is very hard to understand exactly what you mean. Have you followed
the django starter tutorial:

https://www.djangoproject.com/start/

> 1. How can I make expect relation between in models ?

By using Django models I guess?

https://docs.djangoproject.com/en/2.1/topics/db/models/

> 2. How can i do HTML page should load from our db ?
>

By using Django views and templates I guess?

https://docs.djangoproject.com/en/2.1/topics/http/views/

Kind regards,

Kasper Laudrup

RONAK JAIN

unread,
Sep 2, 2018, 9:49:24 AM9/2/18
to django...@googlegroups.com
can you come on Skype or teamviewer.

Thanks
Ronak Jain

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

Vinod Kumar

unread,
Sep 2, 2018, 9:52:27 AM9/2/18
to django...@googlegroups.com
Pycharm is best for Django..


For more options, visit https://groups.google.com/d/optout.

************************************************************************

This e-mail and all attachments are intended solely for use by the intended recipient and may contain confidential / proprietary information of KiwiTech, LLC, subject to important disclaimers and conditions including restrictions on the use, disclosure, transfer or export of such information. If you have received this message in error or are not the named recipient(s), please immediately notify the sender at the telephone number stated above or by reply e-mail and delete this e-mail from your computer

Wira Bhakti

unread,
Sep 2, 2018, 11:24:34 AM9/2/18
to django...@googlegroups.com
Vim is good editor

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

Kasper Laudrup

unread,
Sep 2, 2018, 11:43:48 AM9/2/18
to django...@googlegroups.com
Hi Ronak,

On 02/09/2018 11.48, RONAK JAIN wrote:
> can you come on Skype or teamviewer.
>

No, why?

So we can continue a flamewar over which text editor is the best? :-)

Mentioning Emacs was mostly a joke. Which editor is the "best" is highly
subjective.

Kind regards,

Kasper Laudrup

vishal sharma

unread,
Sep 2, 2018, 11:51:07 AM9/2/18
to django...@googlegroups.com
Hi All,
How to upload files back to node server. I am new in ApI I am using the Django where I am downloading files from node server and will process videos files once processing will be done will upload videos back to server.
Also, How to work with internal files in Django I am running my script locally it is working fine but when I am running these script in Django I am getting an error.
Can somebody help and advise ? 

Thanks,
Vishal

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

Kasper Laudrup

unread,
Sep 2, 2018, 12:21:45 PM9/2/18
to django...@googlegroups.com
Hi Vishal,

On 02/09/2018 13.48, vishal sharma wrote:
> Hi All,
> How to upload files back to node server. I am new in ApI I am using the
> Django where I am downloading files from node server and will process
> videos files once processing will be done will upload videos back to server.

So, if I understand correctly, you are downloading some video files from
a node.js server, processing them and now want to upload them again?

What does Django have to do with that? Why even involve Django in that,
it seems completely unrelated. Just write a Python (or whatever) script
for that.

> Also, How to work with internal files in Django I am running my script
> locally it is working fine but when I am running these script in Django I
> am getting an error.

I have no idea what you mean by "internal files". What script are you
trying to run, what do you mean by "running it in Django"? What error
are you getting?

You need to be a lot more specific if you want help.

Kind regards,

Kasper Laudrup

vishal sharma

unread,
Sep 2, 2018, 12:26:54 PM9/2/18
to django...@googlegroups.com
I am using Mocha VR object removing tool on Django. I am calling tool API and removing the object from IDLE that works fine but when I am running same script inside Django it is not removing the object. 



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

RONAK JAIN

unread,
Sep 2, 2018, 12:26:58 PM9/2/18
to django...@googlegroups.com
Hello Kasper


can I share me my screen ?

Thanks
Ronak Jain

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

Kasper Laudrup

unread,
Sep 2, 2018, 12:46:46 PM9/2/18
to django...@googlegroups.com
Hi Ronak,

On 02/09/2018 14.26, RONAK JAIN wrote:
> Hello Kasper
>
>
> can I share me my screen ?
>

What do you mean? If I want to start an interactive debugging session
with you? Then the answer is no.

If you have any problems with using Django feel free to post them here.
Describe what you are trying to achieve, what you have done, relevant
code snippets and any error you are getting.

Then I'm sure there a many willing to help you.

Also please don't hijack completely unrelated threads when you ask a
question.

Kind regards,

Kasper Laudrup

Kasper Laudrup

unread,
Sep 2, 2018, 12:49:18 PM9/2/18
to django...@googlegroups.com
Hi Vishal,

On 02/09/2018 14.26, vishal sharma wrote:
> I am using Mocha VR object removing tool on Django. I am calling tool API
> and removing the object from IDLE that works fine but when I am running
> same script inside Django it is not removing the object.
>
>

That's quite relevant information.

I have no experience with Mocha VR (haven't even heard of it before),
but try to post the script you are trying to run, describe how you are
"running it inside Django" and any errors you might be getting. Then I'm
sure someone will be willing to try and help you.

Kind regards,

Kasper Laudrup

vishal sharma

unread,
Sep 2, 2018, 12:54:21 PM9/2/18
to django...@googlegroups.com
No error occurred but Script failed to generate o/p in the o/p dir. 

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

RONAK JAIN

unread,
Sep 2, 2018, 12:58:08 PM9/2/18
to django...@googlegroups.com
okay Thanks
I am not asking about error but I need practical so I was saying online but I can describe here. I have one template who is prepared in html, css and js.  there are few options like contacts, blog, portfolio like that.
I need help here:
Portfolio Page 
There are portfolio images and categories above it. We want to do the same So new model is required Category  and a relationship between Category and projects So the portfolio page should load from our db.
1.   How to make relationship category and project ? 
2. How can I load from our db ?

I am attaching files please look or give me better idea or code.


Thanks 
Ronak 

--
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.
Screenshot from 2018-09-02 00-46-30.png
Screenshot from 2018-09-02 18-27-01.png
Screenshot from 2018-09-02 18-26-42.png
Screenshot from 2018-09-02 18-26-56.png

Kasper Laudrup

unread,
Sep 2, 2018, 2:00:05 PM9/2/18
to django...@googlegroups.com
Hi Ronak,

On 02/09/2018 14.57, RONAK JAIN wrote:
> okay Thanks
> *Portfolio Page *
> There are portfolio images and categories above it. We want to do the same
> So new model is required Category and a relationship between Category and
> projects So the portfolio page should load from our db*.*
> *1. How to make relationship category and project ?*
> *2. How can I load from our db ?*
>

I'm sorry, but I really don't understand what your issue is.

You can definitely make a relationship between your Category and Project
model.

You can load from you database the same way you would use any other
database model in Django.

I'm afraid I cannot help you. Maybe someone else can understand what you
are trying to achieve and what your challenges are.

Kind regards,

Kasper Laudrup

RONAK JAIN

unread,
Sep 2, 2018, 2:04:22 PM9/2/18
to django...@googlegroups.com
okay, Thanks


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

Ari Davidow

unread,
Sep 2, 2018, 3:57:59 PM9/2/18
to django-users

gilwell muhati

unread,
Sep 2, 2018, 7:41:39 PM9/2/18
to django...@googlegroups.com
Hello Sankaradhas,



All the best

Regards,

Gilwell Muhati | +254 710 739 116 |

~~“The mind is its own place and in itself can make a heaven of hell, a hell of heaven…”~~John Milton


victor jack

unread,
Sep 2, 2018, 9:46:12 PM9/2/18
to django...@googlegroups.com
More like vim and vs code are the best editors

Joel

unread,
Sep 3, 2018, 1:09:10 AM9/3/18
to django...@googlegroups.com
One can carry on discussion about something as subjective as "best text editor" for days and still not be done. IMO, this is a silly question to be asking in a django group.

Gerald Brown

unread,
Sep 3, 2018, 10:27:02 AM9/3/18
to django...@googlegroups.com

The best editor is the ONE that works BEST for YOU!!! Try several and then pick the one that YOU like the best.  Everyone has their personal favorites!!!

ireoluwa fakeye

unread,
Sep 3, 2018, 10:29:26 AM9/3/18
to django...@googlegroups.com
Vs code

PASCUAL Eric

unread,
Sep 3, 2018, 11:12:19 AM9/3/18
to django...@googlegroups.com

As already requested earlier by other posters, please STOP this totally useless and sterile discussion.


As Gerald Brown wrote, the best editor is the one you feel the most productive and comfortable with. Full stop. Everybody has his own background, habits and tastes, hence there is nothing such as a "best editor".


My "best editor" is Vim. It's unlikely that this is the choice for the majority of people here. QED.


From: django...@googlegroups.com <django...@googlegroups.com> on behalf of ireoluwa fakeye <fak...@gmail.com>
Sent: Monday, September 3, 2018 12:28:42 PM
To: django...@googlegroups.com
Subject: Re: text editor
 
Reply all
Reply to author
Forward
0 new messages