通常,当单击锚标记时,它会重定向到"href"属性中给出的某个URL.这里是否有任何可能的确认.当我们点击锚标签时,它会显示确认"你确定要继续",如果我们点击"是"它会重定向到"href"里面给出的那个网址.如果我们点击"否",它将保留在同一页面中.请分享您的想法.
我想从django管理面板向用户发送电子邮件,并将发送的邮件存储在数据库中.我有两种类型:1.Staff 2.学生.当我选择员工并发送电子邮件时,它会向所有在用户模型中都有" usertype = staff " 的员工发送电子邮件,反之亦然.我发现从管理面板发送邮件有些困难.请有人给我一个想法.
models.py
username = models.CharField()
first_name = models.CharField()
last_name = models.CharField()
email = models.EmailField()
password = models.CharField()
companyname=models.CharField()
usertype=models.CharField()
is_staff = models.BooleanField()
is_active = models.BooleanField()
is_superuser = models.BooleanField()
last_login = models.DateTimeField()
date_joined = models.DateTimeField()
groups = models.ManyToManyField()
user_permissions = models.ManyToManyField()
class newsletter(models.Model):
USERTYPES = (
('staff', 'staff'),
('student', 'student'),
)
usertype=models.CharField(max_length=50,choices=USERTYPES)
subject=models.CharField(max_length=100)
message=models.TextField(blank=True)
sentdate=models.DateTimeField(auto_now = True)
Run Code Online (Sandbox Code Playgroud)
admin.py
admin.site.register(newsletter)
Run Code Online (Sandbox Code Playgroud) 我想过滤列表而不区分大小写.我想只匹配不匹配大写或小写的字符.
如果我在搜索框中输入"X",它会同时显示1和3.我添加了下面的代码,但它也区分大小写.
<!DOCTYPE html>
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js">
</script>
<script>
function filter(element) {
var value = $(element).val();
$("#theList > li").each(function() {
if ($(this).text().search(value) > -1) {
$(this).show();
}
else {
$(this).hide();
}
});
}
</script>
</head>
<body>
<input type="text" onkeyup="filter(this)" />
<ul id="theList">
<li>xxvxvxx</li>
<li>yyyyyyyyyy</li>
<li>rrrrrrrrrr</li>
<li>vvvvvvvvvvv</li>
<li>xcvcvdfsdf</li>
<li>hkjhkhjkh</li>
<li>xzfgfhfgh</li>
</ul>
</body>
</html>
Run Code Online (Sandbox Code Playgroud) 我已经了解了django信号但是,我不知道在我的项目中实现的位置以及如何在我的项目中使用它.在我的项目中,我想发送电子邮件警报,如果它符合某些特定标准.在这种情况下,我需要使用post_save信号.我添加了代码.请分享您的想法.
models.py
class Personal(models.Model):
user = models.OneToOneField(User)
email = models.EmailField(max_length=100, blank=True, null=True)
country = models.CharField(max_length=100, blank=True, null=True)
state = models.CharField(max_length=100, blank=True, null=True)
city = models.CharField(max_length=100, blank=True, null=True)
class Skills(models.Model):
user = models.ForeignKey(User)
skill = models.CharField(max_length=100, blank=True, null=True)
class jobs(models.Model):
emp = models.ForeignKey(User, unique=False)
title = models.CharField(max_length=100)
industry = models.CharField(max_length=100)
functionalarea = models.CharField(max_length=100)
min_exp = models.IntegerField(default=0)
max_exp = models.IntegerField(default=0)
city = models.CharField(max_length=100)
state = models.CharField(max_length=100)
country = models.CharField(max_length=100)
empskills = models.CharField(max_length=100, blank=True, null=True)
Run Code Online (Sandbox Code Playgroud)
在这里,我希望将jobs和empills.skill模型匹配city和empskills of jobs表.如果每个作业都匹配任何一个字段,它将自动发送邮件到personal.email,则会发生此事件.请举例说明信号的使用位置和使用方法.
在Git中合并python文件时会发生错误.请分享您的想法.如何删除所有pyc文件并合并内容.从存储库中提取更新时会发生此错误.那些pyc文件经常更新.当我从存储库中提取更新时,每次都会发生错误
error: The following untracked working tree files would be overwritten by merge:
addressbook/views.pyc
allauth/account/admin.pyc
allauth/account/auth_backends.pyc
allauth/account/context_processors.pyc
allauth/account/forms.pyc
allauth/account/management/__init__.pyc
allauth/account/urls.pyc
allauth/account/views.pyc
allauth/exceptions.pyc
allauth/socialaccount/adapter.pyc
allauth/socialaccount/admin.pyc
allauth/socialaccount/app_settings.pyc
allauth/socialaccount/context_processors.pyc
allauth/socialaccount/forms.pyc
allauth/socialaccount/helpers.pyc
allauth/socialaccount/providers/base.pyc
allauth/socialaccount/providers/facebook/forms.pyc
allauth/socialaccount/providers/facebook/locale.pyc
allauth/socialaccount/providers/facebook/provider.pyc
allauth/socialaccount/providers/facebook/urls.pyc
allauth/socialaccount/providers/facebook/views.pyc
allauth/socialaccount/providers/google/provider.pyc
allauth/socialaccount/providers/google/urls.pyc
allauth/socialaccount/providers/google/views.pyc
allauth/socialaccount/providers/linkedin/provider.pyc
allauth/socialaccount/providers/linkedin/urls.pyc
allauth/socialaccount/providers/linkedin/views.pyc
allauth/socialaccount/providers/oauth/__init__.pyc
allauth/socialaccount/providers/oauth/client.pyc
allauth/socialaccount/providers/oauth/provider.pyc
allauth/socialaccount/providers/oauth/urls.pyc
allauth/socialaccount/providers/oauth/views.pyc
allauth/socialaccount/providers/oauth2/__init__.pyc
allauth/socialaccount/providers/oauth2/client.pyc
allauth/socialaccount/providers/oauth2/provider.pyc
allauth/socialaccount/providers/oauth2/urls.pyc
allauth/socialaccount/providers/oauth2/views.pyc
allauth/socialaccount/providers/twitter/provider.pyc
allauth/socialaccount/providers/twitter/urls.pyc
allauth/socialaccount/providers/twitter/views.pyc
allauth/socialaccount/signals.pyc
allauth/socialaccount/urls.pyc
allauth/socialaccount/views.pyc
allauth/urls.pyc
crispy_forms/base.pyc
crispy_forms/bootstrap.pyc
crispy_forms/exceptions.pyc
crispy_forms/helper.pyc
crispy_forms/layout.pyc
crispy_forms/layout_slice.pyc
crispy_forms/utils.pyc
feeds/views.pyc
lettertemplate/forms.pyc
lettertemplate/views.pyc
quorum/forms.pyc
quorum/views.pyc
registration/admin.pyc
registration/forms.pyc
registration/models.pyc
registration/urls.pyc
registration/views.pyc
rosetta/polib.pyc
rosetta/poutil.pyc
rosetta/signals.pyc
rosetta/storage.pyc
rosetta/urls.pyc
rosetta/views.pyc …Run Code Online (Sandbox Code Playgroud)