$arr_a = array();
$arr_b = array();
for($i=0;$i<5;$i++){
$a = new stdClass();
$b = new stdClass();
$a->term_id = rand(0, 5);
$b->term_id = rand(0, 5);
$arr_a[] = $a;
$arr_b[] = $b;
}
var_dump($arr_a);
var_dump($arr_b);
print "===============\n";
function check($a, $b){
if ($a->term_id === $b->term_id){
return 0;
}
if ($a->term_id > $b->term_id){
return 1;
}
return -1;
}
var_dump(array_uintersect($arr_a, $arr_b, 'check'));
larikov@mb-air:~$ php 1.php
array(5) {
[0]=>
object(stdClass)#1 (1) {
["term_id"]=>
int(2)
}
[1]=>
object(stdClass)#3 (1) {
["term_id"]=>
int(5)
}
[2]=>
object(stdClass)#5 (1) {
["term_id"]=>
int(3)
}
[3]=>
object(stdClass)#7 (1) {
["term_id"]=>
int(0)
}
[4]=>
object(stdClass)#9 (1) {
["term_id"]=>
int(5)
}
}
array(5) {
[0]=>
object(stdClass)#2 (1) {
["term_id"]=>
int(0)
}
[1]=>
object(stdClass)#4 (1) {
["term_id"]=>
int(3)
}
[2]=>
object(stdClass)#6 (1) {
["term_id"]=>
int(0)
}
[3]=>
object(stdClass)#8 (1) {
["term_id"]=>
int(4)
}
[4]=>
object(stdClass)#10 (1) {
["term_id"]=>
int(2)
}
}
===============
array(3) {
[0]=>
object(stdClass)#1 (1) {
["term_id"]=>
int(2)
}
[2]=>
object(stdClass)#5 (1) {
["term_id"]=>
int(3)
}
[3]=>
object(stdClass)#7 (1) {
["term_id"]=>
int(0)
}
}
.i-flashcookie{position:absolute;left:-10000px;top:0}.b-menu__item-content{display:none}.b-menu__item-content_visibility_visible{display:block}.b-menu__title{font-size:100%;margin:0;padding:0}.b-menu__separator{display:block}.b-menu__layout-vert,.b-menu__layout-vert-gap,.b-menu__layout-vert-cell,.b-menu__layout-vert-separator{margin:0;padding:0;list-style:none}.b-menu_layout_vert .b-menu__separator{margin:1em 0 0;border-top:1px dotted #666}.b-menu_layout_vert,.b-menu__layout-vert-cell{line-height:1.35em}.b-menu_preset_vmenu .b-menu__layout-vert-cell,.b-menu_preset_vmenu .b-menu__layout-vert-separator{margin-bottom:.5em}.b-menu_preset_vmenu .b-menu{margin:.5em 0 0 1.5em}.b-menu_preset_vmenu .b-menu__title{margin-bottom:.5em}.b-dropdowna{display:inline}.b-dropdowna__menu .b-menu__layout-vert-separator{font:0/0 a;margin:0 0 4px}
Сделайте, чтобы саблайм сам «все отступы, скобки и прочее» расставил. def register_login_user(request):
template_dict = {
'register_form': PersonRegistration(),
'login_form': LoginRequest(),
}
render(request, 'register_login.html', template_dict)
def register_user(request):
form = PersonRegistration(request.POST)
if form.is_valid():
return HttpResponseRedirect(reverse('url_one'))
def login_user(request):
form = LoginRequest(request.POST)
if form.is_valid():
return HttpResponseRedirect(reverse('url_two'))
url(r'^$', 'views.register_login_user', name='register_login_user')
url(r'^register/$', 'views.register_user', name='register-form'),
url(r'^login/$', 'views.login_user', name='login-form'),