Re: Error on import psycopg2

2021-09-15 Thread FIRDOUS BHAT
Try installing this package,

pip install psycopg2-binary

On Wed, Sep 15, 2021 at 10:45 PM Kasper Laudrup 
wrote:

> On 15/09/2021 16.40, 'Maryam Yousaf' via Django users wrote:
> > Hello,
> >
> > I need psycopg2 for postgres database in django. While installing it, I
> > am getting below error. I tried everything on internet but it still
> > there. Kindly help me out.
> >
>
> Did you try this:
>
>
> https://stackoverflow.com/questions/65059310/apple-m1-install-psycopg2-package-symbol-not-found-pqbackendpid
>
> I don't know much about MacOSX, but I would assume you have an
> unsupported version of Postgres installed.
>
> Kind regards,
>
> Kasper Laudrup
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/d667e7fa-57a7-ee16-0390-6834e0f0f006%40stacktrace.dk
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAFB6YJrWD-Thhida0%2B1fzgzox6ca_CPSPoLgEzTveE8009VwVg%40mail.gmail.com.


Re: Error on import psycopg2

2021-09-15 Thread Kasper Laudrup

On 15/09/2021 16.40, 'Maryam Yousaf' via Django users wrote:

Hello,

I need psycopg2 for postgres database in django. While installing it, I 
am getting below error. I tried everything on internet but it still 
there. Kindly help me out.




Did you try this:

https://stackoverflow.com/questions/65059310/apple-m1-install-psycopg2-package-symbol-not-found-pqbackendpid

I don't know much about MacOSX, but I would assume you have an 
unsupported version of Postgres installed.


Kind regards,

Kasper Laudrup

--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/d667e7fa-57a7-ee16-0390-6834e0f0f006%40stacktrace.dk.


OpenPGP_0xE5D9CAC64AAA55EB.asc
Description: OpenPGP public key


OpenPGP_signature
Description: OpenPGP digital signature


How to do calculations in Model

2021-09-15 Thread joji...@gmail.com
Hello there,
I am creating a salary & payroll application in Django. I need your 
guidance in calcuating the salary and insert to salarydetails table. I 
wanted to know how we can do the calculation using models. For example 
first we need to calculate the salary details for each salary head after 
deducting the LOP(Loss of Pay). Then we need to calculate Provident Fund(12 
% of salary heads marked as IsConsiderforPF with a capping of Rs.15000). My 
question is whether all these complicated calculation can be achieved using 
models? Enclosed my Table structure.

*Employee:*
EmployeeId int,
EmployeeName Varchar(500),
Address Varchar(5000)

*SalaryHead:*
SalaryHeadId int,
SalaryHeadName varchar(1000),
IsLOPApplicable  boolean,
IsConsiderforPF boolean,
IsConsiderforPT boolean

*SalaryMaster*:
SalaryMasterId int,
EmployeeId int,
SalaryAmount Decimal(18,3)

*MonthlySalaryHeader*:
MonthlySalaryHeaderId int,
YearMonth int,
EmployeeId int,
TotalNoofDays int,
NoofDaysPresent int,
LOPDays int,

*MonthlySalaryDetails:*
MonthlySalaryDetailsid int,
MonthlySalaryHeaderId int,
SalaryHeadId int,
Amount Decimal(18,3)

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/b987af1d-92d4-40f5-98d7-bfac9f4e325fn%40googlegroups.com.


Hello Everyone

2021-09-15 Thread Lachi Teaching


I'm receiving that error  I add the line from .forms import 
CustomUserCreationForm into my views.py and it's driving me insane. I have 
no idea how to fix this. 

Exception in thread django-main-thread:

Traceback (most recent call last):

  File 
"C:\Users\Technicalsmirchis\AppData\Local\Programs\Python\Python38-32\lib\threading.py",
 
line 932, in _bootstrap_inner  

self.run()

  File 
"C:\Users\Technicalsmirchis\AppData\Local\Programs\Python\Python38-32\lib\threading.py",
 
line 870, in run

self._target(*self._args, **self._kwargs)

  File 
"C:\Users\Technicalsmirchis\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\utils\autoreload.py",
 
line 53, in wrapper

fn(*args, **kwargs)

  File 
"C:\Users\Technicalsmirchis\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\core\management\commands\runserver.py",
 
line 118, in inner_run

self.check(display_num_errors=True)

  File 
"C:\Users\Technicalsmirchis\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\core\management\base.py",
 
line 392, in check

all_issues = checks.run_checks(

  File 
"C:\Users\Technicalsmirchis\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\core\checks\registry.py",
 
line 70, in run_checks

new_errors = check(app_configs=app_configs, databases=databases)

  File 
"C:\Users\Technicalsmirchis\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\core\checks\urls.py",
 
line 13, in check_url_config

return check_resolver(resolver)

  File 
"C:\Users\Technicalsmirchis\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\core\checks\urls.py",
 
line 23, in check_resolver

return check_method()

  File 
"C:\Users\Technicalsmirchis\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\urls\resolvers.py",
 
line 

408, in check

for pattern in self.url_patterns:

  File 
"C:\Users\Technicalsmirchis\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\utils\functional.py",
 
line 48, in __get__

res = instance.__dict__[self.name] = self.func(instance)

  File 
"C:\Users\Technicalsmirchis\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\urls\resolvers.py",
 
line 

589, in url_patterns

patterns = getattr(self.urlconf_module, "urlpatterns", 
self.urlconf_module)

  File 
"C:\Users\Technicalsmirchis\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\utils\functional.py",
 
line 48, in __get__

res = instance.__dict__[self.name] = self.func(instance)

  File 
"C:\Users\Technicalsmirchis\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\urls\resolvers.py",
 
line 

582, in urlconf_module

return import_module(self.urlconf_name)

  File 
"C:\Users\Technicalsmirchis\AppData\Local\Programs\Python\Python38-32\lib\importlib\__init__.py",
 
line 127, in import_module

return _bootstrap._gcd_import(name[level:], package, level)

  File "", line 1014, in _gcd_import

  File "", line 991, in _find_and_load

  File "", line 975, in _find_and_load_unlocked

  File "", line 671, in _load_unlocked

  File "", line 783, in exec_module

  File "", line 219, in 
_call_with_frames_removed

  File "E:\coding\django\djecommerce\django-crm\djcrm\urls.py", line 22, in 


from leads.views import LandingPageView, SignupView

  File "E:\coding\django\djecommerce\django-crm\leads\views.py", line 6, in 


from .forms import LeadModelForm, LeadModelForm

  File "E:\coding\django\djecommerce\django-crm\leads\forms.py", line 27, 
in 

class CustomUserCreationForm(UserCreationForm):

  File 
"C:\Users\Technicalsmirchis\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\forms\models.py",
 
line 253, in __new__

fields = fields_for_model(

  File 
"C:\Users\Technicalsmirchis\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\forms\models.py",
 
line 142, in fields_for_model

opts = model._meta

AttributeError: 'function' object has no attribute '_meta'

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/de04207d-f5e5-425f-a0ac-ae0f4df71998n%40googlegroups.com.


Error on import psycopg2

2021-09-15 Thread 'Maryam Yousaf' via Django users
Hello,

I need psycopg2 for postgres database in django. While installing it, I am 
getting below error. I tried everything on internet but it still there. 
Kindly help me out.

Error:
"File 
"/Users/maryam.yousaf/Documents/venv/lib/python3.8/site-packages/psycopg2/__init__.py",
 
line 51, in 
from psycopg2._psycopg import ( # noqa
ImportError: 
dlopen(/Users/maryam.yousaf/Documents/venv/lib/python3.8/site-packages/psycopg2/_psycopg.cpython-38-darwin.so,
 
2): Symbol not found: _PQbackendPID
  Referenced from: 
/Users/maryam.yousaf/Documents/venv/lib/python3.8/site-packages/psycopg2/_psycopg.cpython-38-darwin.so
  Expected in: flat namespace
 in 
/Users/maryam.yousaf/Documents/venv/lib/python3.8/site-packages/psycopg2/_psycopg.cpython-38-darwin.so"

Regards,
Maryam.

-- 



This email and any files transmitted with it contain confidential 
information and/or privileged or personal advice. This email is intended 
for the addressee(s) stated above only. If you are not the addressee of the 
email please do not copy or forward it or otherwise use it or any part of 
it in any form whatsoever. If you have received this email in error please 
notify the sender and remove the e-mail from your system. Thank you.


This 
is an email from the company Just Eat Takeaway.com N.V., a public limited 
liability company with corporate seat in Amsterdam, the Netherlands, and 
address at Oosterdoksstraat 80, 1011 DK Amsterdam, registered with the 
Dutch Chamber of Commerce with number 08142836 and where the context 
requires, includes its subsidiaries and associated undertakings.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/a1ed0079-ee5f-4da1-977c-a02ee5600d6dn%40googlegroups.com.


Re: Greetings to Everyone

2021-09-15 Thread MR INDIA
Jinja 2 is quite different from django templates and you need to use . 
Jinja file extension. And configure it. And pls send GitHub link, and is 
there any error log or Trace back then send it. 
On Wednesday, 15 September 2021 at 18:52:10 UTC+5:30 faruk...@gmail.com 
wrote:

> Hello, 
> Could you please upload your code to GitHub or some other platform ? It is 
> really hard to read and track the code.
>
> 15 Eylül 2021 Çarşamba tarihinde saat 15:05:48 UTC+3 itibarıyla 
> mudahe...@gmail.com şunları yazdı:
>
>> i kindly need a help  i am making a static website into dynamic using 
>> Python Django and postgresql as my database 
>> i created models then i went in admin to register them then views to 
>> create the function  after i went into html code to put the jijna format so 
>> that it can display at the end i made migrations and it accepted very well 
>> 1 for home vieuw it accepting and display all the contents 
>> 2-- the problem comes to the second pages about us  that is where no 
>> content is being displayed but the content is all well in admin panel 
>> django site administration  i can add data but it can not display on about 
>> page 
>> i am kindly asking for help  Down is all the files necessary
>> Here is my models
>> from django.db import models
>> from django.db.models.fields import CharField, DateField
>> from django.db.models.fields.files import ImageField
>>
>> # Create your models here.
>> # slide show models 
>> class home_slide(models.Model):
>> 
>> s_title = models.CharField(max_length=100)
>> s_description = models.TextField(max_length=150)
>> s_button = models.CharField(max_length=20)
>> s_image = ImageField(upload_to = 'media')
>>
>> class Meta():
>> ordering = ("s_button","s_title","s_description")
>>
>> def __str__(self):
>> return f"{self.s_title},{self.s_description},{self.s_button}"
>>
>> # index -- course categories models 
>>
>> # short courses
>>
>> class shortcourse(models.Model):
>> sc_title = models.CharField(max_length=50)
>> sc_description = models.TextField(max_length=300)
>> sc_image = models.ImageField(upload_to = 'media')
>> sc_button = models.CharField(max_length=20)
>>
>> def __str__(self):
>> return f"{self.sc_title}, 
>> {self.sc_description},{self.sc_image},{self.sc_button}"
>>
>>
>> #testimonials 
>>
>> class testimonial(models.Model):
>> t_name = models.CharField(max_length=50)
>> t_categorie = models.CharField(max_length=20)
>> t_quote = models.TextField(max_length=300)
>> t_image = models.ImageField(upload_to='media/testimonials')
>>
>> def __str__(self):
>> return f"{self.t_name}, 
>> {self.t_categorie},{self.t_quote},{self.t_image}"
>>
>> #publications and news 
>>
>> class publication(models.Model):
>> p_date = models.DateField()
>> p_title = models.CharField(max_length=200)
>> p_description = models.TextField(max_length=400)
>> p_button = models.CharField(max_length=15)
>>
>> def __str__(self):
>> return f"{self.p_date}, {self.p_title}, {self.p_description}, 
>> {self.p_button}"
>>
>>
>> #  campus life style 
>>
>> class campuslife(models.Model):
>> cl_title = models.CharField(max_length=50)
>> cl_date = models.DateTimeField()
>> cl_description = models.TextField()
>> cl_image = models.ImageField(upload_to='media/campuslife')
>>
>> def __str__(self):
>> return f"{self.cl_title}, 
>> {self.cl_date},{self.cl_description},{self.cl_image}"
>>
>> # Gallery
>>
>> class gallery(models.Model):
>> g_image = models.ImageField(upload_to ='media/Gallery')
>>
>> def __str__(self):
>> return f"{self.g_image}"
>>
>>
>> """
>> About us 
>>
>> """
>> # home 
>>
>> class About(models.Model):
>> a_title = models.CharField(max_length=150)
>> a_desc = models.TextField(max_length=200)
>> a_image = models.ImageField(upload_to ='media/About')
>>
>> def __str__(self):
>> return f"{self.a_title},{self.a_desc},{self.a_image}"
>>
>> class description(models.Model):
>> d_title = models.CharField(max_length=200)
>> d_desc = models.TextField(max_length=1000)
>>
>> def __str__(self):
>> return f"{self.d_title},{self.d_desc}"
>>
>>
>> """
>> Admin
>> """
>> from django.contrib import admin
>> from schoolofci.models import About, campuslife, description, gallery, 
>> home_slide, publication, shortcourse, testimonial
>>
>> # Register your models here.
>> # home admin section 
>> @admin.register(home_slide)
>> class HomeSlideAdmin(admin.ModelAdmin):
>> list_display = ("s_title","s_description","s_button","s_image")
>> list_filter = ("s_button",)
>> fields = ("s_title","s_description","s_button","s_image")
>>
>> # courses  categories 
>>
>> # short courses
>> @admin.register(shortcourse)
>> class ShortCourse(admin.ModelAdmin):
>> list_display = ("sc_title","sc_description","sc_button","sc_image")
>> list_filter = ("sc_title",)
>> fields = 

Re: Greetings to Everyone

2021-09-15 Thread Sebastian Jung
Hello,

answer ist relativ simple:

Code:

  abt = {"About_slides":About_slides,"Description":Description}

return render(request, 'about.html')

you don't insert context in render. Right line:

return render(request, 'about.html',abt)

Regards


Am Mi., 15. Sept. 2021 um 14:05 Uhr schrieb Richard Dushime <
mudaherar...@gmail.com>:

> i kindly need a help  i am making a static website into dynamic using
> Python Django and postgresql as my database
> i created models then i went in admin to register them then views to
> create the function  after i went into html code to put the jijna format so
> that it can display at the end i made migrations and it accepted very well
> 1 for home vieuw it accepting and display all the contents
> 2-- the problem comes to the second pages about us  that is where no
> content is being displayed but the content is all well in admin panel
> django site administration  i can add data but it can not display on about
> page
> i am kindly asking for help  Down is all the files necessary
> Here is my models
> from django.db import models
> from django.db.models.fields import CharField, DateField
> from django.db.models.fields.files import ImageField
>
> # Create your models here.
> # slide show models
> class home_slide(models.Model):
>
> s_title = models.CharField(max_length=100)
> s_description = models.TextField(max_length=150)
> s_button = models.CharField(max_length=20)
> s_image = ImageField(upload_to = 'media')
>
> class Meta():
> ordering = ("s_button","s_title","s_description")
>
> def __str__(self):
> return f"{self.s_title},{self.s_description},{self.s_button}"
>
> # index -- course categories models
>
> # short courses
>
> class shortcourse(models.Model):
> sc_title = models.CharField(max_length=50)
> sc_description = models.TextField(max_length=300)
> sc_image = models.ImageField(upload_to = 'media')
> sc_button = models.CharField(max_length=20)
>
> def __str__(self):
> return f"{self.sc_title},
> {self.sc_description},{self.sc_image},{self.sc_button}"
>
>
> #testimonials
>
> class testimonial(models.Model):
> t_name = models.CharField(max_length=50)
> t_categorie = models.CharField(max_length=20)
> t_quote = models.TextField(max_length=300)
> t_image = models.ImageField(upload_to='media/testimonials')
>
> def __str__(self):
> return f"{self.t_name},
> {self.t_categorie},{self.t_quote},{self.t_image}"
>
> #publications and news
>
> class publication(models.Model):
> p_date = models.DateField()
> p_title = models.CharField(max_length=200)
> p_description = models.TextField(max_length=400)
> p_button = models.CharField(max_length=15)
>
> def __str__(self):
> return f"{self.p_date}, {self.p_title}, {self.p_description},
> {self.p_button}"
>
>
> #  campus life style
>
> class campuslife(models.Model):
> cl_title = models.CharField(max_length=50)
> cl_date = models.DateTimeField()
> cl_description = models.TextField()
> cl_image = models.ImageField(upload_to='media/campuslife')
>
> def __str__(self):
> return f"{self.cl_title},
> {self.cl_date},{self.cl_description},{self.cl_image}"
>
> # Gallery
>
> class gallery(models.Model):
> g_image = models.ImageField(upload_to ='media/Gallery')
>
> def __str__(self):
> return f"{self.g_image}"
>
>
> """
> About us
>
> """
> # home
>
> class About(models.Model):
> a_title = models.CharField(max_length=150)
> a_desc = models.TextField(max_length=200)
> a_image = models.ImageField(upload_to ='media/About')
>
> def __str__(self):
> return f"{self.a_title},{self.a_desc},{self.a_image}"
>
> class description(models.Model):
> d_title = models.CharField(max_length=200)
> d_desc = models.TextField(max_length=1000)
>
> def __str__(self):
> return f"{self.d_title},{self.d_desc}"
>
>
> """
> Admin
> """
> from django.contrib import admin
> from schoolofci.models import About, campuslife, description, gallery,
> home_slide, publication, shortcourse, testimonial
>
> # Register your models here.
> # home admin section
> @admin.register(home_slide)
> class HomeSlideAdmin(admin.ModelAdmin):
> list_display = ("s_title","s_description","s_button","s_image")
> list_filter = ("s_button",)
> fields = ("s_title","s_description","s_button","s_image")
>
> # courses  categories
>
> # short courses
> @admin.register(shortcourse)
> class ShortCourse(admin.ModelAdmin):
> list_display = ("sc_title","sc_description","sc_button","sc_image")
> list_filter = ("sc_title",)
> fields = ("sc_title","sc_description","sc_image","sc_button")
>
> # testimonials
> @admin.register(testimonial)
> class Testimonial(admin.ModelAdmin):
> list_display = ("t_name","t_categorie","t_quote","t_image")
> list_filter = ("t_name",)
> fields = ("t_name","t_categorie","t_quote","t_image")
>
>
> # publications
> 

Re: Greetings to Everyone

2021-09-15 Thread Ahmet Faruk Yılmaz
Hello, 
Could you please upload your code to GitHub or some other platform ? It is 
really hard to read and track the code.

15 Eylül 2021 Çarşamba tarihinde saat 15:05:48 UTC+3 itibarıyla 
mudahe...@gmail.com şunları yazdı:

> i kindly need a help  i am making a static website into dynamic using 
> Python Django and postgresql as my database 
> i created models then i went in admin to register them then views to 
> create the function  after i went into html code to put the jijna format so 
> that it can display at the end i made migrations and it accepted very well 
> 1 for home vieuw it accepting and display all the contents 
> 2-- the problem comes to the second pages about us  that is where no 
> content is being displayed but the content is all well in admin panel 
> django site administration  i can add data but it can not display on about 
> page 
> i am kindly asking for help  Down is all the files necessary
> Here is my models
> from django.db import models
> from django.db.models.fields import CharField, DateField
> from django.db.models.fields.files import ImageField
>
> # Create your models here.
> # slide show models 
> class home_slide(models.Model):
> 
> s_title = models.CharField(max_length=100)
> s_description = models.TextField(max_length=150)
> s_button = models.CharField(max_length=20)
> s_image = ImageField(upload_to = 'media')
>
> class Meta():
> ordering = ("s_button","s_title","s_description")
>
> def __str__(self):
> return f"{self.s_title},{self.s_description},{self.s_button}"
>
> # index -- course categories models 
>
> # short courses
>
> class shortcourse(models.Model):
> sc_title = models.CharField(max_length=50)
> sc_description = models.TextField(max_length=300)
> sc_image = models.ImageField(upload_to = 'media')
> sc_button = models.CharField(max_length=20)
>
> def __str__(self):
> return f"{self.sc_title}, 
> {self.sc_description},{self.sc_image},{self.sc_button}"
>
>
> #testimonials 
>
> class testimonial(models.Model):
> t_name = models.CharField(max_length=50)
> t_categorie = models.CharField(max_length=20)
> t_quote = models.TextField(max_length=300)
> t_image = models.ImageField(upload_to='media/testimonials')
>
> def __str__(self):
> return f"{self.t_name}, 
> {self.t_categorie},{self.t_quote},{self.t_image}"
>
> #publications and news 
>
> class publication(models.Model):
> p_date = models.DateField()
> p_title = models.CharField(max_length=200)
> p_description = models.TextField(max_length=400)
> p_button = models.CharField(max_length=15)
>
> def __str__(self):
> return f"{self.p_date}, {self.p_title}, {self.p_description}, 
> {self.p_button}"
>
>
> #  campus life style 
>
> class campuslife(models.Model):
> cl_title = models.CharField(max_length=50)
> cl_date = models.DateTimeField()
> cl_description = models.TextField()
> cl_image = models.ImageField(upload_to='media/campuslife')
>
> def __str__(self):
> return f"{self.cl_title}, 
> {self.cl_date},{self.cl_description},{self.cl_image}"
>
> # Gallery
>
> class gallery(models.Model):
> g_image = models.ImageField(upload_to ='media/Gallery')
>
> def __str__(self):
> return f"{self.g_image}"
>
>
> """
> About us 
>
> """
> # home 
>
> class About(models.Model):
> a_title = models.CharField(max_length=150)
> a_desc = models.TextField(max_length=200)
> a_image = models.ImageField(upload_to ='media/About')
>
> def __str__(self):
> return f"{self.a_title},{self.a_desc},{self.a_image}"
>
> class description(models.Model):
> d_title = models.CharField(max_length=200)
> d_desc = models.TextField(max_length=1000)
>
> def __str__(self):
> return f"{self.d_title},{self.d_desc}"
>
>
> """
> Admin
> """
> from django.contrib import admin
> from schoolofci.models import About, campuslife, description, gallery, 
> home_slide, publication, shortcourse, testimonial
>
> # Register your models here.
> # home admin section 
> @admin.register(home_slide)
> class HomeSlideAdmin(admin.ModelAdmin):
> list_display = ("s_title","s_description","s_button","s_image")
> list_filter = ("s_button",)
> fields = ("s_title","s_description","s_button","s_image")
>
> # courses  categories 
>
> # short courses
> @admin.register(shortcourse)
> class ShortCourse(admin.ModelAdmin):
> list_display = ("sc_title","sc_description","sc_button","sc_image")
> list_filter = ("sc_title",)
> fields = ("sc_title","sc_description","sc_image","sc_button")
>
> # testimonials 
> @admin.register(testimonial)
> class Testimonial(admin.ModelAdmin):
> list_display = ("t_name","t_categorie","t_quote","t_image")
> list_filter = ("t_name",)
> fields = ("t_name","t_categorie","t_quote","t_image")
>
>
> # publications 
> @admin.register(publication)
> class Publications(admin.ModelAdmin):
> list_display = 

Greetings to Everyone

2021-09-15 Thread Richard Dushime
i kindly need a help  i am making a static website into dynamic using
Python Django and postgresql as my database
i created models then i went in admin to register them then views to create
the function  after i went into html code to put the jijna format so that
it can display at the end i made migrations and it accepted very well
1 for home vieuw it accepting and display all the contents
2-- the problem comes to the second pages about us  that is where no
content is being displayed but the content is all well in admin panel
django site administration  i can add data but it can not display on about
page
i am kindly asking for help  Down is all the files necessary
Here is my models
from django.db import models
from django.db.models.fields import CharField, DateField
from django.db.models.fields.files import ImageField

# Create your models here.
# slide show models
class home_slide(models.Model):

s_title = models.CharField(max_length=100)
s_description = models.TextField(max_length=150)
s_button = models.CharField(max_length=20)
s_image = ImageField(upload_to = 'media')

class Meta():
ordering = ("s_button","s_title","s_description")

def __str__(self):
return f"{self.s_title},{self.s_description},{self.s_button}"

# index -- course categories models

# short courses

class shortcourse(models.Model):
sc_title = models.CharField(max_length=50)
sc_description = models.TextField(max_length=300)
sc_image = models.ImageField(upload_to = 'media')
sc_button = models.CharField(max_length=20)

def __str__(self):
return f"{self.sc_title},
{self.sc_description},{self.sc_image},{self.sc_button}"


#testimonials

class testimonial(models.Model):
t_name = models.CharField(max_length=50)
t_categorie = models.CharField(max_length=20)
t_quote = models.TextField(max_length=300)
t_image = models.ImageField(upload_to='media/testimonials')

def __str__(self):
return f"{self.t_name},
{self.t_categorie},{self.t_quote},{self.t_image}"

#publications and news

class publication(models.Model):
p_date = models.DateField()
p_title = models.CharField(max_length=200)
p_description = models.TextField(max_length=400)
p_button = models.CharField(max_length=15)

def __str__(self):
return f"{self.p_date}, {self.p_title}, {self.p_description},
{self.p_button}"


#  campus life style

class campuslife(models.Model):
cl_title = models.CharField(max_length=50)
cl_date = models.DateTimeField()
cl_description = models.TextField()
cl_image = models.ImageField(upload_to='media/campuslife')

def __str__(self):
return f"{self.cl_title},
{self.cl_date},{self.cl_description},{self.cl_image}"

# Gallery

class gallery(models.Model):
g_image = models.ImageField(upload_to ='media/Gallery')

def __str__(self):
return f"{self.g_image}"


"""
About us

"""
# home

class About(models.Model):
a_title = models.CharField(max_length=150)
a_desc = models.TextField(max_length=200)
a_image = models.ImageField(upload_to ='media/About')

def __str__(self):
return f"{self.a_title},{self.a_desc},{self.a_image}"

class description(models.Model):
d_title = models.CharField(max_length=200)
d_desc = models.TextField(max_length=1000)

def __str__(self):
return f"{self.d_title},{self.d_desc}"


"""
Admin
"""
from django.contrib import admin
from schoolofci.models import About, campuslife, description, gallery,
home_slide, publication, shortcourse, testimonial

# Register your models here.
# home admin section
@admin.register(home_slide)
class HomeSlideAdmin(admin.ModelAdmin):
list_display = ("s_title","s_description","s_button","s_image")
list_filter = ("s_button",)
fields = ("s_title","s_description","s_button","s_image")

# courses  categories

# short courses
@admin.register(shortcourse)
class ShortCourse(admin.ModelAdmin):
list_display = ("sc_title","sc_description","sc_button","sc_image")
list_filter = ("sc_title",)
fields = ("sc_title","sc_description","sc_image","sc_button")

# testimonials
@admin.register(testimonial)
class Testimonial(admin.ModelAdmin):
list_display = ("t_name","t_categorie","t_quote","t_image")
list_filter = ("t_name",)
fields = ("t_name","t_categorie","t_quote","t_image")


# publications
@admin.register(publication)
class Publications(admin.ModelAdmin):
list_display = ("p_date","p_title","p_description","p_button")
list_filter = ("p_title",)
fields = ("p_date","p_title","p_description","p_button")

# campus life
@admin.register(campuslife)
class Campuslife(admin.ModelAdmin):
list_display = ("cl_title","cl_date","cl_description","cl_image")
list_filter = ("cl_title",)
fields = ("cl_title","cl_date","cl_description","cl_image")


# gallery

@admin.register(gallery)
class Gallery(admin.ModelAdmin):
list_display = ("g_image",)




"""
About us page

"""
# home slides

Re: Abstract base user

2021-09-15 Thread Muhammad Shehzad
class UserManager(DjangoUserManager):
def create_one_user(self, username, email, password, **extra_fields):
return self._create_user(
username, email, password, type="one", **extra_fields
)

def create_two_user(self, username, email, password, **extra_fields):
return self._create_user(
username, email, password, type="two", **extra_fields
)

class User(AbstractUser):
class Type(models.TextChoices):
ORGANIZATION = "one"
CANDIDATE = "two"

objects = UserManager()

On Fri, Sep 10, 2021 at 10:49 PM afsana shamsudheen <
afsanashamsudh...@gmail.com> wrote:

> how can i add two different users in django?
> and make registration and loginform
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/1dc8141c-53b7-4f7e-bee4-991160749ba0n%40googlegroups.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAGv3YNBOqA7o_GkYZ%2BfXAY_cW1CKL40HCMEjhB1mRJ-rSOkGew%40mail.gmail.com.