Re: Testing django

2023-03-16 Thread Ayush Bisht
lag and > providing the path to the custom settings file . For example: > ./runtests.py --settings=new_app.test_settings > > What do you want to do exactly? > > On Fri, Mar 17, 2023 at 1:00 AM Ayush Bisht > wrote: > >> Seems like, it is for defining how actually we a

Re: Testing django

2023-03-16 Thread Ayush Bisht
Seems like, it is for defining how actually we are selecting the specific test case. It is very confusing at first. Can't we just explain it with an example.. On Friday, March 17, 2023 at 12:54:27 AM UTC+5:30 Ayush Bisht wrote: > * ./runtests.py --settings=path.to.setti

Testing django

2023-03-16 Thread Ayush Bisht
* ./runtests.py --settings=path.to.settings i18n.tests.TranslationTests* what exactly is the purpose of *path.to.settings,* I'm getting an error while running the above line. Can anyone please explain? *Error* Testing against Django installed in '/home/ayush/OS/django/django' with up to 8

Proxy Models in ForeignKey field

2022-10-14 Thread Ayush Bisht
Hey everyone, I need a help, regarding use of proxy models at foreignKey field. class User(AbstractUser): is_customer = models.BooleanField(default=False) ... class Customer(User): objects = CustomerManger() # get_queryset will filtered out all the models based on

Re: Allow field validation in ajax.

2021-06-17 Thread Ayush Bisht
If you specifically trying to validate the form on the basis of empty input field, then simply include *required* attribute in you input field ** and for more validation , you just validate all the thing in HTML only using django template tags... here I am including a descent approach ...

Re: In need of urgent help regarding dynamic image display v

2021-06-17 Thread Ayush Bisht
I think there is 2 method which you can do to get the work done. ... *1 : first one* .. you can declare a property decorator which just return the url of that image class Banner(BaseModel): image = ResizedImageField(upload_to="banner", null=True, blank=True)

Re: Adding Two Models In Django

2021-06-17 Thread Ayush Bisht
Ridwan Adeyemo > wrote: > >> Thanks man. >> >> On Wed, Jun 16, 2021, 5:22 PM Ayush Bisht wrote: >> >>> I think you are trying to sum up the value of two model fields and store >>> them in some other field. >>> >>> >>> so

Re: How to use django template tags in .js file ??

2021-06-17 Thread Ayush Bisht
thanks, It works for me On Wednesday, June 16, 2021 at 12:08:20 PM UTC-7 Nikeet NA wrote: > Or you can store the url in the variable then use it. > > On Thursday, 17 June 2021 at 00:29:00 UTC+5:30 Nikeet NA wrote: > >> Do like this use >> var obj_slug = object.slug inside script tag below

Re: Adding Two Models In Django

2021-06-16 Thread Ayush Bisht
I think you are trying to sum up the value of two model fields and store them in some other field. so for that u can proceed from base. simple you just have to update that field in save method for example : *class Student(models.Model):* maths_score = models.DecimalField()

How to use django template tags in .js file ??

2021-06-16 Thread Ayush Bisht
while doing great stuff with django I have found some clumsy behaviour of django in handling .js file. Is there a way to effectively integrate all the stuff of in a separate file and effectively used it with rest of the html code. for example : // *file.html

Re: Inlined hierarchy models in django admin site.

2021-06-01 Thread Ayush Bisht
(Patient, related_name="patient") # new > line > apply this line and your patient model will be linked with Vaccine model > > On Tue, Jun 1, 2021 at 11:06 AM Ayush Bisht wrote: > >> class Patient(models.Model): >> patient_id = models.CharField(max_

Re: Inlined hierarchy models in django admin site.

2021-06-01 Thread Ayush Bisht
R > wrote: > >> class Vaccine(models.Model) >> vaccine = models.ForeignKey(PatientVaccineStatus, >> related_name="vaccine_status") >> patient = models.ForeignKey(Patient, related_name="patient") # new >> line >> apply this

Inlined hierarchy models in django admin site.

2021-06-01 Thread Ayush Bisht
class Patient(models.Model): patient_id = models.CharField(max_length=60) class PatientVaccineStatus(models.Model): patient = models.ForeignKey(Patient, related_name="patient_vaccine_status") class Vaccine(models.Model) vaccine = models.ForeignKey(PatientVaccineStatus,

Custom Text filter field in django admin site.

2021-05-31 Thread Ayush Bisht
# admin.py class InputFilter(admin.SimpleListFilter): template = 'patient/input_filter.html' def lookups(self, request, model_admin): # Dummy, required to show the filter. return ((),) class PatientProfilePastDataFilter(InputFilter): parameter_name = 'patient'

Validate UserChangeForm from admin site

2021-05-11 Thread Ayush Bisht
# admin.py class CustomUserAdmin(UserAdmin): model = CustomUser add_form = CustomUserCreationForm fieldsets = ( *UserAdmin.fieldsets, ( 'User type',{ 'fields' : ( 'is_admin', 'is_doctor',