Я не знаю их архитектуру и название таблиц заранее
<Window
x:Class="Monitor.SomeWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:Monitor"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
Title="SomeWindow"
Width="800"
Height="450"
mc:Ignorable="d">
<Window.Resources>
<Style
x:Key="BaseFontFamily"
TargetType="TextBlock">
<Setter Property="FontSize" Value="90" />
</Style>
<Style
x:Key="Numbers1Style"
BasedOn="{StaticResource BaseFontFamily}"
TargetType="TextBlock">
<Setter Property="Foreground" Value="LightCoral" />
</Style>
<Style
x:Key="Numbers2Style"
BasedOn="{StaticResource BaseFontFamily}"
TargetType="TextBlock">
<Setter Property="Foreground" Value="Bisque" />
</Style>
</Window.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<TextBlock
Grid.Row="0"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Style="{Binding TimeBlockStyle, RelativeSource={RelativeSource AncestorType=local:SomeWindow}}"
Text="{Binding Path=RightTeam.TeamCounter, Mode=OneWay, UpdateSourceTrigger=PropertyChanged}" />
<Button
Grid.Row="1"
Click="OnButtonClick" />
</Grid>
</Window>
public partial class SomeWindow : Window
{
public static readonly DependencyProperty TimeBlockStyleProperty = DependencyProperty.Register(
nameof(TimeBlockStyle), typeof(Style), typeof(SomeWindow), new PropertyMetadata(default(Style)));
public Style TimeBlockStyle
{
get { return (Style)GetValue(TimeBlockStyleProperty); }
set { SetValue(TimeBlockStyleProperty, value); }
}
public SomeWindow()
{
InitializeComponent();
TimeBlockStyle = (Style)Resources["Numbers1Style"];
}
private void OnButtonClick(object sender, RoutedEventArgs e)
{
TimeBlockStyle = (Style)Resources["Numbers2Style"];
}
}
.Where(l => l.Content.Contains("EtalonName"));
def get_queryset(self):
if not self.request.GET:
return Posts.objects.all()#если нет параметров, просто возвращаем все посты
keyword = self.request.GET.get('key')#получаем ключевое слово
filters = Q()#создаем первый объект Q, что бы складывать с ним другие
for key in ['author', 'name', 'text']:
value = self.request.GET.get(key)
if value:
filters |= Q(**{f'{key}__icontains': keyword})
return Posts.objects.filter(filters)
def a_change_password(request):
u = User.objects.get(username=request.user)
if request.method == 'POST':
form = ChangePasswordForm(request.POST)
if form.is_valid():
old_password = request.POST.get("old_password")
new_pass = request.POST.get("new_password")
new_pass_rep = request.POST.get("new_password_repeat")
if check_password(old_password,u.password):
return HttpResponse('ok')
else:
return HttpResponse('bad')
else:
form = ChangePasswordForm()
return render(request, 'login/change_password.html',
{'form': form, 'user': u})