structured menu cannot be rendered in html template, why?
i would like to make a structure database for a restaurant menu without using mptt or django-tree. here is my *models.py:* > from django.db import models > > class Menu(models.Model): > > name = models.CharField(max_length=24, unique=True, verbose_name='menu >> name') > > #slug = models.SlugField(max_length=24, unique=True, help_text='The slug >> is the URL friendly version of the menu name, so that this can be accessed >> at a URL like mysite.com/menus/dinner/.') > > additional_text = models.CharField(max_length=128, null=True, blank=True, >> help_text='Any additional text that the menu might need, i.e. Served >> between 11:00am and 4:00pm.') > > order = models.PositiveSmallIntegerField(default=0, help_text='The order >> of the menu determines where this menu appears alongside other menus.') > > class Meta: > > ordering = ['name', 'order'] > > >> class MenuCategory(models.Model): >> > menu = models.ForeignKey(Menu, on_delete=models.CASCADE,help_text='The >> menus that this category belongs to, i.e. \'Lunch\'.') > > name = models.CharField(max_length=32, verbose_name='menu category name') > > additional_text = models.CharField(max_length=128, null=True, blank=True, >> help_text='The additional text is any bit of related information to go >> along with a menu category, i.e. the \'Pasta\' category might have details >> that say \'All entrees come with salad and bread\'.') > > order = models.IntegerField(default=0, help_text='The order is the order >> that this category should appear in when rendered on the templates.') > > class Meta: > > verbose_name='menu category' > > verbose_name_plural='menu categories' > > ordering = ['order', 'name'] > > def __unicode__(self): > > return self.name > > >> class MenuItem(models.Model): >> > CLASSIFICATION_CHOICES = ( > > ('neither', 'Neither'), > > ('vegan', 'Vegan'), > > ('vegetarian', 'Vegetarian'), > > ) > > name = models.CharField(max_length=48, help_text='Name of the item on the >> menu.') > > description = models.CharField(max_length=128, null=True, blank=True, >> help_text='The description is a simple text description of the menu item.') > > category = models.ManyToManyField(MenuCategory, verbose_name='menu >> category', help_text='Category is the menu category that this menu item >> belongs to, i.e. \'Appetizers\'.') > > order = models.IntegerField(default=0, verbose_name='order', >> help_text='The order is to specify the order in which items show up on the >> menu.') > > price = models.IntegerField(help_text='The price is the cost of the item.') > > image = models.ImageField(upload_to='menu', null=True, blank=True, >> verbose_name='image', help_text='The image is an optional field that is >> associated with each menu item.') > > classification = models.CharField(max_length=10, >> choices=CLASSIFICATION_CHOICES, default=0, verbose_name='classification', >> help_text='Select if this item classifies as Vegetarian, Vegan, or >> Neither.') > > spicy = models.BooleanField(default=False, verbose_name='spicy?', >> help_text='Is this item spicy?') > > contains_peanuts = models.BooleanField(default=True, verbose_name='contain >> peanuts?', help_text='Does this item contain peanuts?') > > gluten_free = models.BooleanField(default=False, verbose_name='gluten >> free?', help_text='Is this item Gluten Free?') > > class Meta: > > verbose_name='menu item' > > verbose_name_plural='menu items' > > ordering = ['classification', 'order', 'name'] > > >> def __unicode__(self): > > return self.name > > >> *views.py:* from .models import Menu,MenuCategory from django.views.generic import ListView class MenuView(ListView): > model= Menu > conext_object_name='name' > template_name = 'menu_list.html' > queryset = Menu.objects.all() > def get_context_data(self, **kwargs): > context = super(MenuView, self).get_context_data(**kwargs) > context['Menucategory'] = MenuCategory.objects.all() > context['Menus'] = self.queryset > return context *menu_list.html:* > > > {%for item in Menu%} > > {{item.menu}} > {{item.name}} > {{item.additiona_text}} > {{item.order}} > > {%endfor%} > {%for item in MenuCategory%} > > {{item.name}} > {{item.additiona_text}} > {{item.order}} > > {%endfor%} > > > when i browse my localhost page after excuting runserver, it shows only Django blog Breakfast 1 Lunch 2 Dinner 3 but my desired output should be: *Breakfast* coffee Items 1 2 3 Snacks Items 1 2 3 *Lunch* Starter items 1 2 3 Main Courses Items 1 2 3 how can i get this structured table using plain bootstrap table row column where in every row column i will query the items with for loop? is their any other way? -- 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
Re: ckeditor toolbar is not showing in html new post page.. why home.html (for adding a new post) is not showing the rendered django form for add new post?
thanx for your advice and i removed {% csrf_token %} and still same. problem is not solved. add post form is not showing. On Thursday, December 12, 2019 at 3:24:48 PM UTC, Integr@te System wrote: > > Hi, > > Django view dont render csrf tag within template form, you should check > doc in warning part > https://docs.djangoproject.com/en/3.0/ref/csrf/ > > And look at the additional way to resolve your problem. > > On Thu, Dec 12, 2019, 16:45 হজমুলা খান > > wrote: > >> i am integrating some apps to make a bigger project but the problem is >> when i try insert ckeditor in html login page it is not showing. for this >> reason i tried to make separate app is to see whats going on here. i am >> showing you the code in detail. >> editing/settings.py: >> >> >> .. >> INSTALLED_APPS = [ >> 'django.contrib.admin', >> 'django.contrib.auth', >> 'django.contrib.contenttypes', >> 'django.contrib.sessions', >> 'django.contrib.messages', >> 'django.contrib.staticfiles', >> 'editor', >> 'ckeditor_uploader', >> 'ckeditor', >> ] >> TEMPLATES = [ >> { >> >> 'DIRS': [os.path.join(BASE_DIR,'templates')], >> . >> STATIC_URL = 'editor/static/' >> STATIC_ROOT='editor/static/' >> CKEDITOR_UPLOAD_PATH='editor/static/media/' >> >> editing/urls.py: >> >> from django.contrib import admin >> from django.urls import path, include >> from django.conf import settings >> from django.conf.urls.static import static >> >> urlpatterns = [ >> path('admin/', admin.site.urls), >> path('',include('editor.urls')), >> path('ckeditor/',include('ckeditor_uploader.urls')), >> ] + static(settings.STATIC_URL, document_root=settings.STATIC_ROOT) >> >> in this case, my static folder is in editor/static when i execute python >> manage.py collectstatic and ckeditor folder is in editor/static directory >> also. >> >> editor/models.py: >> >> from django.db import models >> from ckeditor_uploader.fields import RichTextUploadingField >> >> # Create your models here. >> >> class Post(models.Model): >> title=models.CharField(max_length=255) >> body=models.CharField(max_length=2000) >> description=RichTextUploadingField() >> >> def __str__(self): >> return self.title >> >> editor/admin.py: >> >> from django.contrib import admin >> from .models import Post >> >> admin.site.register(Post) >> >> when i execute python manage.py makemigrations and python manage.py >> migrate, ckeditor can be seen in locahost:8000/admin's new post section >> perfectly. then i tried to make templates. >> >> base.html: >> {% load static %} >> >> >> Django blog >> https://fonts.googleapis.com/css?family=Source+Sans+Pro:400; >> rel="stylesheet"> >> >> >> >> >> >> >> Django blog >> >> >> {% block content %} >> {% endblock content %} >> >> >> >> >> home.html: >> {% extends 'base.html' %} >> {% block content %} >> New post >> >> >> {% csrf_token %} >> {{ form.media|safe }} >> {{ form.as_p }} >> >> >> {% endblock content %} >> >> and then i have created a html file editor/urls.py: >> from django.urls import path >> >> from .views import HomePageView >> >> urlpatterns=[ >> path('',HomePageView.as_view(), name='home'), >> ] >> >> and here is the editor/views.py also: >> from django.views.generic import TemplateView >> from .models import Post >> >> >> class HomePageView(TemplateView): >> model=Post >> template_name='home.html' >> fields=['title','body'] >> >> i just want to see a simple page of showing new html post editor with >> ckeditor toolbar in it. it's just for seeing what's wrong and why my >> ckeditor toolbar is not showing in my html file. when i run python >> manage.py runserver there is no error showing and the html page is showing >> django post and new post and only the save button. it can't render the form >> of the django's new post. css style is rendered because the django post and >> new post has the desired color and font. but why it is not rendering the >> new post form with ckeditor toolbar? >> >> i am still learning and t
Re: Nepal Government: Boycott Nepal until Gadhimai animal sacrifice ends!
my friend this festival has been banned four years ago. and what is this post doing in django group? what it has to do with django? On Wednesday, December 11, 2019 at 2:05:28 PM UTC, pema...@gmail.com wrote: > > Hallo, > > ich habe gerade die Petition „Nepal Government: Boycott Nepal until > Gadhimai animal sacrifice ends!" unterschrieben und wollte dich fragen, ob > du auch mitmachst. > > Unser Ziel ist es, 5.000 Unterschriften zu sammeln und dafür brauchen wir > Unterstützung. Hier kannst du mehr über die Petition erfahren: > > http://chng.it/BPPFcy8MxP > > Vielen Dank! > Pema -- 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/ab065528-82c2-4533-9a38-12cc2d2b2d7c%40googlegroups.com.
ckeditor toolbar is not showing in html new post page.. why home.html (for adding a new post) is not showing the rendered django form for add new post?
i am integrating some apps to make a bigger project but the problem is when i try insert ckeditor in html login page it is not showing. for this reason i tried to make separate app is to see whats going on here. i am showing you the code in detail. editing/settings.py: .. INSTALLED_APPS = [ 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'editor', 'ckeditor_uploader', 'ckeditor', ] TEMPLATES = [ { 'DIRS': [os.path.join(BASE_DIR,'templates')], . STATIC_URL = 'editor/static/' STATIC_ROOT='editor/static/' CKEDITOR_UPLOAD_PATH='editor/static/media/' editing/urls.py: from django.contrib import admin from django.urls import path, include from django.conf import settings from django.conf.urls.static import static urlpatterns = [ path('admin/', admin.site.urls), path('',include('editor.urls')), path('ckeditor/',include('ckeditor_uploader.urls')), ] + static(settings.STATIC_URL, document_root=settings.STATIC_ROOT) in this case, my static folder is in editor/static when i execute python manage.py collectstatic and ckeditor folder is in editor/static directory also. editor/models.py: from django.db import models from ckeditor_uploader.fields import RichTextUploadingField # Create your models here. class Post(models.Model): title=models.CharField(max_length=255) body=models.CharField(max_length=2000) description=RichTextUploadingField() def __str__(self): return self.title editor/admin.py: from django.contrib import admin from .models import Post admin.site.register(Post) when i execute python manage.py makemigrations and python manage.py migrate, ckeditor can be seen in locahost:8000/admin's new post section perfectly. then i tried to make templates. base.html: {% load static %} Django blog https://fonts.googleapis.com/css?family=Source+Sans+Pro:400; rel="stylesheet"> Django blog {% block content %} {% endblock content %} home.html: {% extends 'base.html' %} {% block content %} New post {% csrf_token %} {{ form.media|safe }} {{ form.as_p }} {% endblock content %} and then i have created a html file editor/urls.py: from django.urls import path from .views import HomePageView urlpatterns=[ path('',HomePageView.as_view(), name='home'), ] and here is the editor/views.py also: from django.views.generic import TemplateView from .models import Post class HomePageView(TemplateView): model=Post template_name='home.html' fields=['title','body'] i just want to see a simple page of showing new html post editor with ckeditor toolbar in it. it's just for seeing what's wrong and why my ckeditor toolbar is not showing in my html file. when i run python manage.py runserver there is no error showing and the html page is showing django post and new post and only the save button. it can't render the form of the django's new post. css style is rendered because the django post and new post has the desired color and font. but why it is not rendering the new post form with ckeditor toolbar? i am still learning and this problem is eating me up. thanx in advance -- 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/b8c48a91-b67c-4da0-8ce3-b301798a3851%40googlegroups.com.
Integration of Django-cms site with django blog
Hi Recently I have made a website with django-cms and another blog site with django. Now I want to integrate Django blog site with one of the pages of Django-cms’s site. Should I use aaphook or djangocms-blog? I am a new learner of Django. I am little bit confused on which way I should go... Does any one have any good materials to understand those?? -- 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/b1b6bc29-1e7f-413c-8d34-b37cec21a393%40googlegroups.com.
Re: bootstrap4 panel as card plugin is not working in djangocms
hi everyone sorry for the post as i have solved it by myself rght now using text plugin. i am sharing the code, if any one needs: Card title Card subtitle Some quick example text to build on the card title and make up the bulk of the card's content. actually i copied it from bootstrap4 website and it worked. now i need to tune it. besides before doing that i have selected the column size according to the screen requirement. thanks :) On Wednesday, November 20, 2019 at 2:16:04 PM UTC, হজমুলা খান wrote: > > hi > > i am working on a project of bootstrap4 website where i require to make > panels in 3 columns. i am using djangocms (the latest version). but there > is no panel under any column. so i tried with card but this plugin has no > title and text option. what should i do? > -- 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/cc1431c3-357e-4123-9cb8-2aae51f1864f%40googlegroups.com.
bootstrap4 panel as card plugin is not working in djangocms
hi i am working on a project of bootstrap4 website where i require to make panels in 3 columns. i am using djangocms (the latest version). but there is no panel under any column. so i tried with card but this plugin has no title and text option. what should i do? -- 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/438df501-816e-4783-aa75-b8ba260935dc%40googlegroups.com.
Re: html home file is not opening while running under django env......
ofcourse yes otherwise it will show error On Friday, November 1, 2019 at 4:24:49 AM UTC, Bruckner de Villiers wrote: > > Did you import include? > > Bruckner > 0836251086 > > On 01 Nov 2019, at 00:29, হজমুলা খান > > wrote: > > > > > On Thursday, October 31, 2019 at 12:22:48 PM UTC, Kasper Laudrup wrote: >> >> Hi হজমুলা খান, >> >> On 31/10/2019 11.22, হজমুলা খান wrote: >> > i am novice and following django for beginners ebook. while i am >> running >> > the program base.html and about.html are working properly but when i >> > click on the home link, it shows: >> > >> > >> > Page not found (404) >> > >> > Request Method:GET >> > Request URL:http://localhost:8000/home >> > >> > Using the URLconf defined in |pages_project.urls|, Django tried these >> > URL patterns, in this order: >> > >> > 1. admin/ >> > 2. [name='home'] >> > 3. about/ [name='about'] >> > >> > The current path, |home|, didn't match any of these. >> > >> > >> > i have installed Jinja2 and if i open base.html without running django >> > server, it works well but under django server it's not working. what >> > should i do? >> > >> >> You need to add 'home' to your urls.py inside your pages_project >> directory. Read more here: >> >> https://docs.djangoproject.com/en/2.2/topics/http/urls/ >> >> Kind regards, >> >> Kasper Laudrup >> > > > thanx for your reply. i have edited pages_project/urls.py as follows: > urlpatterns = [ path('admin/', admin.site.urls), path('home/', > include('pages.urls')), in this case home page is working but base.html and > about.html is not showing . if i add path('about/', include('pages.urls')), > then both home.html and about.html is showing but the url becomes > localhost:8000/home/about. localhost:8000/about is not working. i put > home.html in new folder pages and the order your talked about but they have > no effect because i kept the files in both sides. plz share any new idea > > -- > 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...@googlegroups.com . > To view this discussion on the web visit > https://groups.google.com/d/msgid/django-users/83c8c6ed-0a81-47a3-9e51-bdf8458fb2bb%40googlegroups.com > > <https://groups.google.com/d/msgid/django-users/83c8c6ed-0a81-47a3-9e51-bdf8458fb2bb%40googlegroups.com?utm_medium=email_source=footer> > . > > -- 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/d98395a1-a31f-4186-8833-c02b3881314a%40googlegroups.com.
Re: html home file is not opening while running under django env......
On Thursday, October 31, 2019 at 12:22:48 PM UTC, Kasper Laudrup wrote: > > Hi হজমুলা খান, > > On 31/10/2019 11.22, হজমুলা খান wrote: > > i am novice and following django for beginners ebook. while i am running > > the program base.html and about.html are working properly but when i > > click on the home link, it shows: > > > > > > Page not found (404) > > > > Request Method:GET > > Request URL:http://localhost:8000/home > > > > Using the URLconf defined in |pages_project.urls|, Django tried these > > URL patterns, in this order: > > > > 1. admin/ > > 2. [name='home'] > > 3. about/ [name='about'] > > > > The current path, |home|, didn't match any of these. > > > > > > i have installed Jinja2 and if i open base.html without running django > > server, it works well but under django server it's not working. what > > should i do? > > > > You need to add 'home' to your urls.py inside your pages_project > directory. Read more here: > > https://docs.djangoproject.com/en/2.2/topics/http/urls/ > > Kind regards, > > Kasper Laudrup > thanx for your reply. i have edited pages_project/urls.py as follows: urlpatterns = [ path('admin/', admin.site.urls), path('home/', include('pages.urls')), in this case home page is working but base.html and about.html is not showing . if i add path('about/', include('pages.urls')), then both home.html and about.html is showing but the url becomes localhost:8000/home/about. localhost:8000/about is not working. i put home.html in new folder pages and the order your talked about but they have no effect because i kept the files in both sides. plz share any new idea -- 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/83c8c6ed-0a81-47a3-9e51-bdf8458fb2bb%40googlegroups.com.
html home file is not opening while running under django env......
i am novice and following django for beginners ebook. while i am running the program base.html and about.html are working properly but when i click on the home link, it shows: Page not found (404) Request Method: GET Request URL: http://localhost:8000/home Using the URLconf defined in pages_project.urls, Django tried these URL patterns, in this order: 1. admin/ 2. [name='home'] 3. about/ [name='about'] The current path, home, didn't match any of these. i have installed Jinja2 and if i open base.html without running django server, it works well but under django server it's not working. what should i do? -- 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/7dc5463a-97d4-4e6b-9d39-2579f1f43962%40googlegroups.com.