我有信号返回NSNumber:
RACSignal *signal = ....
Run Code Online (Sandbox Code Playgroud)
然后在某些代码处我希望在执行时得到信号的值,例如:
NSNumber *value = [code that extracts current value of signal];
Run Code Online (Sandbox Code Playgroud) 从我的模板:
<a href="{% url 'tracker:othermonth' year next_month %}">July</a>
Run Code Online (Sandbox Code Playgroud)
网址格式:
url(r'^ocal/$', views.calendar, name = "othermonth"),
Run Code Online (Sandbox Code Playgroud)
视图:
def calendar(request, year, month):
my_year = int(year)
my_month = int(month)
my_calendar_from_month = datetime(my_year, my_month, 1)
my_calendar_to_month = datetime(my_year, my_month, monthrange(my_year, my_month)[1])
my_tickets = Event.objects.filter(on_sale__gte=my_calendar_from_month).filter(on_sale__lte=my_calendar_to_month)
my_previous_year = my_year
my_previous_month = my_month - 1
if my_previous_month == 0:
my_previous_year = my_year - 1
my_previous_month = 12
my_next_year = my_year
my_next_month = my_month + 1
if my_next_month == 13:
my_next_year = my_year + 1
my_next_month = 1
my_year_after_this …Run Code Online (Sandbox Code Playgroud) 我的问题很简单.我有这样的模板:
<form enctype="multipart/form-data"
action="{% url offers.views.add_offer %}" method="post">
<input type="file" name="image1" />
<input type="file" name="image2" />
<input type="submit" value="Add" />
</form>
Run Code Online (Sandbox Code Playgroud)
模型看起来像这样:
class Image(models.Model):
image = models.ImageField(upload_to='uploads/images/offers/')
Run Code Online (Sandbox Code Playgroud)
和那样的形式(它使用模型图像):
class ImageForm(ModelForm):
class Meta:
model = Image
Run Code Online (Sandbox Code Playgroud)
并且看起来像那样:
for f in request.FILES:
# imageform:
image = ImageForm(request.POST, f)
image.save()
Run Code Online (Sandbox Code Playgroud)
问题是我无法上传图片.我想在图像模型的两个单独的实例中保存图像.
我有一个错误:
'unicode'对象没有属性'get'
感谢您的帮助和回应.
更新以提供更多信息