Trying to define a constant with the value of model's class in the settings.py
to provide a dynamically-defined FK for …
app.models.py
class ColorSet(models.Model):
color = models.CharField(max_length=50, verbose_name='Color', default='', blank=True, null=True)
code = models.CharField(max_length=50, verbose_name='Code of color', default='', blank=True, null=True)
class …
My urlpatterns :
urlpatterns = [
re_path(r'^dj-admin/', admin.site.urls),
re_path(r'^admin/', include(wagtailadmin_urls)),
re_path(r'^docs/', include(wagtaildocs_urls)),
i18n_patterns(
path(r'', include(wagtail_urls)),
prefix_default_language = False
)
] …
Viewed 15k times
In the following django model:
class MyModel(models.Model):
published = models.BooleanField(default=False)
pub_date = models.DateTimeField('date published')
I want the pub_date …
Trying to start a webpage using the Django framework.
After creating the project, I tried to start an app that …
After updating a Django 1.7 project to Django 1.8 and now get errors when I run the tests (that are …
In a Django project where I need to create a form for inputs. I tried to import reverse
from django.core.urlresolvers …
Hi everyone,
I have a simple form with checkboxes and a submit button upon clicking, the results show up fine …
Tell me a way..........
I tried this code extend method , some how my code is not working my_array = array('i', [1,2,3,4,5]) my_extnd_array = …
can any one explain details . could you please help me
I want to know what is different between these abstract class and interface...
Answer from anyone will help me a …
Consider two lists like:
L1=[13,12,0,29,5]
L2=[19,23,1,29,10]
Now I want the output as:
L3=[(13,19),(12,23),(0,1),(29,29),(5,10)]
How can I get that........
Please tell a way......
public class Main
{
public static void main(String[] args) {for (int i=0; i<6; i++)
{
for (int j=0; j<i; j++) …
I have a requirement to read the
{{ request.user.username }}
in Javascript to pass the value to Django backend. But …
<span style="background-colour:red; @media (max-width:300px){background-colour:yellow;}"></span>
Is this possible?
Help me out.......
I have the following code:
class ClassA(object):
def __init__(self):
self.var1 = 5
self.var2 = 2
def methodA(self):
self.var1 = self.var1 …
I have a python function that I want to check if a certain field is present in the json that …
l1=[20,30,10.5]
I have the following list I want the output as:
[30,40,20.5]
I want the most efficient way of answer
s = [1,20, 67, 21, 56, 13]
print(*s, sep = '\n')
this is the list I have
I want this …
I have the following code
def fun1(par):
print('Hi this is a function without filling the parameter')
return True
fun1()
And …
def isPrime(x):
if x > 1:
for i in range(2, x):
if x % i == 0:
return False
return …
Suppose there are 7 choices ,e.g 7 days
I want all the name of 7 days in a list
I …
I am facing some challenge to formatting the Float data type in Postgresql DB.
I have order table after I …
I have a list of characters like
a = ['he','ll','o',' ','good','mo','rni','n','g']
I want te final output as
hello goodmorning
could …
I am trying to pass the CHOICE field value in Django Template in a tag, like below,
<a href="{% url …
I require to sftp files from one linux server to another using password authentication. I need to call this script …
How to delete token of the recently logged in user.
#models.py
class MyUserManager(BaseUserManager):
def create_user(self, email, password=None, **extra_fields):
if not …
I have a small Django app with a form, wich saves some data to the DB.
Here's the form:
class …
I am using openpyxl
library to write in existing Excel file in separate cells.
How do I write some text …
I have this function that I want to read a single byte from a large file. The only problem is …
I am new to DRF and I am having trouble with overriding its methods.
I would like to allow a …
I'm succeeded logging in sites using Selenium in Python 3.4 The login process is like below:
browser = webdriver.PhantomJS()
browser.get('url') …
Background:
I'm using py.test together with pytest-selenium, now I would like to take a screenshot of page when assertion fails. …
Using https://github.com/jpwatts/django-positions,
I have a few models that inherit from a parent one, for example:
class ContentItem(models.Model):
class Meta: …
I have admin view with tabular inline:
class AddressInline(admin.TabularInline):
model = Address
can_delete = False
readonly_fields = ['kind']
max_num = …
I'm writing data to a CSV file, then once that's done, I copy the file to another directory.
This is …
is there an older version of pip that doesn't check SSL certificates?
my corporate proxy replaces the cert from pypi …
I'm writing a library in Python which makes calls to a REST API, receives results in JSON, and returns Python …
I have added the logo for my website as a title one.
So I have used link shortcut icon set …
I have two lists
L1=['NAME','AGE','EMAIL','GENDER']
L2=['SOUMYA','22','soumya22@gmail.com','female']
I want the output as :
{'NAME':'SOUMYA','AGE':'22','EMAIL':'soumya22@gmail.com','GENDER':'FEMALE'}
I'm tyring to test the Python Selenium and I have this code:
from selenium import webdriver
url = 'https://www.youtube.com/channel/UC8tgRQ7DOzAbn9L7zDL8mLg/videos'
driver …
I want a function like
d = dict(p1=1, p2=2)
def f2(p1, p2):
print(p1, p2)
f2(d)
which returns output …
I want a code which compares multiple integer values for one value and therefore it returns a list as an output …
[....'1', '2937', '0', '0', 'Sep 10 20:34:44 2020', 'Sep 10 20:35:41 2020', '1', '2978', '0', '0', 'Sep 10 20:34:44 2020', …
I check my code using mypy
. I got these errors:
I have an object names: List[str]
, for len(names) …
I have a dataframe with the patient's diagnosis in a column and using pandas I want to dichotomize the diagnosis …
In the df underneath, I want to sort the values of column 'cdf_X' based on column 'A' and 'X'. Column …
I have a panel of stocks with these columns: Date, Ticker, Ret, MTB. I want to rank the stocks based …