DateTimeField
在ModelForm
s中使用时,它们看起来像文本字段.我怎样才能让他们看起来像在管理员?(当我转到管理员并添加一个节目时,我将字段视为日期字段)
# models.py
class Show(models.Model):
...
start_time = models.DateTimeField("Event Time")
sale_end_time = models.DateTimeField("Sale End Time")
class ShowForm(ModelForm):
class Meta:
model = Show
# views.py
def createshow(request):
if request.method == 'POST':
form = ShowForm(request.POST)
if form.is_valid():
form.save()
return HttpResponseRedirect('/showsaved')
else:
form = ShowForm()
return render(request, 'BizCreateShow.html', {'ShowForm' : form})
Run Code Online (Sandbox Code Playgroud)
在模板中:
<form class="form-horizontal well" action="" method="post">
{% csrf_token %}
{{ ShowForm }} </br>
<input type="submit" value="Submit">
</form>
Run Code Online (Sandbox Code Playgroud) 我试图在Aptana内部推进,但我得到以下错误.我已成功拉,但无法弄清楚为什么我的推动不起作用.
/home/jeni/apps/Aptana_Studio_3/plugins/com.aptana.git.core_3.0.0.1350339960/os/linux/askpass. tcl: 3: exec: wish: not found
error: unable to read askpass response from '/home/jeni/apps/Aptana_Studio_3/plugins/com.aptana.git.core_3.0.0.1350339960/os/linux/askpass.tcl'
fatal: could not read Username for 'https://github.com': No such device or address
Run Code Online (Sandbox Code Playgroud) 我正在尝试从管理员中删除用户并收到此错误:
DatabaseError at /admin/users/neverlateuser/
relation "django_comments" does not exist
LINE 1: ..._admin", "users_neverlateuser"."date_joined" FROM "django_co...
Run Code Online (Sandbox Code Playgroud)
但我没有安装评论,我没有django.contrib.comments
.我只在实时服务器上收到此错误,但在本地主机上没有 - 我可以删除没有问题的用户.问题出在哪儿?
我有一个我要翻译的表单:
Models.py:
class Show(models.Model):
discount_tickets = models.IntegerField("Discount Tickets")
regular_tickets = models.IntegerField("Regular Tickets")
afillate_price = models.IntegerField("Afillate Price")
user_price = models.IntegerField("User Price")
start_time = models.CharField("Event Time", max_length=20)
sale_end_time = models.CharField("Sale End Time", max_length=20)
def __unicode__(self):
return unicode(self.discount_tickets)
class ShowForm(ModelForm):
pass
class Meta:
model = Show
Run Code Online (Sandbox Code Playgroud)
我该如何翻译字段名称?
django translation django-models internationalization django-forms
我有这个编辑按钮:
<%= link_to edit_income_path(trans), class: "btn btn-default" do %>
<i class="glyphicon glyphicon-pencil"></i>
<% end %>
Run Code Online (Sandbox Code Playgroud)
我想要一个删除按钮看起来与此图标相同:glyphicon glyphicon-trash,但我找不到合适的语法使其工作和看起来一样.我的删除按钮现在:
<%= button_to "delete", trans, :method=> :delete, :remote=> true %>
Run Code Online (Sandbox Code Playgroud)
django ×3
django-forms ×2
aptana ×1
css ×1
datetime ×1
django-users ×1
git ×1
github ×1
ruby ×1
translation ×1