django-templates

Django DateInput() Widget appears in Chrome, but not Firefox or IE

蓝咒 提交于 2021-02-07 10:34:32
问题 Issue I have a DateInput() widget that appears fine in Chrome, but does not appear in Firefox or IE. I'm using Django 1.6.5 and the latest Chrome (Version 35.0.1916.153) and FireFox(30.0) Works Correctly in Chrome (Calendar Selector appears) Does not work correctly in Firefox or IE (Calendar Selector doesn't appear) forms.py class DateInput(forms.DateInput): input_type = 'date' class TimeForm(forms.ModelForm): class Meta: model = Time fields = ['date_select'] widgets = { 'date_select':

Django DateInput() Widget appears in Chrome, but not Firefox or IE

余生长醉 提交于 2021-02-07 10:34:02
问题 Issue I have a DateInput() widget that appears fine in Chrome, but does not appear in Firefox or IE. I'm using Django 1.6.5 and the latest Chrome (Version 35.0.1916.153) and FireFox(30.0) Works Correctly in Chrome (Calendar Selector appears) Does not work correctly in Firefox or IE (Calendar Selector doesn't appear) forms.py class DateInput(forms.DateInput): input_type = 'date' class TimeForm(forms.ModelForm): class Meta: model = Time fields = ['date_select'] widgets = { 'date_select':

How should I show results of BeautifulSoup parsing in Django?

倖福魔咒の 提交于 2021-02-07 10:17:29
问题 I'm trying to scrape a web page using BeautifulSoup and Django. Here's my views.py which do this task: def detail(request, article_id): article = get_object_or_404(Article, pk=article_id) html = urllib2.urlopen("...url...") soup = BeautifulSoup(html) title = soup.title return render(request, 'detail.html', {'article': article, 'title':title}) But when I use {{ title }} in django template files, it doesn't show anything. I've test it and it works in shell. I've added a line to this function:

How should I show results of BeautifulSoup parsing in Django?

一曲冷凌霜 提交于 2021-02-07 10:16:33
问题 I'm trying to scrape a web page using BeautifulSoup and Django. Here's my views.py which do this task: def detail(request, article_id): article = get_object_or_404(Article, pk=article_id) html = urllib2.urlopen("...url...") soup = BeautifulSoup(html) title = soup.title return render(request, 'detail.html', {'article': article, 'title':title}) But when I use {{ title }} in django template files, it doesn't show anything. I've test it and it works in shell. I've added a line to this function:

{% url %} and jquery

房东的猫 提交于 2021-02-07 10:00:13
问题 My views will give a dictionary of "build_id", and there is another view responbile generating the details of a given build_id. I.e., the second view "build_details" takes in a parameter "build_id". Because I have at least one ids from the dictionary, I am going to generate a table. <table> <tr> <td> Number </td> <td> Actions </td> </tr> {% for index, value in build_history.items %} <tr> <td> {{index}} </td> <td> <select id="action_menu"> <option value=''>-----</option> <option value="build_{

{% url %} and jquery

醉酒当歌 提交于 2021-02-07 09:59:17
问题 My views will give a dictionary of "build_id", and there is another view responbile generating the details of a given build_id. I.e., the second view "build_details" takes in a parameter "build_id". Because I have at least one ids from the dictionary, I am going to generate a table. <table> <tr> <td> Number </td> <td> Actions </td> </tr> {% for index, value in build_history.items %} <tr> <td> {{index}} </td> <td> <select id="action_menu"> <option value=''>-----</option> <option value="build_{

custom template loader Django

百般思念 提交于 2021-02-07 09:52:29
问题 i am trying to write a custom template loader in django which serves index.html which is present in a s3 bucket. Following is my loader file from django.conf import settings from django.template import Origin, Engine from django.template.loader import TemplateDoesNotExist from django.template.loaders.base import Loader from boto3.session import Session ACCESS_KEY_NAME = getattr(settings, 'AWS_TEMPLATE_LOADING_ACCESS_KEY_ID', getattr(settings, 'AWS_TEMPLATE_LOADING_ACCESS_KEY_ID', None))

custom template loader Django

久未见 提交于 2021-02-07 09:51:03
问题 i am trying to write a custom template loader in django which serves index.html which is present in a s3 bucket. Following is my loader file from django.conf import settings from django.template import Origin, Engine from django.template.loader import TemplateDoesNotExist from django.template.loaders.base import Loader from boto3.session import Session ACCESS_KEY_NAME = getattr(settings, 'AWS_TEMPLATE_LOADING_ACCESS_KEY_ID', getattr(settings, 'AWS_TEMPLATE_LOADING_ACCESS_KEY_ID', None))

Render Django template from command line, without settings

白昼怎懂夜的黑 提交于 2021-02-07 08:56:05
问题 Is there a way to render a Django template from command line without invoking any settings? I want to do this outside any Django apps or project, to be able to use it as a command line tool to render a template with some variables. Is there a tool that does this already? Jinja2 would be fine too. 回答1: You can use settings.configure() if you don't have any custom settings to configure. from django.conf import settings settings.configure() from django.template import Template, Context Template(

Render Django template from command line, without settings

北慕城南 提交于 2021-02-07 08:54:36
问题 Is there a way to render a Django template from command line without invoking any settings? I want to do this outside any Django apps or project, to be able to use it as a command line tool to render a template with some variables. Is there a tool that does this already? Jinja2 would be fine too. 回答1: You can use settings.configure() if you don't have any custom settings to configure. from django.conf import settings settings.configure() from django.template import Template, Context Template(